public class ChiSquareDistQuick extends ChiSquareDist
ChiSquareDist with
faster but less accurate methods.
The non-static version of
inverseF calls the static version.
This method is not very accurate for small n but becomes
better as n increases.
The other methods are the same as in ChiSquareDist.decPrec| Constructor and Description |
|---|
ChiSquareDistQuick(int n)
Constructs a chi-square distribution with n degrees of freedom.
|
| Modifier and Type | Method and Description |
|---|---|
double |
inverseF(double u)
Returns the inverse distribution function
x = F-1(u).
|
static double |
inverseF(int n,
double u)
Computes a quick-and-dirty approximation of F-1(u),
where F is the chi-square distribution with n degrees of freedom.
|
barF, barF, cdf, cdf, density, density, getInstanceFromMLE, getMaximumLikelihoodEstimate, getMean, getMean, getMLE, getMomentsEstimate, getN, getParams, getStandardDeviation, getStandardDeviation, getVariance, getVariance, setN, toStringgetXinf, getXsup, inverseBisection, inverseBrent, setXinf, setXsuppublic ChiSquareDistQuick(int n)
public double inverseF(double u)
ContinuousDistributioninverseF in interface DistributioninverseF in class ChiSquareDistu - value at which the inverse distribution function is evaluatedpublic static double inverseF(int n,
double u)
GammaDist.inverseF (n/2, 6, u)
for n < 10 in order to avoid
the loss of precision of the above approximations.
When n >= 10 or
0.02 < u < 0.98,
it is between 20 to 30 times faster than the same method in
ChiSquareDist for n between 10 and 1000 and even faster
for larger n.
Note that the number d of decimal digits of precision generally increases with n. For n = 3, we only have d = 3 over most of the range. For n = 10, d = 5 except far in the tails where d = 3. For n = 100, one has more than d = 7 over most of the range and for n = 1000, at least d = 8. The cases n = 1 and n = 2 are exceptions, with precision of about d = 10.
To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.