|
| 1 | +--- |
| 2 | +layout: proof |
| 3 | +mathjax: true |
| 4 | + |
| 5 | +author: "Joram Soch" |
| 6 | +affiliation: "BCCN Berlin" |
| 7 | +e_mail: "joram.soch@bccn-berlin.de" |
| 8 | +date: 2022-10-07 13:20:00 |
| 9 | + |
| 10 | +title: "Relationship between chi-squared distribution and beta distribution" |
| 11 | +chapter: "Probability Distributions" |
| 12 | +section: "Univariate continuous distributions" |
| 13 | +topic: "Beta distribution" |
| 14 | +theorem: "Relationship with chi-squared distribution" |
| 15 | + |
| 16 | +sources: |
| 17 | + - authors: "Probability Fact" |
| 18 | + year: 2021 |
| 19 | + title: "If X ~ chisq(m) and Y ~ chisq(n) are independent" |
| 20 | + in: "Twitter" |
| 21 | + pages: "retrieved on 2022-10-17" |
| 22 | + url: "https://twitter.com/ProbFact/status/1450492787854647300" |
| 23 | + |
| 24 | +proof_id: "P356" |
| 25 | +shortcut: "beta-chi2" |
| 26 | +username: "JoramSoch" |
| 27 | +--- |
| 28 | + |
| 29 | + |
| 30 | +**Theorem:** Let $X$ and $Y$ be [independent](/D/ind) [random variables](/D/rvar) following [chi-squared distributions](/D/chi2): |
| 31 | + |
| 32 | +$$ \label{eq:chi2} |
| 33 | +X \sim \chi^2(m) \quad \text{and} \quad Y \sim \chi^2(n) \; . |
| 34 | +$$ |
| 35 | + |
| 36 | +Then, the quantity $X/(X+Y)$ follows a [beta distributiob](/D/beta): |
| 37 | + |
| 38 | +$$ \label{eq:beta-chi2} |
| 39 | +\frac{X}{X+Y} \sim \mathrm{Bet}\left( \frac{m}{2}, \frac{n}{2} \right) \; . |
| 40 | +$$ |
| 41 | + |
| 42 | + |
| 43 | +**Proof:** The [probability density function of the chi-squared distribution](/P/chi2-pdf) is |
| 44 | + |
| 45 | +$$ \label{eq:chi2-pdf} |
| 46 | +X \sim \chi^2(u) \quad \Rightarrow \quad f_X(x) = \frac{1}{\Gamma\left( \frac{u}{2} \right) \cdot 2^{u/2}} \cdot x^{\frac{u}{2}-1} \cdot e^{-\frac{x}{2}} \; . |
| 47 | +$$ |
| 48 | + |
| 49 | +Define the random variables $Z$ and $W$ as functions of $X$ and $Y$ |
| 50 | + |
| 51 | +$$ \label{eq:ZW-XY} |
| 52 | +\begin{split} |
| 53 | +Z &= \frac{X}{X+Y} \\ |
| 54 | +W &= Y \; , |
| 55 | +\end{split} |
| 56 | +$$ |
| 57 | + |
| 58 | +such that the inverse functions $X$ and $Y$ in terms of $Z$ and $W$ are |
| 59 | + |
| 60 | +$$ \label{eq:XY-ZW} |
| 61 | +\begin{split} |
| 62 | +X &= \frac{ZW}{1-Z} \\ |
| 63 | +Y &= W \; . |
| 64 | +\end{split} |
| 65 | +$$ |
| 66 | + |
| 67 | +This implies the following Jacobian matrix and determinant: |
| 68 | + |
| 69 | +$$ \label{eq:XY-ZW-jac} |
| 70 | +\begin{split} |
| 71 | +J &= \left[ \begin{matrix} |
| 72 | +\frac{\mathrm{d}X}{\mathrm{d}Z} & \frac{\mathrm{d}X}{\mathrm{d}W} \\ |
| 73 | +\frac{\mathrm{d}Y}{\mathrm{d}Z} & \frac{\mathrm{d}Y}{\mathrm{d}W} |
| 74 | +\end{matrix} \right] |
| 75 | += \left[ \begin{matrix} |
| 76 | +\frac{W}{(1-Z)^2} & \frac{Z}{1-Z} \\ |
| 77 | +0 & 1 |
| 78 | +\end{matrix} \right] \\ |
| 79 | +\lvert J \rvert &= \frac{W}{(1-Z)^2} \; . |
| 80 | +\end{split} |
| 81 | +$$ |
| 82 | + |
| 83 | +Because $X$ and $Y$ are [independent](/D/ind), the [joint density](/D/dist-joint) of $X$ and $Y$ is [equal to the product](/P/prob-ind) of the [marginal densities](/D/dist-marg): |
| 84 | + |
| 85 | +$$ \label{eq:f-XY} |
| 86 | +f_{X,Y}(x,y) = f_X(x) \cdot f_Y(y) \; . |
| 87 | +$$ |
| 88 | + |
| 89 | +With the [probability density function of an invertible function](/P/pdf-invfct), the [joint density](/D/dist-joint) of $Z$ and $W$ can be derived as: |
| 90 | + |
| 91 | +$$ \label{eq:f-ZW-s1} |
| 92 | +f_{Z,W}(z,w) = f_{X,Y}(x,y) \cdot \lvert J \rvert \; . |
| 93 | +$$ |
| 94 | + |
| 95 | +Substituting \eqref{eq:XY-ZW} into \eqref{eq:chi2-pdf}, and then with \eqref{eq:XY-ZW-jac} into \eqref{eq:f-ZW-s1}, we get: |
| 96 | + |
| 97 | +$$ \label{eq:f-ZW-s2} |
| 98 | +\begin{split} |
| 99 | +f_{Z,W}(z,w) &= f_X\left( \frac{zw}{1-z} \right) \cdot f_Y(w) \cdot \lvert J \rvert \\ |
| 100 | +&= \frac{1}{\Gamma\left( \frac{m}{2} \right) \cdot 2^{m/2}} \cdot \left( \frac{zw}{1-z} \right)^{\frac{m}{2}-1} \cdot e^{-\frac{1}{2} \left( \frac{zw}{1-z} \right)} \cdot \frac{1}{\Gamma\left( \frac{n}{2} \right) \cdot 2^{n/2}} \cdot w^{\frac{n}{2}-1} \cdot e^{-\frac{w}{2}} \cdot \frac{w}{(1-z)^2} \\ |
| 101 | +&= \frac{1}{\Gamma\left( \frac{m}{2} \right) \Gamma\left( \frac{n}{2} \right) \cdot 2^{m/2} 2^{n/2}} \cdot \left( \frac{z}{1-z} \right)^{\frac{m}{2}-1} \left( \frac{1}{(1-z)} \right)^2 \cdot w^{\frac{m}{2}+\frac{n}{2}-1} e^{-\frac{1}{2} \left( \frac{zw}{1-z} + \frac{w(1-z)}{1-z} \right)} \\ |
| 102 | +&= \frac{1}{\Gamma\left( \frac{m}{2} \right) \Gamma\left( \frac{n}{2} \right) \cdot 2^{(m+n)/2}} \cdot z^{\frac{m}{2}-1} \cdot (1-z)^{-\frac{m}{2}-1} \cdot w^{\frac{m+n}{2}-1} \cdot e^{-\frac{1}{2} \left( \frac{w}{1-z} \right)} \; . |
| 103 | +\end{split} |
| 104 | +$$ |
| 105 | + |
| 106 | +The [marginal density](/D/dist-marg) of $Z$ can now be [obtained by integrating out](/D/dist-marg) $W$: |
| 107 | + |
| 108 | +$$ \label{eq:f-Z-s1} |
| 109 | +\begin{split} |
| 110 | +f_Z(z) &= \int_{0}^{\infty} f_{Z,W}(z,w) \, \mathrm{d}w \\ |
| 111 | +&= \frac{1}{\Gamma\left( \frac{m}{2} \right) \Gamma\left( \frac{n}{2} \right) \cdot 2^{(m+n)/2}} \cdot z^{\frac{m}{2}-1} \cdot (1-z)^{-\frac{m}{2}-1} \cdot \int_{0}^{\infty} w^{\frac{m+n}{2}-1} \cdot e^{-\frac{1}{2} \left( \frac{w}{1-z} \right)} \, \mathrm{d}w \\ |
| 112 | +&= \frac{1}{\Gamma\left( \frac{m}{2} \right) \Gamma\left( \frac{n}{2} \right) \cdot 2^{(m+n)/2}} \cdot z^{\frac{m}{2}-1} \cdot (1-z)^{-\frac{m}{2}-1} \cdot \frac{\Gamma\left( \frac{m+n}{2} \right)}{\left( \frac{1}{2(1-z)} \right)^{\frac{m+n}{2}}} \cdot \\ |
| 113 | +&\hphantom{=} \int_{0}^{\infty} \frac{\left( \frac{1}{2(1-z)} \right)^{\frac{m+n}{2}}}{\Gamma\left( \frac{m+n}{2} \right)} \cdot w^{\frac{m+n}{2}-1} \cdot e^{-\frac{1}{2(1-z)} \, w} \, \mathrm{d}w \; . |
| 114 | +\end{split} |
| 115 | +$$ |
| 116 | + |
| 117 | +At this point, we can recognize that the integrand is equal to the [probability density function of a gamma distribution](/P/gam-pdf) with |
| 118 | + |
| 119 | +$$ \label{eq:f-W-gam-ab} |
| 120 | +a = \frac{m+n}{2} \quad \text{and} \quad b = \frac{1}{2(1-z)} \; , |
| 121 | +$$ |
| 122 | + |
| 123 | +and [because a probability density function integrates to one](/D/pdf), we have: |
| 124 | + |
| 125 | +$$ \label{eq:f-Z-s2} |
| 126 | +\begin{split} |
| 127 | +f_Z(z) &= \frac{1}{\Gamma\left( \frac{m}{2} \right) \Gamma\left( \frac{n}{2} \right) \cdot 2^{(m+n)/2}} \cdot z^{\frac{m}{2}-1} \cdot (1-z)^{-\frac{m}{2}-1} \cdot \frac{\Gamma\left( \frac{m+n}{2} \right)}{\left( \frac{1}{2(1-z)} \right)^{\frac{m+n}{2}}} \\ |
| 128 | +&= \frac{\Gamma\left( \frac{m+n}{2} \right) \cdot 2^{(m+n)/2}}{\Gamma\left( \frac{m}{2} \right) \Gamma\left( \frac{n}{2} \right) \cdot 2^{(m+n)/2}} \cdot z^{\frac{m}{2}-1} \cdot (1-z)^{-\frac{m}{2}+\frac{m+n}{2}-1} \\ |
| 129 | +&= \frac{\Gamma\left( \frac{m+n}{2} \right)}{\Gamma\left( \frac{m}{2} \right) \Gamma\left( \frac{n}{2} \right)} \cdot z^{\frac{m}{2}-1} \cdot (1-z)^{\frac{n}{2}-1} \; . |
| 130 | +\end{split} |
| 131 | +$$ |
| 132 | + |
| 133 | +With the [definition of the beta function](/P/beta-mean), this becomes |
| 134 | + |
| 135 | +$$ \label{eq:f-Z-s3} |
| 136 | +f_Z(z) = \frac{1}{\mathrm{B}\left( \frac{m}{2}, \frac{n}{2} \right)} \cdot z^{\frac{m}{2}-1} \cdot (1-z)^{\frac{n}{2}-1} |
| 137 | +$$ |
| 138 | + |
| 139 | +which is the [probability density function of the beta distribution](/P/beta-pdf), such that |
| 140 | + |
| 141 | +$$ \label{eq:beta-chi2-qed} |
| 142 | +Z \sim \mathrm{Bet}\left( \frac{m}{2}, \frac{n}{2} \right) \; . |
| 143 | +$$ |
0 commit comments