哪个java-library计算累积标准正态分布函数?

Mne*_*nth 9 java statistics probability computation

对于一个项目,我有一个公式的规范,我必须实现.在这些公式中,存在累积标准正态分布函数,其采用浮点并输出概率.该功能由Φ表示.存在一个Java库,它可以计算这个函数吗?

Yuv*_*dam 13

Apache Commons - 数学有你想要的.

更具体地说,看看NormalDistribution课程.


Erk*_*Erk 7

如果你想要确切的代码,这个似乎与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


Mne*_*nth 3

一位同事建议使用colt,因为他以前使用过它。该函数的结果与参考文档中的示例完全相同。