Solution (source code)

= Solution

The second <Poisson exposure model> allows each location its own baseline accident rate:
$$
Y_{it}\overset{\mathrm{ind}}\sim\operatorname{Poisson}(e_{it}e^{\alpha+\lambda_i+\beta t}),\qquad\lambda_1=0.
$$
The last equality is the <corner-point constraint>. The common after-to-before <incidence rate ratio> remains $e^\beta$. This model is appropriate because the sites can have different background risks; treating those differences as unexplained Poisson variation made the first model fit poorly, with deviance $50.863$ on 14 <residual degrees of freedom>.

Adding seven location effects to the first fitted model reduces the deviance by $50.863-16.275=34.588$, which is large relative to $\chi^2_7$. The supplied sequential <analysis of deviance> reports a slightly different location contribution because it enters locations before the period indicator. The full model is much better but its deviance $16.275$ on 7 degrees of freedom still gives an approximate goodness-of-fit $p$-value $0.0227$. That suggests residual lack of fit or <overdispersion>, although sparse accident counts make the asymptotic <deviance goodness-of-fit test> approximate.