2

维基百科列出了多种计算正态分布累积概率的数值方法。但是,使用 Apache Commons Math,您不需要了解它们中的任何一个,因为该库只是为您完成了这项工作:

NormalDistribution normal = new NormalDistribution(mu, sigma);
normal.cumulativeProbability(x);

对于一些研究项目,我很想知道他们使用什么方法。有谁知道 Apache Commons Math 使用什么方法来近似正常累积值?是来自维基百科中列出的方法还是他们实现了不同的东西?

4

2 回答 2

4

开源软件的美妙之处在于您可以随时查看源代码。的实现cumulativeProbability相当简单,它只是返回

0.5 * (1 + Erf.erf(dev / (standardDeviation * SQRT2)));

其中Erf.erf计算误差函数。它在这里定义。

不,它不使用提到的维基百科文章中的任何特殊方法。这只是公式的直接实现

在此处输入图像描述

于 2015-04-21T20:17:56.747 回答
1

您可能会看到源代码或 javadoc。见那里http://commons.apache.org/proper/commons-math/source-repository.html

http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/distribution/NormalDistribution.html

此外,用户指南中有很多信息。关于分发的部分似乎很有趣:http ://commons.apache.org/proper/commons-math/userguide/distribution.html

于 2015-04-21T20:13:24.037 回答