Solution (source code)

= Solution

Let $s=\sum_{j=1}^n x_j$. The conditional joint <likelihood function> of the observed counts is
$$
L(\theta;\mathbf x)=\prod_{j=1}^n\frac{e^{-\theta}\theta^{x_j}}{x_j!}
=\frac{e^{-n\theta}\theta^s}{\prod_jx_j!}.
$$
The <prior> is a <gamma distribution> with shape two and rate $\lambda$. Multiplication by its density gives the unnormalized <posterior density> $\theta^{s+1}e^{-(n+\lambda)\theta}$. Normalizing with the <gamma function> yields
$$
\pi(\theta\mid\mathbf x)=\frac{(n+\lambda)^{s+2}}{\Gamma(s+2)}
\theta^{s+1}e^{-(n+\lambda)\theta},\qquad\theta>0.
$$
Thus <Poisson-gamma conjugacy> gives $\Theta\mid\mathbf x\sim\operatorname{Gamma}(s+2,n+\lambda)$. Conditional on $\Theta$ and the past data, the next count has mean $\Theta$, so the <law of total expectation> gives
$$
\boxed{\mathbb E[X_{n+1}\mid\mathbf x]=\mathbb E[\Theta\mid\mathbf x]=\frac{s+2}{n+\lambda}.}
$$
With $\overline x=s/n$ and <prior> mean $m_0=2/\lambda$, this is exactly
$$
\boxed{\frac{s+2}{n+\lambda}
=Z\overline x+(1-Z)m_0,\qquad Z=\frac n{n+\lambda}.}
$$
Here $n\geq1$, $\lambda>0$, and the <credibility factor> increases to one as the number of observed years grows. The denominator uses the <prior> rate $\lambda$ and total exposure $n$; it does not add two to the exposure when adding the <prior> shape.