public class ChiSquare
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
ChiSquare()
Make class non-instantiable but inheritable.
|
Modifier and Type | Method and Description |
---|---|
static double |
chisquare(double chisq,
double df)
Compute probability for chi-square distribution.
|
static double |
chisquareInverse(double p,
double df)
Compute percentage point for chi-square distribution.
|
public static double chisquare(double chisq, double df)
chisq
- Percentage point of chi-square distributiondf
- Degrees of freedomThe probability is determined using the relationship between the incomplete gamma CDF and the chi-square distribution:
chisqprob(chisq,df) = incompleteGamma( chisq/2, df/2 )
The result is accurate to about 14 decimal digits.
public static double chisquareInverse(double p, double df)
p
- Probability level for which to compute
percentage pointdf
- Degrees of freedomjava.lang.IllegalArgumentException
- If df <= 0 or p very near zero or
p very near one. A tolerance of
1.0e-15 is used for testing the
value of p.
Implements the method of Best and Roberts (1975). The result accuracy varies, but should be good to at least 10 decimal digits in all cases.