Gamma prior for an inverse-gamma scale (source code)

= Gamma prior for an inverse-gamma scale
{c}
{title2=$\Theta\mid x\sim\operatorname{Gamma}(\alpha+nk,\lambda+\sum_i x_i^{-1})$}

Let $X_1,\ldots,X_n$ be conditionally <independent> <inverse-gamma distribution> observations with known shape $k>0$, unknown scale $\Theta>0$, and observed values $x_i>0$. Their <likelihood function> is
$$
L(\Theta;x)\propto\Theta^{nk}\exp\left(-\Theta\sum_i x_i^{-1}\right).
$$
A <gamma distribution> prior with shape $\alpha>0$ and rate $\lambda>0$ is a <conjugate prior>, giving
$$
\Theta\mid x\sim\operatorname{Gamma}\left(\alpha+nk,\lambda+\sum_i x_i^{-1}\right).
$$
This follows by multiplying the two powers of $\Theta$ and the two exponential factors. It uses reciprocal observations, rather than their <sample mean>.

If $k>1$, the conditional claim <expected value> is $m(\Theta)=\Theta/(k-1)$. Its <Bayes estimator under squared error loss> is the posterior <expected value>
$$
\mathbb E[m(\Theta)\mid x]=\frac{\alpha+nk}{(k-1)(\lambda+\sum_i x_i^{-1})}.
$$
Here the target is the conditional <expected value>, whose posterior second <moment> is finite because the posterior for $\Theta$ is gamma. When $0<k\leq1$, the conditional claim <expected value> is infinite and this finite-estimate formula does not apply. For example, $k=2$, $\alpha=1$, $\lambda=1$ and observations $1,2$ give posterior shape $5$, rate $5/2$, and estimated conditional claim <expected value> $2$.