5 min read

From the Cumulative distribution of standard normal distribution can get the chi square distribution

The Cumulative distribution function of standard Normal distribution in the region \((-x,x),x>0\) is: \[\begin{align} \Phi(x)&=\frac{1}{\sqrt{2\pi}}\int_{-x}^{x} e^{-\frac{1}{2}z^2}dz\\ &=\frac{2}{\sqrt{2\pi}}\int_{0}^{x} e^{-\frac{1}{2}z^2}dz\\ &=\frac{2}{\sqrt{2\pi}}\int_{0}^{\sqrt{x}} \frac{1}{2\sqrt{u}}e^{-\frac{1}{2}u}du \quad (u=z^2)\\ &=\frac{1}{\sqrt{2\pi}}\int_{0}^{\sqrt{x}} \frac{1}{\sqrt{u}}e^{-\frac{1}{2}u}du\\ &=\int_{0}^{\sqrt{x}}\frac{(\frac{1}{2})^{\frac{1}{2}}}{\Gamma(\frac{1}{2})}u^{(\frac{1}{2})-1}e^{-\frac{1}{2}u}du \end{align}\]

Here, the integrand \(f_U(u)=\frac{(\frac{1}{2})^{\frac{1}{2}}}{\Gamma(\frac{1}{2})}u^{(\frac{1}{2})-1}e^{-\frac{1}{2}u}\) is a special Gamma distribution with \(r=\frac{1}{2}, \lambda=\frac{1}{2}\). Here, the \(u=z^2\), where the \(z\) is independent standard normal random variable.

And the sum of several \(U=Z^2\) variables \[Y=\sum_{j=1}^{m} U_j=\sum_{j=1}^{m} Z_{j}^{2}\] is still a Gamma distribution:\[f_Y(y)=\frac{(\frac{1}{2})^{\frac{m}{2}}}{\Gamma(\frac{m}{2})}y^{(\frac{m}{2})-1}e^{-\frac{1}{2}y}\], and we give the special Gamma distribution with \(r=\frac{m}{2}, \lambda=\frac{1}{2}\) a new name: \(\chi^2\) distribution with \(m\) degrees of freedom. Chi-squared distribution.

And the average of several \(U=Z^2\) variables \[\overline Y=\frac{1}{m}\sum_{j=1}^{m} U_j=\frac{1}{m}\sum_{j=1}^{m} Z_{j}^{2}\] is still a Gamma distribution with \(m\) degrees of freedom:
\[\begin{align} f_{\overline Y}(\omega)=f_{\frac{1}{m}Y}(\omega)&=\frac{1}{m}f_{Y}(\frac{1}{m}\omega)\\ &=\frac{1}{m}\frac{(\frac{1}{2})^{\frac{m}{2}}}{\Gamma(\frac{m}{2})}(\frac{1}{m}\omega)^{(\frac{m}{2})-1}e^{-\frac{1}{2}(\frac{1}{m}\omega)}\\ &=(\frac{1}{m})^{(\frac{m}{2})}\frac{(\frac{1}{2})^{\frac{m}{2}}}{\Gamma(\frac{m}{2})}(\omega)^{(\frac{m}{2})-1}e^{-\frac{1}{2}(\frac{1}{m}\omega)} \end{align}\]

Let \(Y\) be a chi-square random variable with \(n\) degrees of freedom. Then the square-root of \(Y\), \(\sqrt Y\equiv \hat Y\) is distributed as a chi-distribution with \(n\) degrees of freedom, which has density \[\begin{align} f_{\hat Y}(\hat y) &=2\hat y f_{\hat y^2}(\hat y^2) \\ &=2\hat y \frac{(\frac{1}{2})^{\frac{n}{2}}}{\Gamma(\frac{n}{2})}{\hat y}^{2(\frac{n}{2})-2}e^{-\frac{1}{2}\hat y^2} \\ &= \frac {2^{1-\frac n2}}{\Gamma\left(\frac {n}{2}\right)} \hat y^{n-1} \exp\Big \{{-\frac {\hat y^2}{2}} \Big\} \tag 1 \end{align}\]

Define \(X \equiv \frac {1}{\sqrt n}\hat Y\). Then \[ \frac {\partial \hat Y}{\partial X} = \sqrt n\] and by the change-of-variable formula we have that

\[ f_{X}(x) = f_{\hat Y}(\sqrt nx)\Big |\frac {\partial \hat Y}{\partial X} \Big| = \frac {2^{1-\frac n2}}{\Gamma\left(\frac {n}{2}\right)} (\sqrt nx)^{n-1} \exp\Big \{{-\frac {(\sqrt nx)^2}{2}} \Big\}\sqrt n\]

\[=\frac {2^{1-\frac n2}}{\Gamma\left(\frac {n}{2}\right)} n^{\frac n2}x^{n-1} \exp\Big \{{-\frac {n}{2}x^2} \Big\} \tag 2\]

Let \(Z\) be a standard normal random variable, independent from the previous ones, and define the random variable

\[T = \frac{Z}{\sqrt \frac Yn}= \frac ZX \].

By the standard formula for the density function of the ratio of two independent random variables, \[\begin{aligned} \mathsf P(T\leq t) &=\mathsf P(Z/X\leq t)\\ &=\mathsf P(Z/X\leq t,X>0)+\mathsf P(Z/X\leq t,X<0)\\ &=\mathsf P(Z\leq tX,X>0)+\mathsf P(Z\geq tX,X<0). \end{aligned} \] Assuming \(Z\) is independent of \(X\) we then have \[ \begin{aligned} \mathsf P(T\leq t) &=\int_0^\infty\int_{-\infty}^{tx}f_Z(z)f_X(x)\,\mathrm dz\mathrm dx+\int_{-\infty}^0\int_{tx}^\infty f_Z(z)f_X(x)\,\mathrm dz\mathrm dx \end{aligned} \] Differentiating we have by the Leibniz integral rule: \[ \begin{aligned} f_T(t)=\partial_t\mathsf P(T\leq t) &=\int_0^\infty xf_Z(xt)f_X(x)\,\mathrm dx-\int_{-\infty}^0 x f_Z(xt)f_X(x)\,\mathrm dx\\ &=\int_{-\infty}^\infty |x|f_Z(xt)f_X(x)\,\mathrm dx. \end{aligned}\]

\[f_T(t) = \int_{-\infty}^{\infty} |x|f_Z(xt)f_X(x)dx \]

But \(f_X(x) = 0\) for the interval \([-\infty, 0]\) because \(X\) is a non-negative r.v. So we can eliminate the absolute value, and reduce the integral to

\[f_T(t) = \int_{0}^{\infty} xf_Z(xt)f_X(x)dx \]

\[ = \int_{0}^{\infty} x \frac{1}{\sqrt{2\pi}}\exp \Big \{{-\frac{(xt)^2}{2}}\Big\}\frac {2^{1-\frac n2}}{\Gamma\left(\frac {n}{2}\right)} n^{\frac n2}x^{n-1} \exp\Big \{{-\frac {n}{2}x^2} \Big\}dx \]

\[ = \frac{1}{\sqrt{2\pi}}\frac {2^{1-\frac n2}}{\Gamma\left(\frac {n}{2}\right)} n^{\frac n2}\int_{0}^{\infty} x^n \exp \Big \{-\frac 12 (n+t^2) x^2\Big\} dx \tag{3}\]

The integrand in \((3)\) looks promising to eventually be transformed into a Gamma density function. The limits of integration are correct, so we need to manipulate the integrand into becoming a Gamma density function without changing the limits. Define the variable

\[m \equiv x^2 \Rightarrow dm = 2xdx \Rightarrow dx = \frac {dm}{2x}, \; x = m^{\frac 12}\] Making the substitution in the integrand we have

\[I_3=\int_{0}^{\infty} x^n \exp \Big \{-\frac 12 (n+t^2) m\Big\} \frac {dm}{2x} \\ = \frac 12\int_{0}^{\infty} m^{\frac {n-1}{2}} \exp \Big \{-\frac 12 (n+t^2) m\Big \} dm \tag{4}\]

The Gamma density can be written

\[ Gamma(m;k,\theta) = \frac {m^{k-1} \exp\Big\{-\frac{m}{\theta}\Big \}}{\theta^k\Gamma(k)}\]

Matching coefficients, we must have

\[k-1 = \frac {n-1}{2} \Rightarrow k^* = \frac {n+1}{2}, \qquad \frac 1\theta =\frac 12 (n+t^2) \Rightarrow \theta^* = \frac 2 {(n+t^2)} \]

For these values of \(k^*\) and \(\theta^*\) the terms in the integrand involving the variable are the kernel of a gamma density. So if we divide the integrand by \((\theta^*)^{k^*}\Gamma(k^*)\) and multiply outside the integral by the same magnitude, the integral will be the gamma distr. function and will equal unity. Therefore we have arrived at

\[I_3 = \frac12(\theta^*)^{k^*}\Gamma(k^*) = \frac12 \Big (\frac 2 {n+t^2}\Big ) ^{\frac {n+1}{2}}\Gamma\left(\frac {n+1}{2}\right) = 2^ {\frac {n-1}{2}}n^{-\frac {n+1}{2}}\Gamma\left(\frac {n+1}{2}\right)\left(1+\frac {t^2}{n}\right)^{-\frac 12 (n+1)} \]

Inserting the above into eq. \((3)\) we get

\[f_T(t) = \frac{1}{\sqrt{2\pi}}\frac {2^{1-\frac n2}}{\Gamma\left(\frac {n}{2}\right)} n^{\frac n2}2^ {\frac {n-1}{2}}n^{-\frac {n+1}{2}}\Gamma\left(\frac {n+1}{2}\right)\left(1+\frac {t^2}{n}\right)^{-\frac 12 (n+1)}\]

\[=\frac{\Gamma[(n+1)/2]}{\sqrt{n\pi}\,\Gamma(n/2)}\left(1+\frac {t^2}{n}\right)^{-\frac 12 (n+1)}\]

\[=\frac{n^{-1/2}}{B(1/2,n/2)}\left(1+\frac {1}{n}t^2\right)^{-\frac 12 (n+1)}\] \[=\frac{(1)^{n/2}(1/n)^{1/2}}{B(1/2,n/2)}\left(1+(1/n)t^2\right)^{-\frac 12 (n+1)}\]where \(B(\cdot,\cdot)\) is the Beta function.

…which is what is called the (density function of) the Student’s t-distribution, with \(n\) degrees of freedom.

When V and U are two \(\chi^2\) independent random variables: \(f_V(v)=\frac{(\frac{1}{2})^{\frac{m}{2}}}{\Gamma(\frac{m}{2})}v^{(\frac{m}{2})-1}e^{-\frac{1}{2}v}\)
\(f_U(u)=\frac{(\frac{1}{2})^{\frac{n}{2}}}{\Gamma(\frac{n}{2})}u^{(\frac{n}{2})-1}e^{-\frac{1}{2}u}\)
with \(m\) and \(n\) degrees of freedom, then, the pdf for \(W=V/U\) is:
\[\begin{align} f_{V/U}(\omega)&=\int_{0}^{+\infty}|u|f_U(u)f_V(u\omega)du\\ &=\int_{0}^{+\infty}u\frac{(\frac{1}{2})^{\frac{n}{2}}}{\Gamma(\frac{n}{2})}u^{\frac{n}{2}-1}e^{-\frac{1}{2}u} \frac{(\frac{1}{2})^{\frac{m}{2}}}{\Gamma(\frac{m}{2})}(u\omega)^{\frac{m}{2}-1}e^{-\frac{1}{2}u\omega}du\\ &=\frac{(\frac{1}{2})^{\frac{n}{2}}}{\Gamma(\frac{n}{2})}\frac{(\frac{1}{2})^{\frac{m}{2}}}{\Gamma(\frac{m}{2})} \omega^{\frac{m}{2}-1} \int_{0}^{+\infty}u^{\frac{n}{2}}u^{\frac{m}{2}-1} e^{-\frac{1}{2}u(1+\omega)}du\\ &=\frac{(\frac{1}{2})^{\frac{n}{2}}}{\Gamma(\frac{n}{2})}\frac{(\frac{1}{2})^{\frac{m}{2}}}{\Gamma(\frac{m}{2})} \omega^{\frac{m}{2}-1} \int_{0}^{+\infty}u^{\frac{n+m}{2}-1} e^{-\frac{1}{2}u(1+\omega)}du\\ &=\frac{(\frac{1}{2})^{\frac{n}{2}}}{\Gamma(\frac{n}{2})}\frac{(\frac{1}{2})^{\frac{m}{2}}}{\Gamma(\frac{m}{2})} \omega^{\frac{m}{2}-1} (\frac{\Gamma(\frac{n+m}{2})}{(\frac{1}{2}(1+\omega))^{\frac{n+m}{2}}})\\ &=\frac{\Gamma(\frac{n+m}{2})}{\Gamma(\frac{n}{2})\Gamma(\frac{m}{2})}\frac{\omega^{\frac{m}{2}-1}}{(1+\omega)^{\frac{n+m}{2}}} \end{align}\]

Then, the pdf for \(W=\frac{V/m}{U/n}\) is: \[\begin{align} f_{\frac{V/m}{U/n}}&=f_{\frac{n}{m}V/U}\\ &=\frac{m}{n}f_{V/U}(\frac{m}{n}\omega)\\ &=\frac{m}{n}\frac{\Gamma(\frac{n+m}{2})}{\Gamma(\frac{n}{2})\Gamma(\frac{m}{2})}\frac{(\frac{m}{n}\omega)^{\frac{m}{2}-1}}{(1+\frac{m}{n}\omega)^{\frac{n+m}{2}}}\\ &=\frac{\Gamma(\frac{n+m}{2})}{\Gamma(\frac{n}{2})\Gamma(\frac{m}{2})}\frac{m}{n}\frac{(\frac{m}{n}\omega)^{\frac{m}{2}-1}}{(n+m\omega)^{\frac{n+m}{2}}}n^{\frac{n+m}{2}}\\ &=\frac{\Gamma(\frac{n+m}{2})}{\Gamma(\frac{n}{2})\Gamma(\frac{m}{2})}\frac{m^{\frac{m}{2}}n^{\frac{n}{2}}\omega^{\frac{m}{2}-1}}{(n+m\omega)^{\frac{n+m}{2}}} \\ &=\frac{1}{B(\frac{n}{2},\frac{m}{2})}\frac{m^{\frac{m}{2}}n^{\frac{n}{2}}\omega^{\frac{m}{2}-1}}{(n+m\omega)^{\frac{n+m}{2}}} \end{align}\], which is a \(F\) distribution with \(m\) and \(n\) degrees of freedom.

If \(T\) is distributed as \((a/b)^{1/2}Z/U\) where \(Z\sim N(0,1)\) and \(U\sim \chi_\nu\),

\[f_T(t) = \int_{0}^{\infty} xf_Z(xt)f_U(x)dx \]

Because \[\chi_{\nu}=\frac{1}{2^{\nu/2-1}\Gamma(\frac{\nu}{2})}x^{\nu-1}e^{-x^2/2}\]

\[ \begin{align} f_T(t) &= \int_{0}^{\infty} xf_Z(xt)f_{U/\sqrt{\frac{a}{b}}}(x)dx \\ &=\int_{0}^{\infty} x \frac{1}{\sqrt{2\pi}}\exp \Big \{{-\frac{( xt)^2}{2}}\Big\}\frac {2^{1-\frac \nu2}}{\Gamma\left(\frac {\nu}{2}\right)} (\sqrt{\frac{a}{b}}x)^{\nu-1} \exp\Big \{{-\frac {(\sqrt{\frac{a}{b}}x)^2}{2}} \Big\}\sqrt{\frac{a}{b}} \\ &= \int_{0}^{\infty} x \frac{1}{\sqrt{2\pi}}\exp \Big \{{-\frac{( xt)^2}{2}}\Big\}\frac {2^{1-\frac \nu2}}{\Gamma\left(\frac {\nu}{2}\right)} (\frac{a}{b})^{\frac \nu2}x^{\nu-1} \exp\Big \{{-\frac {a}{2b}x^2} \Big\}dx \\ &= \frac{1}{\sqrt{2\pi}}\frac {2^{1-\frac \nu2}}{\Gamma\left(\frac {\nu}{2}\right)} (\frac{a}{b})^{\frac \nu2}\int_{0}^{\infty} x^\nu \exp \Big \{-\frac 12 \left(\frac ab+ t^2\right) x^2\Big\} dx \end{align}\]

\[\begin{align} &=\frac{1}{\sqrt{2\pi}}\frac {2^{1-\frac \nu2}}{\Gamma\left(\frac {\nu}{2}\right)} (\frac ab)^{\frac \nu2}\int_{0}^{\infty} x^\nu \exp \Big \{-\frac 12 \left(\frac ab+ t^2\right) m\Big\} \frac {dm}{2x} \\ &= \frac{1}{\sqrt{2\pi}}\frac {2^{1-\frac \nu2}}{\Gamma\left(\frac {\nu}{2}\right)} (\frac ab)^{\frac \nu2}\frac 12\int_{0}^{\infty} m^{\frac {\nu-1}{2}} \exp \Big \{-\frac 12 \left(\frac ab+ t^2\right) m\Big \} dm \\ &= \frac{1}{\sqrt{2\pi}}\frac {2^{1-\frac \nu2}}{\Gamma\left(\frac {\nu}{2}\right)} (\frac ab)^{\frac \nu2} 2^ {\frac {\nu-1}{2}}\Gamma\left(\frac {\nu+1}{2}\right)\left(\frac ab+ t^2\right)^{-\frac 12 (\nu+1)} \\ &=\frac{\Gamma[(\nu+1)/2]}{\sqrt{\pi}\,\Gamma(\nu/2)}(\frac ab)^{\frac \nu2}\left(\frac ab+ t^2\right)^{-\frac 12 (\nu+1)}\\ &=\frac{a^{\nu/2}b^{1/2}}{B(1/2,\nu/2)}\left(a+bt^2\right)^{-\frac 12 (\nu+1)} \end{align}\]

then \(T\) has \(t\) density function

\[p(t)=\frac{a^{\nu/2}b^{1/2}}{B(1/2,\nu/2)}\left(a+b t^2\right)^{-\frac 12 (\nu+1)}\]

When V and U are two \(\chi^2\) independent random variables: \[f_V(v)=\frac{(\frac{1}{2})^{\frac{m}{2}}}{\Gamma(\frac{m}{2})}v^{(\frac{m}{2})-1}e^{-\frac{1}{2}v}\]

\[f_U(u)=\frac{(\frac{1}{2})^{\frac{n}{2}}}{\Gamma(\frac{n}{2})}u^{(\frac{n}{2})-1}e^{-\frac{1}{2}u}\] with \(m\) and \(n\) degrees of freedom, then, the pdf for \(W=\frac ab V/U\) is:
\[\begin{align} f_{V/U}(\omega)&=\frac ab\int_{0}^{+\infty}|u|f_{U/\frac ab}(u)f_V(u\omega)du\\ &=\frac ab\int_{0}^{+\infty}u\frac{(\frac{1}{2})^{\frac{n}{2}}}{\Gamma(\frac{n}{2})}(\frac ab u)^{\frac{n}{2}-1}e^{-\frac{1}{2}( \frac ab u)} \frac{(\frac{1}{2})^{\frac{m}{2}}}{\Gamma(\frac{m}{2})}(u\omega)^{\frac{m}{2}-1}e^{-\frac{1}{2}u\omega}du\\ &=(\frac ab)^{\frac{n}{2}}\frac{(\frac{1}{2})^{\frac{n}{2}}}{\Gamma(\frac{n}{2})}\frac{(\frac{1}{2})^{\frac{m}{2}}}{\Gamma(\frac{m}{2})} \omega^{\frac{m}{2}-1} \int_{0}^{+\infty}u^{\frac{n}{2}}u^{\frac{m}{2}-1} e^{-\frac{1}{2}u(\frac ab+\omega)}du\\ &=(\frac ab)^{\frac{n}{2}}\frac{(\frac{1}{2})^{\frac{n}{2}}}{\Gamma(\frac{n}{2})}\frac{(\frac{1}{2})^{\frac{m}{2}}}{\Gamma(\frac{m}{2})} \omega^{\frac{m}{2}-1} \int_{0}^{+\infty}u^{\frac{n+m}{2}-1} e^{-\frac{1}{2}u(\frac ab+\omega)}du\\ &=(\frac ab)^{\frac{n}{2}}\frac{(\frac{1}{2})^{\frac{n}{2}}}{\Gamma(\frac{n}{2})}\frac{(\frac{1}{2})^{\frac{m}{2}}}{\Gamma(\frac{m}{2})} \omega^{\frac{m}{2}-1} (\frac{\Gamma(\frac{n+m}{2})}{(\frac{1}{2}(\frac ab+\omega))^{\frac{n+m}{2}}})\\ &=(\frac ab)^{\frac{n}{2}}b^{\frac{n+m}{2}}\frac{\Gamma(\frac{n+m}{2})}{\Gamma(\frac{n}{2})\Gamma(\frac{m}{2})}\frac{\omega^{\frac{m}{2}-1}}{(a+b\omega)^{\frac{n+m}{2}}} \\ &=a^{\frac{n}{2}}b^{\frac{m}{2}}\frac{\Gamma(\frac{n+m}{2})}{\Gamma(\frac{n}{2})\Gamma(\frac{m}{2})}\frac{\omega^{\frac{m}{2}-1}}{(a+b\omega)^{\frac{n+m}{2}}} \\ &=\frac{a^{\frac{n}{2}}b^{\frac{m}{2}}}{B(\frac{m}{2},\frac{n}{2})}\frac{\omega^{\frac{m}{2}-1}}{(a+b\omega)^{\frac{n+m}{2}}} \\ \end{align}\]