SSJ
V. 1.2.5.

umontreal.iro.lecuyer.probdist
Class ChiSquareDistQuick

java.lang.Object
  extended by umontreal.iro.lecuyer.probdist.ContinuousDistribution
      extended by umontreal.iro.lecuyer.probdist.ChiSquareDist
          extended by umontreal.iro.lecuyer.probdist.ChiSquareDistQuick
All Implemented Interfaces:
Distribution

public class ChiSquareDistQuick
extends ChiSquareDist

Provides a variant of 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.


Field Summary
 
Fields inherited from class umontreal.iro.lecuyer.probdist.ContinuousDistribution
decPrec
 
Constructor Summary
ChiSquareDistQuick(int n)
          Constructs a chi-square distribution with n degrees of freedom.
 
Method Summary
 double inverseF(double u)
          Computes and returns the inverse distribution function F-1(u), defined in.
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.
 
Methods inherited from class umontreal.iro.lecuyer.probdist.ChiSquareDist
barF, barF, cdf, cdf, density, density, getInstanceFromMLE, getMaximumLikelihoodEstimate, getMean, getMean, getMomentsEstimate, getN, getStandardDeviation, getStandardDeviation, getVariance, getVariance, setN
 
Methods inherited from class umontreal.iro.lecuyer.probdist.ContinuousDistribution
inverseBisection, inverseBrent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChiSquareDistQuick

public ChiSquareDistQuick(int n)
Constructs a chi-square distribution with n degrees of freedom.

Method Detail

inverseF

public double inverseF(double u)
Description copied from interface: Distribution
Computes and returns the inverse distribution function F-1(u), defined in.

Specified by:
inverseF in interface Distribution
Overrides:
inverseF in class ChiSquareDist
Parameters:
u - value in the interval (0, 1) for which the inverse distribution function is evaluated
Returns:
the inverse distribution function evaluated at u

inverseF

public 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. Uses the approximation given in Figure L.24 of Bratley, Fox and Schrage (1987) over most of the range. For u < 0.02 or u > 0.98, it uses the approximation given in Goldstein for n >= 10, and returns 2.0 * 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.


SSJ
V. 1.2.5.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.