Statistics/Chi-squared distribution: Difference between revisions

m
Minor formatting changes.
(New post.)
m (Minor formatting changes.)
Line 209:
System.out.println();
System.out.println(" Values for the Chi-squared distribution with 3 degrees of freedom");
System.out.println("Chi-squared cumulative pdf p-value");
for ( int x : List.of( 1, 2, 4, 8, 16, 32 ) ) {
final double cdf = cdf(x, 3);
System.out.println(String.format("%5d6d%2019.6f%2014.6f", x, cdf, ( 1.0 - cdf )));
}
Line 259:
// The cumulative probability function of the Chi-squared distribution.
private static double cdf(double aX, double aK) {
if ( aX > 1_000 && aK < 100 ) {
return 1.0;
}
return ( aX > 0.0 && aK > 0.0 ) ? gammaCDF(aX / 2, aK / 2) : 0.0;
}
908

edits