Gamma scale inverse-gamma conjugacy (source code)

= Gamma scale inverse-gamma conjugacy
{title2=$\Theta\mid x\sim\operatorname{InvGamma}(k+n\alpha,\lambda+\sum_jx_j)$}

For conditionally independent <gamma distribution> observations of known shape $\alpha$ and unknown scale $\Theta$, an <inverse-gamma distribution> prior with shape $k$ and scale $\lambda$ gives an <inverse-gamma distribution> posterior with shape $k+n\alpha$ and scale $\lambda+\sum_jx_j$. The <posterior mean> of the conditional claim <expected value> $\alpha\Theta$ is $\alpha(\lambda+\sum_jx_j)/(k+n\alpha-1)$ when the denominator is positive.