Poisson–exponential posterior shrinkage formula (source code)

= Poisson–exponential posterior shrinkage formula
{c}
{title2=$\mathbb E[\theta_i\mid y]=\frac{s}{s+n}y_i+\frac{n}{s+n}\overline y$}

For $Y_i\mid\theta_i\sim\operatorname{Poisson}(\theta_i)$ and $\theta_i\mid\psi\sim\operatorname{Exp}(\psi)$, a <scale-invariant prior> $d\psi/\psi$ induces the <Haldane prior> on $\phi=(1+\psi)^{-1}$. Integrating out each local mean gives $p(y_i\mid\phi)=(1-\phi)\phi^{y_i}$. Thus $\phi\mid y\sim\operatorname{Beta}(s,n)$ for $s=\sum_i y_i>0$. The gamma <full conditional distribution> has mean $(y_i+1)\phi$, so the <tower property> gives $(y_i+1)s/(s+n)$, equal to the displayed <partial pooling> formula. For $s=0$, the posterior is improper and this expectation is undefined.