函數(shù)名:stats_dens_logistic()
適用版本:PHP 7.2.0 及以上版本
用法: stats_dens_logistic(float $x, float $location, float $scale): float
該函數(shù)用于計(jì)算給定位置和尺度參數(shù)下,logistic分布在給定數(shù)值$x處的概率密度。
參數(shù):
- $x:要計(jì)算概率密度的數(shù)值。
- $location:logistic分布的位置參數(shù)。
- $scale:logistic分布的尺度參數(shù)。
返回值: 返回給定$x處的概率密度值,如果發(fā)生錯(cuò)誤,則返回false。
示例:
// 計(jì)算logistic分布在x=2處的概率密度,位置參數(shù)為1.5,尺度參數(shù)為0.8
$probability = stats_dens_logistic(2, 1.5, 0.8);
echo "概率密度為:" . $probability;
輸出:
概率密度為:0.113979383463518
注意事項(xiàng):
- 該函數(shù)僅適用于PHP 7.2.0及以上版本。
- 參數(shù)$x、$location和$scale必須為浮點(diǎn)數(shù)。
- 如果發(fā)生錯(cuò)誤(例如參數(shù)錯(cuò)誤或計(jì)算錯(cuò)誤),函數(shù)將返回false。
- 請(qǐng)確保在使用該函數(shù)之前已經(jīng)加載了stats擴(kuò)展模塊。