Extends the class ContinuousDistribution for the chi-square distribution with \(n\) degrees of freedom, where \(n\) is a positive integer [95] (page 416). More...
Public Member Functions | |
| ChiSquareDist (int n) | |
| Constructs a chi-square distribution with n degrees of freedom. | |
| double | density (double x) |
| Returns \(f(x)\), the density evaluated at \(x\). | |
| double | cdf (double x) |
| Returns the distribution function \(F(x)\). | |
| double | barF (double x) |
| Returns the complementary distribution function. | |
| double | inverseF (double u) |
| Returns the inverse distribution function \(x = F^{-1}(u)\). | |
| double | getMean () |
| Returns the mean. | |
| double | getVariance () |
| Returns the variance. | |
| double | getStandardDeviation () |
| Returns the standard deviation. | |
| int | getN () |
| Returns the parameter \(n\) of this object. | |
| void | setN (int n) |
| Sets the parameter \(n\) of this object. | |
| double[] | getParams () |
| Return a table containing the parameters of the current distribution. | |
| String | toString () |
| Returns a String containing information about the current distribution. | |
| Public Member Functions inherited from umontreal.ssj.probdist.ContinuousDistribution | |
| double | inverseBrent (double a, double b, double u, double tol) |
| Computes the inverse distribution function \(x = F^{-1}(u)\), using the Brent-Dekker method. | |
| double | inverseBisection (double u) |
| Computes and returns the inverse distribution function \(x = F^{-1}(u)\), using bisection. | |
| double | getXinf () |
| Returns \(x_a\) such that the probability density is 0 everywhere outside the interval \([x_a, x_b]\). | |
| double | getXsup () |
| Returns \(x_b\) such that the probability density is 0 everywhere outside the interval \([x_a, x_b]\). | |
| void | setXinf (double xa) |
| Sets the value \(x_a=\) xa, such that the probability density is 0 everywhere outside the interval \([x_a, x_b]\). | |
| void | setXsup (double xb) |
| Sets the value \(x_b=\) xb, such that the probability density is 0 everywhere outside the interval \([x_a, x_b]\). | |
Static Public Member Functions | |
| static double | density (int n, double x) |
Computes the density function ( Fchi2 ) for a chi-square distribution with \(n\) degrees of freedom. | |
| static double | cdf (int n, int d, double x) |
| Computes the chi-square distribution function with \(n\) degrees of freedom, evaluated at \(x\). | |
| static double | barF (int n, int d, double x) |
| Computes the complementary chi-square distribution function with. | |
| static double | inverseF (int n, double u) |
| Computes an approximation of \(F^{-1}(u)\), where \(F\) is the chi-square distribution with \(n\) degrees of freedom. | |
| static double[] | getMLE (double[] x, int m) |
| Estimates the parameter \(n\) of the chi-square distribution using the maximum likelihood method, from the \(m\) observations. | |
| static ChiSquareDist | getInstanceFromMLE (double[] x, int m) |
| Creates a new instance of a chi-square distribution with parameter. | |
| static double | getMean (int n) |
| Computes and returns the mean \(E[X] = n\) of the chi-square distribution with parameter \(n\). | |
| static double[] | getMomentsEstimate (double[] x, int m) |
| Estimates and returns the parameter [ \(\hat{n}\)] of the chi-square distribution using the moments method based on the. | |
| static double | getVariance (int n) |
| Returns the variance \(\mbox{Var}[X] = 2n\) of the chi-square distribution with parameter \(n\). | |
| static double | getStandardDeviation (int n) |
| Returns the standard deviation of the chi-square distribution with parameter \(n\). | |
Extends the class ContinuousDistribution for the chi-square distribution with \(n\) degrees of freedom, where \(n\) is a positive integer [95] (page 416).
Its density is
\[ f(x) = \frac{x^{(n/2)-1}e^{-x/2}}{2^{n/2}\Gamma(n/2)},\qquad\mbox{for } x > 0 \tag{Fchi2} \]
where \(\Gamma(x)\) is the gamma function defined in ( Gamma ). The chi-square distribution is a special case of the gamma distribution with shape parameter \(n/2\) and scale parameter \(1/2\). Therefore, one can use the methods of GammaDist for this distribution.
The non-static versions of the methods cdf, barF, and inverseF call the static version of the same name.
Definition at line 51 of file ChiSquareDist.java.
| umontreal.ssj.probdist.ChiSquareDist.ChiSquareDist | ( | int | n | ) |
Constructs a chi-square distribution with n degrees of freedom.
Definition at line 74 of file ChiSquareDist.java.
| double umontreal.ssj.probdist.ChiSquareDist.barF | ( | double | x | ) |
Returns the complementary distribution function.
The default implementation computes \(\bar{F}(x) = 1 - F(x)\).
| x | value at which the complementary distribution function is evaluated |
Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.
Definition at line 88 of file ChiSquareDist.java.
|
static |
Computes the complementary chi-square distribution function with.
\(n\) degrees of freedom, evaluated at \(x\). The method tries to return \(d\) decimals digits of precision, but there is no guarantee.
Definition at line 140 of file ChiSquareDist.java.
| double umontreal.ssj.probdist.ChiSquareDist.cdf | ( | double | x | ) |
Returns the distribution function \(F(x)\).
| x | value at which the distribution function is evaluated |
Implements umontreal.ssj.probdist.Distribution.
Definition at line 84 of file ChiSquareDist.java.
|
static |
Computes the chi-square distribution function with \(n\) degrees of freedom, evaluated at \(x\).
The method tries to return \(d\) decimals digits of precision, but there is no guarantee.
Definition at line 123 of file ChiSquareDist.java.
| double umontreal.ssj.probdist.ChiSquareDist.density | ( | double | x | ) |
Returns \(f(x)\), the density evaluated at \(x\).
| x | value at which the density is evaluated |
Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.
Definition at line 78 of file ChiSquareDist.java.
|
static |
Computes the density function ( Fchi2 ) for a chi-square distribution with \(n\) degrees of freedom.
Definition at line 112 of file ChiSquareDist.java.
|
static |
Creates a new instance of a chi-square distribution with parameter.
\(n\) estimated using the maximum likelihood method based on the \(m\) observations \(x[i]\), \(i = 0, 1, …, m-1\).
| x | the list of observations to use to evaluate parameters |
| m | the number of observations to use to evaluate parameters |
Definition at line 293 of file ChiSquareDist.java.
| double umontreal.ssj.probdist.ChiSquareDist.getMean | ( | ) |
Returns the mean.
Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.
Definition at line 96 of file ChiSquareDist.java.
|
static |
Computes and returns the mean \(E[X] = n\) of the chi-square distribution with parameter \(n\).
Definition at line 304 of file ChiSquareDist.java.
|
static |
Estimates the parameter \(n\) of the chi-square distribution using the maximum likelihood method, from the \(m\) observations.
\(x[i]\), \(i = 0, 1, …, m-1\). The estimate is returned in element 0 of the returned array.
| x | the list of observations to use to evaluate parameters |
| m | the number of observations to use to evaluate parameters |
Definition at line 258 of file ChiSquareDist.java.
|
static |
Estimates and returns the parameter [ \(\hat{n}\)] of the chi-square distribution using the moments method based on the.
\(m\) observations in table \(x[i]\), \(i = 0, 1, …, m-1\).
| x | the list of observations to use to evaluate parameters |
| m | the number of observations to use to evaluate parameters |
Definition at line 320 of file ChiSquareDist.java.
| int umontreal.ssj.probdist.ChiSquareDist.getN | ( | ) |
Returns the parameter \(n\) of this object.
Definition at line 360 of file ChiSquareDist.java.
| double[] umontreal.ssj.probdist.ChiSquareDist.getParams | ( | ) |
Return a table containing the parameters of the current distribution.
Implements umontreal.ssj.probdist.Distribution.
Definition at line 379 of file ChiSquareDist.java.
| double umontreal.ssj.probdist.ChiSquareDist.getStandardDeviation | ( | ) |
Returns the standard deviation.
Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.
Definition at line 104 of file ChiSquareDist.java.
|
static |
Returns the standard deviation of the chi-square distribution with parameter \(n\).
Definition at line 350 of file ChiSquareDist.java.
| double umontreal.ssj.probdist.ChiSquareDist.getVariance | ( | ) |
Returns the variance.
Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.
Definition at line 100 of file ChiSquareDist.java.
|
static |
Returns the variance \(\mbox{Var}[X] = 2n\) of the chi-square distribution with parameter \(n\).
Definition at line 337 of file ChiSquareDist.java.
| double umontreal.ssj.probdist.ChiSquareDist.inverseF | ( | double | u | ) |
Returns the inverse distribution function \(x = F^{-1}(u)\).
Restrictions: \(u \in[0,1]\).
| u | value at which the inverse distribution function is evaluated |
| IllegalArgumentException | if \(u\) is not in the interval \([0,1]\) |
Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.
Reimplemented in umontreal.ssj.probdist.ChiSquareDistQuick.
Definition at line 92 of file ChiSquareDist.java.
|
static |
Computes an approximation of \(F^{-1}(u)\), where \(F\) is the chi-square distribution with \(n\) degrees of freedom.
Uses the approximation given in [16] and in Figure L.23 of
[24] . It gives at least 6 decimal digits of precision, except far in the tails (that is, for \(u< 10^{-5}\) or \(u > 1 - 10^{-5}\)) where the function calls the method GammaDist.inverseF (n/2, 7, u) and multiplies the result by 2.0. To get better precision, one may call GammaDist.inverseF, but this method is slower than the current method, especially for large \(n\). For instance, for \(n = \) 16, 1024, and 65536, the GammaDist.inverseF method is 2, 5, and 8 times slower, respectively, than the current method.
Reimplemented in umontreal.ssj.probdist.ChiSquareDistQuick.
Definition at line 163 of file ChiSquareDist.java.
| void umontreal.ssj.probdist.ChiSquareDist.setN | ( | int | n | ) |
Sets the parameter \(n\) of this object.
Definition at line 367 of file ChiSquareDist.java.
| String umontreal.ssj.probdist.ChiSquareDist.toString | ( | ) |
Returns a String containing information about the current distribution.
Definition at line 387 of file ChiSquareDist.java.