|
| 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-09-22 11:10:00 |
| 9 | + |
| 10 | +title: "Sampling from the normal-gamma distribution" |
| 11 | +chapter: "Probability Distributions" |
| 12 | +section: "Multivariate continuous distributions" |
| 13 | +topic: "Normal-gamma distribution" |
| 14 | +theorem: "Drawing samples" |
| 15 | + |
| 16 | +sources: |
| 17 | + - authors: "Wikipedia" |
| 18 | + year: 2022 |
| 19 | + title: "Normal-gamma distribution" |
| 20 | + in: "Wikipedia, the free encyclopedia" |
| 21 | + pages: "retrieved on 2022-09-22" |
| 22 | + url: "https://en.wikipedia.org/wiki/Normal-gamma_distribution#Generating_normal-gamma_random_variates" |
| 23 | + |
| 24 | +proof_id: "P346" |
| 25 | +shortcut: "ng-samp" |
| 26 | +username: "JoramSoch" |
| 27 | +--- |
| 28 | + |
| 29 | + |
| 30 | +**Theorem:** Let $Z_1 \in \mathbb{R}^{n \times 1}$ be a [random vector](/D/rvec) with all entries independently following a [standard normal distribution](/D/snorm) and let $Z_2 \in \mathbb{R}$ be a [random variable](/D/rvar) following a [standard gamma distribution](/D/sgam) with shape $a$. Moreover, let $A \in \mathbb{R}^{n \times n}$ be a matrix such that, such that $A A^\mathrm{T} = \Lambda^{-1}$. |
| 31 | + |
| 32 | +Then, $X = \mu + A Z_1 / \sqrt{Z_2/b}$ and $Y = Z_2/b$ jointly follow a [normal-gamma distribution](/D/ng) with [mean vector](/D/mean-rvec) $\mu$, [precision matrix](/D/precmat) $\Lambda$, shape parameter $a$ and rate parameter $b$: |
| 33 | + |
| 34 | +$$ \label{eq:ng-samp} |
| 35 | +\left( X = \mu + A Z_1 / \sqrt{Z_2/b}, \; Y = Z_2/b \right) \sim \mathrm{NG}(\mu, \Lambda, a, b) \; . |
| 36 | +$$ |
| 37 | + |
| 38 | + |
| 39 | +**Proof:** If all entries of $Z_1$ are independent and [standard normally distributed](/D/snorm) |
| 40 | + |
| 41 | +$$ \label{eq:zi-dist} |
| 42 | +z_{1i} \overset{\mathrm{i.i.d.}}{\sim} \mathcal{N}(0, 1) \quad \text{for all} \quad i = 1,\ldots,n \; , |
| 43 | +$$ |
| 44 | + |
| 45 | +this [implies a multivariate normal distribution with diagonal covariance matrix](/P/mvn-ind): |
| 46 | + |
| 47 | +$$ \label{eq:Z1-dist} |
| 48 | +Z_1 \sim \mathcal{N}\left(0_n, I_n \right) |
| 49 | +$$ |
| 50 | + |
| 51 | +where $0_n$ is an $n \times 1$ matrix of zeros and $I_n$ is the $n \times n$ identity matrix. |
| 52 | + |
| 53 | +If the distribution of $Z_2$ is a [standard gamma distribution](/D/sgam) |
| 54 | + |
| 55 | +$$ \label{eq:Z2-dist} |
| 56 | +Z_2 \sim \mathrm{Gam}(a, 1) \; , |
| 57 | +$$ |
| 58 | + |
| 59 | +then due to the [relationship between gamma and standard gamma distribution distribution](/P/gam-sgam), we have: |
| 60 | + |
| 61 | +$$ \label{eq:Y-dist} |
| 62 | +Y = \frac{Z_2}{b} \sim \mathrm{Gam}(a,b) \; . |
| 63 | +$$ |
| 64 | + |
| 65 | +Moreover, using the [linear transformation theorem for the multivariate normal distribution](/P/mvn-ltt), it follows that: |
| 66 | + |
| 67 | +$$ \label{eq:X-dist} |
| 68 | +\begin{split} |
| 69 | +Z_1 &\sim \mathcal{N}\left(0_n, I_n \right) \\ |
| 70 | +X = \mu + \frac{1}{\sqrt{Z_2/b}} A Z_1 &\sim \mathcal{N}\left(\mu + \frac{1}{\sqrt{Z_2/b}} A \, 0_n, \left( \frac{1}{\sqrt{Z_2/b}} A \right) I_n \left( \frac{1}{\sqrt{Z_2/b}} A \right)^\mathrm{T} \right) \\ |
| 71 | +X &\sim \mathcal{N}\left(\mu + 0_n, \left( \frac{1}{\sqrt{Y}} \right)^2 A A^\mathrm{T} \right) \\ |
| 72 | +X &\sim \mathcal{N}\left(\mu, \left( Y \Lambda \right)^{-1} \right) \; . |
| 73 | +\end{split} |
| 74 | +$$ |
| 75 | + |
| 76 | +Thus, $Y$ follows a [gamma distribution](/D/gam) and the distribution of $X$ conditional on $Y$ is a [multivariate normal distribution](/D/mvn): |
| 77 | + |
| 78 | +$$ \label{eq:mvn-gam} |
| 79 | +\begin{split} |
| 80 | +X \vert Y &\sim \mathcal{N}(\mu, (Y \Lambda)^{-1}) \\ |
| 81 | +Y &\sim \mathrm{Gam}(a, b) \; . |
| 82 | +\end{split} |
| 83 | +$$ |
| 84 | + |
| 85 | +This means that, [by definition](/D/ng), $X$ and $Y$ jointly follow a [normal-gamma distribution](/D/ng): |
| 86 | + |
| 87 | +$$ \label{eq:ng-samp-qed} |
| 88 | +X,Y \sim \mathrm{NG}(\mu, \Lambda, a, b) \; , |
| 89 | +$$ |
| 90 | + |
| 91 | +Thus, given $Z_1$ defined by \eqref{eq:zi-dist} and $Z_2$ defined by \eqref{eq:Z2-dist}, $X$ and $Y$ defined by \eqref{eq:ng-samp} are a [sample](/D/samp) from $\mathrm{NG}(\mu, \Lambda, a, b)$. |
0 commit comments