Statistics/Chi-squared distribution: Difference between revisions

From Rosetta Code
Content added Content deleted
No edit summary
No edit summary
Line 1: Line 1:
{{draft task}}


The probability density function (pdf) of the chi-squared distribution as used in statistics is
The probability density function (pdf) of the chi-squared distribution as used in statistics is
:<math>
:<math>
Line 5: Line 8:
\dfrac{x^{\frac k 2 -1} e^{-\frac x 2}}{2^{\frac k 2} \Gamma\left(\frac k 2 \right)} </math>, where <math display="inline">x > 0 </math>
\dfrac{x^{\frac k 2 -1} e^{-\frac x 2}}{2^{\frac k 2} \Gamma\left(\frac k 2 \right)} </math>, where <math display="inline">x > 0 </math>
Here, <math display="inline">\Gamma(k/2)</math> denotes the [[Gamma_function]].
Here, <math display="inline">\Gamma(k/2)</math> denotes the [[Gamma_function]].

The use of the gamma function in the equation below reflects the chi-squared distribution's origin as a special case of the gamma
distribution.

In probability theory and statistics, the gamma distribution is a two-parameter family of continuous probability distributions.
The exponential distribution, Erlang distribution, and chi-square distribution are special cases of the gamma distribution.

The probability density function (pdf) of the gamma distribution is given by the formula

:<math>f(x;k,\theta) = \frac{x^{k-1}e^{-x/\theta}}{\theta^k\Gamma(k)} \quad \text{ for } x > 0 \text{ and } k, \theta > 0.</math>

where Γ(''k'') is the [[Gamma_function]], with shape parameter k and a scale parameter θ.

The cumulative probability distribution of the gamma distribution is the area under the curve of the ditribution, which indicates
the increasing probability of the x value of a single random point within the gamma distribution being less than or equal to the x value
of the cumulative probability distribution. The gamma cumulative probability distribution function can be calculated as

:<math> F(x;k,\theta) = \int_0^x f(u;k,\theta)\,du = \frac{\gamma\left(k, \frac{x}{\theta}\right)}{\Gamma(k)},</math>

where <math>\gamma\left(k, \frac{x}{\theta}\right)</math> is the lower incomplete gamma function.

The lower incomplete gamma function can be calculated as

<math display="block"> x^s \, \Gamma(s) \, e^{-x} \sum_{m=0}^\infty\frac{x^m}{\Gamma(s+m+1)} </math>

and so, for the chi-squared cumulative probability distribution with chi-squared k, we have, substituting chi-square k into s as k/2,

: <math display="block"> F(x;\,k) = x^{(k/2)} \, \Gamma(k/2) \, e^{-x} \sum_{m=0}^\infty\frac{x^m}{\Gamma(\frac{k}{2}+m+1)}. </math>

Revision as of 21:30, 1 October 2022

Statistics/Chi-squared distribution is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.


The probability density function (pdf) of the chi-squared distribution as used in statistics is

, where

Here, denotes the Gamma_function.

The use of the gamma function in the equation below reflects the chi-squared distribution's origin as a special case of the gamma distribution.

In probability theory and statistics, the gamma distribution is a two-parameter family of continuous probability distributions. The exponential distribution, Erlang distribution, and chi-square distribution are special cases of the gamma distribution.

The probability density function (pdf) of the gamma distribution is given by the formula

where Γ(k) is the Gamma_function, with shape parameter k and a scale parameter θ.

The cumulative probability distribution of the gamma distribution is the area under the curve of the ditribution, which indicates the increasing probability of the x value of a single random point within the gamma distribution being less than or equal to the x value of the cumulative probability distribution. The gamma cumulative probability distribution function can be calculated as

where is the lower incomplete gamma function.

The lower incomplete gamma function can be calculated as

and so, for the chi-squared cumulative probability distribution with chi-squared k, we have, substituting chi-square k into s as k/2,