ここおよびここ で説明されているように、 で使用可能なエラー関数を使用できます。org.apache.commons.math.special.Erf
補遺: @Brent Worden の回答で提案されている方法は、このような問題の解決を大幅に簡素化します。具体的な例として、以下のコードは、参照する例を解決する方法を示しています。さらに、ここcumulativeProbability()
での定義をusingの実装と比較すると役立つことがわかりましたErf.erf
。inverseCumulativeProbability()
の実装が必要な反復アプローチを一般化する方法にも注意してください 。
import org.apache.commons.math.MathException;
import org.apache.commons.math.distribution.NormalDistribution;
import org.apache.commons.math.distribution.NormalDistributionImpl;
/**
* @see http://stattrek.com/Tables/Normal.aspx#examples
* @see https://stackoverflow.com/questions/6353678
*/
public class CumulativeProbability {
private static NormalDistribution d;
public static void main(String[] args) throws MathException {
// Problem 1; µ = 1000; σ = 100
d = new NormalDistributionImpl(1000, 100);
System.out.println(d.cumulativeProbability(1200));
// Problem 2; µ = 50; σ = 10
d = new NormalDistributionImpl(50, 10);
System.out.println(d.inverseCumulativeProbability(0.9));
}
}
コンソール:
0.9772498680518208
62.81551565546365
討論:
問題 1. 標準偏差 100 時間で平均 1000 時間持続する正規分布寿命を持つデバイスの中で、~97.7% が 1200 時間以内に故障します。
問題 2. 平均 50 回、標準偏差 10 回の正規分布スキルを持つ人は、63 回で人口の 90% を超えることができます。