![]() |
Home | Libraries | People | FAQ | More |
#include <boost/math/distributions/normal.hpp>
namespace boost{ namespace math{ template <class RealType = double, class Policy = policies::policy<> > class normal_distribution; typedef normal_distribution<> normal; template <class RealType, class Policy> class normal_distribution { public: typedef RealType value_type; typedef Policy policy_type; // 構造: normal_distribution(RealType mean = 0, RealType sd = 1); // 訪問函數(Accessors): RealType mean()const; // 位置(location). RealType standard_deviation()const; // 尺度(scale). // Synonyms, 用於允許函數 find_location 和 find_scale一般化的使用而提供. RealType location()const; RealType scale()const; }; }} // namespaces
正態分佈(normal distribution)可能是最廣為人知的一種統計分佈:它也稱作高斯分佈(Gaussian Distribution)。均值為0且標準差為1的正態分佈(normal distribution)也被稱作標準正態分佈(Standard Normal Distribution)。
給定均值(mean) μ 和標準差(standard deviation) σ ,函數PDF為:
參數不同的多種PDF函數的圖像如下:
normal_distribution(RealType mean = 0, RealType sd = 1);
使用均值(mean) mean 和標準差( standard deviation) sd構造一個正態分佈(normal distribution)。
要求 sd > 0,否則調用 定義域錯誤 。
RealType mean()const; RealType location()const;
都返回分佈的均值( mean )。
RealType standard_deviation()const; RealType scale()const;
都返回分佈的標準差(standard deviation )。 (提供多餘的(Redundant)位置( location )和尺度(scale)函數用於與其它的類似分佈相匹配,允許函數 find_location 和 find_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)。
隨機變量的定義域是 [-[max_value], +[min_value]]。然而,如果RealType允許的話,參數為 +∞ 和 -∞時,函數pdf 的值為0,cdf -∞ = 0 且 cdf +∞ = 1,以及補集(complement)cdf -∞ = 1 且 補集(complement)cdf +∞ = 0也得到支持。
正態分佈(normal distribution)使用error function實現,並且誤差率(error rate)很低。
在下面的表中,m 是分佈的均值( mean),s 是標準差( standard deviation)。
|
函數 |
實現註解 |
|---|---|
|
|
使用關係: pdf = e-(x-m)2/(2s2) / (s * sqrt(2*pi)) |
|
cdf |
使用關係: p = 0.5 * erfc(-(x-m)/(s*sqrt(2))) |
|
cdf 補集complement |
使用關係: q = 0.5 * erfc((x-m)/(s*sqrt(2))) |
|
分位點(quantile) |
使用關係: x = m - s * sqrt(2) * erfc_inv(2*p) |
|
補集的分位點(quantile from the complement ) |
使用關係: x = m + s * sqrt(2) * erfc_inv(2*p) |
|
均值和標準差(mean and standard deviation ) |
與 |
|
眾數(mode) |
與均值( mean)相同. |
|
偏斜(skewness) |
0 |
|
峰態(kurtosis) |
3 |
|
峰態超越(kurtosis excess) |
0 |