Solution (source code)

= Solution

For independent <Poisson distributions>, ignoring the factorial term only when taking likelihood differences,
$$
\ell(\mu)=\sum_i\{y_i\log\mu_i-\mu_i-\log(y_i!)\}.
$$
The saturated likelihood maximizes each mean separately at $\widetilde\mu_i=y_i$, including its limiting value at zero. Therefore the <Poisson deviance> is
$$
\boxed{D=2\{\ell(\widetilde\mu)-\ell(\widehat\mu)\}
=2\sum_{i=1}^{30}\left[y_i\log\frac{y_i}{\widehat\mu_i}-(y_i-\widehat\mu_i)\right],}
$$
where $0\log(0/\widehat\mu_i)$ is defined to be zero and $\widehat\mu_i=e^{3.24926+0.01898a_i}$. The expression is twice a saturated-model <likelihood ratio> difference, not twice a likelihood ratio itself.

With sufficiently large fitted counts and regularity, $D$ is approximately $\chi^2_{30-2}$ under a correctly specified <Poisson regression>. Here $D=83.351$ on 28 <residual degrees of freedom>, with upper-tail probability $2.0935\times10^{-7}$. \b[The Poisson model fits poorly on this diagnostic.] Its deviance is nearly three times its <degrees of freedom>, consistent with <overdispersion>, although a wrong mean function, dependence, or influential islands could also cause the discrepancy. The smaller <Akaike information criterion> than its competitors does not make this an adequate absolute fit.