The chi-square distribution or distribution is a real, continuous Probability distribution over . For a Random variable , the Probability density function is
where is an integer parameter called the degrees of freedom of the distribution and is the Gamma function.
Its most common application is for hypothesis testing, specifically chi-square tests. Moreover, since distributions arise from the sum of squares of Gaussian distributions, the square norm of any vector whose components follow a Gaussian is .
Moments#
The raw moment-generating function is
which is similar to the Exponential distribution MGF. The central MGF is
We can substitute . With this, the raw MGF becomes
which is the standard normal distribution's MGF.
Some moments are:
- Raw 0.
- Central
0.
- (Variance)
- Coefficients
Relation to other distributions#
- It is a special case of the Gamma distribution with and .
- It follows the central limit theorem: if , the approximately becomes a Gaussian distribution .
- It is related to the Maxwell-Boltzmann distribution (see > In molecular velocity analysis).
As sum of distributions#
The sum of independent variables is itself a distribution with degrees of freedom equal to the sum of all individual degrees:
> where $k=\sum_{i=1}^{N}k_{i}$. This is the MGF of a $\chi ^{2}_{k}$ distribution. #### As sum of square Gaussian distributions As a particularly interesting case, a $\chi ^{2}$ distribution is the result of the sum of squares of Gaussian distributions. Given a set of $N$ [[iid]] normally-distributed variables $\{ X_{1},\ldots,X_{N} \}$, the sum of their squares $Y=\sum_{i=1}^{N}X_{i}^{2}$ is chi-square-distributed with $N$ degrees of freedom, $Y\sim \chi ^{2}_{N}$. As Gaussian RVs are quite common, the $\chi ^{2}$ distribution tends to appear frequently even if there is no individual phenomenon that follows it. > [!quote]- Proof for standard normals > Say $X_{1},\ldots,X_{N}$ all independently follow $\mathcal{N}(0,1)$. Then $X_{1}^{2},\ldots,X_{N}^{2}$ all follow $\chi ^{2}_{1}$; for proof see [[Functions of random variables#Distribution, expectation, variance|here]]. But then $Y$ is a sum of $\chi ^{2}_{1}$ distributions. Using the proof above, we can state that $Y\sim \chi ^{2}_{N}$. > [!quote]- Extension to any normal > Say $X_{1},\ldots,X_{N}$ independently follow $\mathcal{N}(\mu_{i},\sigma ^{2}_{i})$. Then $(X_{i}-\mu_{i})/\sigma_{i}$ follow $\mathcal{N}(0,1)$. Then, the sum of these squares is $\chi_{N}^{2}$ as per the previous point. Therefore in general > $$Y=\sum_{i=1}^{N} \frac{(X_{i}-\mu_{i})^{2}}{\sigma ^{2}_{i}}\sim \chi_{N}^{2}> where $\Sigma$ is the [[Covariance|covariance matrix]] of $X_{1},\ldots,X_{N}$. The proof involves finding that, as long as $\Sigma$ is not singular, there always exists an orthogonal [[transformation]] that allows changing from $X_{1},\ldots,X_{N}$ correlated variables to $\tilde{X}_{1},\ldots,\tilde{X}_{N}$ independent variables, then reusing the above proof. ### In molecular velocity analysis The chi-square distribution can be used to derive a statistical description of the motion of molecules in a gas. Consider a gas of identical molecules each with velocity $\mathbf{v}=(v_{1},v_{2},v_{3})\in \mathbb{R}^{3}$. Each component of each $\mathbf{v}$ is considered a normally-distributed random variable with parameters $N(0,\sigma ^{2})$. We can define the scale-independent variable $\mathbf{q}$ as $\mathbf{q}=\mathbf{v}/\sigma=(q_{1},q_{2},q_{3})$, the components of which are also normally distributed but following the standard normal $N(0,1)$ instead. The square [[Norma|norm]] of $\mathbf{q}$, $\lvert \mathbf{q} \rvert^{2}\equiv q^{2}=q_{1}^{2}+q_{2}^{2}+q_{3}^{2}$ is therefore chi-squared-distributed with 3 degrees of freedom: $\chi ^{2}_{3}$. The probability density function for $q^{2}$ thus isThis is the basis behind the hypothesis tests.
If are dependent, then it can be proven (in a much more involved manner) that the quantity that follows a distribution is
f(q^{2})=\frac{1}{\sqrt{ 2\pi }}(q^{2})^{1/2}e^{-q^{2}/2}
and therefore the one for $v^{2}$ is, by substitution,g(v^{2})=\frac{1}{\sqrt{ 2\pi }}\left( \frac{v^{2}}{\sigma ^{2}} \right)^{1/2}e^{-v^{2}/2\sigma ^{2}} \frac{1}{\sigma ^{2}}=\frac{1}{\sqrt{ 2\pi }} \frac{v}{\sigma ^{3}}e^{-v^{2}/2\sigma ^{2}}
and for $v$ we geth(v)=g(v^{2})2v=\frac{2}{\sqrt{ 2\pi }}\frac{v^{2}}{\sigma ^{3}}e^{-v^{2}/2\sigma ^{2}}
This is called the [[Maxwell-Boltzmann distribution]] and is used for modeling stochastic motion at molecular or atomic scale. It can be found that $\sigma=k_{B}T/m$ where $k_{B}$ is the [[Boltzmann constant|Boltzmann constant]], $T$ is the gas temperature and $m$ is the mass of the molecules.