Mne*_*nth 9 java statistics probability computation
对于一个项目,我有一个公式的规范,我必须实现.在这些公式中,存在累积标准正态分布函数,其采用浮点并输出概率.该功能由Φ表示.存在一个Java库,它可以计算这个函数吗?
如果你想要确切的代码,这个似乎与OpenOffice Calc中使用的功能相同(我已经对它进行了一些更改,以便在java中工作):
// returns the cumulative normal distribution function (CNDF)
// for a standard normal: N(0,1)
double CNDF(double x)
{
int neg = (x < 0d) ? 1 : 0;
if ( neg == 1)
x *= -1d;
double k = (1d / ( 1d + 0.2316419 * x));
double y = (((( 1.330274429 * k - 1.821255978) * k + 1.781477937) *
k - 0.356563782) * k + 0.319381530) * k;
y = 1.0 - 0.398942280401 * Math.exp(-0.5 * x * x) * y;
return (1d - neg) * y + neg * (1d - y);
}
Run Code Online (Sandbox Code Playgroud)
在这里找到它:http://www.codeproject.com/Messages/2622967/Re-NORMSDIST-function.aspx
归档时间: |
|
查看次数: |
21741 次 |
最近记录: |