![]() |
Home | Libraries | People | FAQ | More |
#include <boost/math/distributions/lognormal.hpp>
namespace boost{ namespace math{ template <class RealType = double, class Policy = policies::policy<> > class lognormal_distribution; typedef lognormal_distribution<> lognormal; template <class RealType, class Policy> class lognormal_distribution { public: typedef RealType value_type; typedef Policy policy_type; // 構造: lognormal_distribution(RealType location = 0, RealType scale = 1); // 訪問函數(Accessors): RealType location()const; RealType scale()const; }; }} // namespaces
對數正態分佈(lognormal distribution)是當隨機變量的對數是正規地分佈的時候產生的分佈類型。對數正態分佈(lognormal distribution)起因於變量是大量的相互獨立,恆等分佈(identically-distributed)的變量的積。
對於位置參數(location parameter)m 和尺度參數(scale parameters) s ,概率密度函數定義為:
位置參數(location parameter)和尺度參數(scale parameter)等價於隨機變量對數的均值(mean)和標準差(standard deviation)。
下面的圖像顯示了位置參數(location parameter)對函數PDF產生的影響,注意:隨機變量的範圍保持在區間[0,+∞],而不考慮位置參數(location parameter)的值。
下面的圖像顯示了尺度參數(scale parameter)對函數PDF的影響:
lognormal_distribution(RealType location = 0, RealType scale = 1);
使用位置參數(location parameter)location 和尺度參數(scale parameter)scale來構造一個對數正態分佈(lognormal distribution)。
位置參數(location parameter)與隨機變量對數的均值(mean)相同。
尺度參數(scale parameter)與隨機變量對數的標準差(standard deviation)相同。
要求:尺度參數(scale parameter)大於0,否則調用定義域錯誤。
RealType location()const;
返回對數正態分佈的位置參數(location parameter)location 。
RealType scale()const;
返回對數正態分佈的尺度參數(scale parameter)scale。
支持所有的分佈都通用的 常見的非成員訪問函數 : 累積分佈函數(Cumulative Distribution Function),概率密度函數(Probability Density Function),分位點(Quantile), 故障率函數(Hazard Function), 累積危險函數(Cumulative Hazard Function), 均值(mean), 中位數(median), 眾數(mode), 方差(variance), 標準差(standard deviation), 偏斜(skewness), 峰態(kurtosis), 峰態超越(kurtosis_excess), 值域(range) 以及 支持(support)。
隨機變量的定義域為: [0,+∞]。
對數正態分佈(lognormal distribution)使用標準庫函數log 和 exp 來實現,加上error function,並且誤差率(error rates)非常低。
在下面的表中:m 是分佈的位置參數(location parameter),s 是尺度參數(scale parameter),x 是隨機變量,p 是概率且q = 1-p。
|
函數 |
實現註解 |
|---|---|
|
|
使用關係: pdf = e-(ln(x) - m)2 / 2s2 / (x * s * sqrt(2pi)) |
|
cdf |
使用關係: p = cdf(normal_distribtion<RealType>(m, s), log(x)) |
|
cdf 補集(complement) |
使用關係: q = cdf(complement(normal_distribtion<RealType>(m, s), log(x))) |
|
分位點(quantile) |
使用關係: x = exp(quantile(normal_distribtion<RealType>(m, s), p)) |
|
補集的分位點(quantile from the complement) |
使用關係: x = exp(quantile(complement(normal_distribtion<RealType>(m, s), q))) |
|
均值(mean) |
em + s2 / 2 |
|
方差(variance) |
(es2 - 1) * e2m + s2 |
|
眾數(mode) |
em + s2 |
|
偏斜(skewness) |
sqrt(es2 - 1) * (2 + es2 ) |
|
峰態(kurtosis) |
e4s2 + 2e3s2 + 3e2s2 - 3 |
|
峰態超越(kurtosis excess) |
e4s2 + 2e3s2 + 3e2s2 - 6 |