# Chi-squared distribution

Release: |
---|

The * $ \Chi^2 $-squared distribution* is a continuous, positive only, unimodal probability distribution that describes the sum of independent normally-distributed random variables.

The **Chi-squared distribution** with «dof» degrees of freedom describes the distribution of a Chi-Squared metric defined as

- $ \Chi^2 \sum_{i=1}^n {y_i}^2 $

where each *y _{i}* is independently sampled from a standard normal distribution and

*«dof» = n - 1*. The distribution is defined over nonnegative values.

The Chi-squared distribution is commonly used for analyses of second moments, such as analyses of variance and contingency table analyses. The ratio of two chi-squared-distributed variables follows an F-distribution.

## Contents

## Functions

### ChiSquared(dof)

The distribution function. Use this to define a chance variable or other uncertain quantity with an F-distribution with «dof» degrees of freedom.

### DensChiSquared(x, dof)

The analytic probability density at «x». Equal to

- $ p(x) = {1\over{2^{d/2} \Gamma(d/2)}} x^{d/2-1} e^{-x/2} $

where $ d $ is «dof» and $ \Gamma(x) $ is the `GammaFn(x)`

.

### CumChiSquared(x, dof)

The analytic cumulative density up to «x». This is the probability that a random sample will be less than or equal to «x».

### CumChiSquaredInv(p, dof)

The inverse cumulative density (quantile function), which computes the p^{th} fractile/quantile/percentile value x, which has a «p» probability of being greater than or equal to a random variate draw from a chi-squared distribution with «dof» degrees of freedom.

## Statistics

Theoretical statistics (i.e., in the absence of sampling error) are:

- Mean = dof
- Mode = k-2 when k>2, 0 otherwise
- Median = ...
- Variance = 2 * dof
- Skewness = $ \sqrt{ 8 / dof} $
- Kurtosis = 12 / dof

## Examples

Suppose

`Variable V := ChiSquared(k)`

`Variable W := ChiSquared(m)`

`Variable S := (V/k)*(W/m)`

`S`

is distributed as an F-distribution with `k`

and `m`

degrees of freedom.

The F distribution is useful for the analysis of ratios of variance, such as a one-factor between-subjects analysis of variance.

## See Also

- Dens_ChiSquared
- CumChiSquared
- Normal
- Gamma -- very closely related distribution.
- Rayleigh
- F-distribution
- Parametric continuous distributions
- Distribution Densities Library

Enable comment auto-refresher