# Chi-Square Distribution ($\chi^2$) Made Easy

The Chi-square distribution is a continuous probability distribution that is used in many hypothesis tests. The Chi-Square statistic always results in a positive value.

A Chi-Square variate (with $v$ degrees of freedom (df)) is the sum of $v$ independent, squared standard normal variates ($\sum\limits_{i=1}^v z_i^2$). It is denoted by $\chi^2_v$. The variance $s^2$ from a sample of normally distributed observations is distributed as $\chi^2$ with $v$ (the df) as a parameter referred to as df of the calculated variance. Symbolically,

$$\frac{v\cdot s^2}{\sigma^2} \sim \chi^2_v$$

The variance $s^2$ for $n$ observations from a $N(\mu, \sigma^2)$, the df is equal to $v=n-1$. The Chi-Square distribution is also used for the contingency (analysis of frequency) tables as an approximation to the distribution of complex statistics. All the families of Chi-Square distribution are specified by their degrees of freedom.

### Chi-Square Distribution Case of the Gamma Distribution

The Chi-Square distribution is a particular case of the Gamma Distribution, the pdf is

$$P_{\chi^2}(x) = [2^{v/2}\Gamma(v/2)]^{-1} \chi^{(v-2)/2}e^{-x/2}, \quad x\ge 0$$

where $\Gamma(x)$ is the Gamma Distribution.

### Normal Approximation to $\chi^2$

Method 1: The PDF and df of Chi-Square can be approximated by the normal distribution. For large $v$ df, the first two moments $z=\frac{(X-v)}{\sqrt{2v}}$, $X\sim \chi^2$.

Method 2: Fisher approximation (compensates the skewness of $X$)

$$\sqrt{2X} – \sqrt{2v-1} \sim N(0, 1)$$

Method 3: Approximation by Wilson and Hilferty is quite accurate. Defining $A=\frac{2}{9v}$, we have

$$\frac{\sqrt[3]{(X/v)}-1+A}{\sqrt{A}}\sim N(0, 1)$$

For the determination of percentage points

$$\chi^2_{v[P]}=v[z_P\sqrt{A}+1-A]^3$$

### Generating Pseudo Random Variates

Following the schema allows the generation of random variates from $\chi^2_v$ distribution with $v>2$ df. It requires to generate serially random variates from the standard uniform $U(0,1)$ distribution.

Let $n=v$ degrees of freedom

\begin{align*}
C1 &= 1 + \sqrt{2/e} \approx 1.8577638850\\
C2 &= \sqrt{n/2}\\
C3 &= \frac{3n^2-2}{3n(n-2)}\\
C4 &= \frac{4}{n-2}\\
C5 &= n-2\\
\end{align*}

visit: https://gmstat.com for MCQ tests from various subjects