= Normal-gamma distribution
{title2=$\tau\sim\operatorname{Gamma}(\alpha,\beta),\quad\mu\mid\tau\sim N(\mu_0,(K\tau)^{-1})$}
{wiki}
A normal-gamma <conjugate prior> for the mean $\mu$ and <precision parameter> $\tau$ of a <Gaussian distribution> specifies a <Gamma distribution> $\tau\sim\operatorname{Gamma}(\alpha,\beta)$ in the shape-rate convention and a conditional <Gaussian distribution> $\mu\mid\tau\sim N(\mu_0,(K\tau)^{-1})$. Its joint <probability density function> is proportional to $\tau^{\alpha-1}\sqrt\tau\exp[-\beta\tau-K\tau(\mu-\mu_0)^2/2]$, with $\alpha,\beta,K>0$. For $n$ independent observations with <Gaussian distribution> $N(\mu,\tau^{-1})$, multiplication by the <likelihood> and completing the square gives
$$
K_n=K+n,\quad\mu_n=(K\mu_0+n\bar x)/(K+n),\quad\alpha_n=\alpha+n/2,
$$
and $\beta_n=\beta+\sum_i(x_i-\bar x)^2/2+Kn(\bar x-\mu_0)^2/[2(K+n)]$. The identity behind conjugacy is $K(\mu-\mu_0)^2+\sum_i(x_i-\mu)^2=(K+n)(\mu-\mu_n)^2+\sum_i(x_i-\bar x)^2+Kn(\bar x-\mu_0)^2/(K+n)$.
Back to article page