= Solution
Use $e_{ij}$ for the expected accident count, not for the accident rate. With a design row $z_{ij}$ consisting of an intercept, seven non-reference site indicators and the after-treatment indicator,
$$
e_{ij}=p_{ij}\exp(\mu+\alpha_i+\beta_j),\qquad
\ell=\sum_{ij}\{y_{ij}(\log p_{ij}+z_{ij}^{\mathsf T}\gamma)-e_{ij}-\log(y_{ij}!)\}.
$$
Here $\log p_{ij}$ is a known <generalized linear model offset>, with coefficient fixed at one. Differentiating the <Poisson regression> <log-likelihood> gives the <score function> equations
$$
\boxed{\sum_{ij}(y_{ij}-e_{ij})=0,\qquad
\sum_{j=1}^2(y_{ij}-e_{ij})=0\ (i=2,\ldots,8),\qquad
\sum_{i=1}^8(y_{i2}-e_{i2})=0}.
$$
These nine equations estimate the intercept, seven site contrasts and one treatment contrast, with the stated reference-level constraints.
The <Fisher information> is $Z^{\mathsf T}WZ$, where $W=\operatorname{diag}(e_{ij})$. A <Fisher scoring> update adds $(Z^{\mathsf T}WZ)^{-1}Z^{\mathsf T}(y-e)$ to the current coefficient vector. In <iteratively reweighted least squares>, the working response is $z^*_{ij}=\log e_{ij}+(y_{ij}-e_{ij})/e_{ij}$; regress $z^*_{ij}-\log p_{ij}$ on the design with weights $e_{ij}$. Thus the reported four iterations solve the <likelihood> equations while accounting for unequal exposure periods.
The common adjusted <rate ratio> is obtained by exponentiating the after coefficient:
$$
\boxed{\widehat r=e^{-0.7806616}\simeq0.4581}.
$$
This estimates a $54.2\%$ lower accident rate after the intervention, conditional on the additive site model. The <standard error> $0.2751810$ gives normal <Wald statistic> $-2.8369$, two-sided $p\simeq0.0046$, and an approximate $95\%$ <confidence interval> for the <rate ratio>
$$
\boxed{\exp[-0.7806616\pm1.96(0.2751810)]\simeq[0.267,0.786]}.
$$
The label t value is again a normal-reference Wald ratio under fixed Poisson dispersion, rather than an exact Student statistic.
The intercept gives the before rate at reference site one: $e^{0.2707792}\simeq1.311$ accidents per year. The seven site coefficients are log baseline-<rate ratios> relative to that site. In site order two through eight, their exponentials are about $0.615,2.767,1.711,0.769,1.797,0.615,1.221$. The third site has the largest estimated rate and a nominal Wald ratio about $3.118$ against the reference. These are adjusted baseline comparisons, not differences in absolute accident counts. The overall unadjusted before/after <rate ratio> is $(15/18)/(114/68)\simeq0.497$, and it differs from $0.458$ because site risks and their relative exposure weights differ.
An <independent> way to solve the fit is the <profile likelihood for a common Poisson rate ratio with unequal exposures>. Put $t_i=y_{i1}+y_{i2}$ and $\lambda_i=\exp(\mu+\alpha_i)$. For fixed $r$, the site score gives $\widehat\lambda_i=t_i/(p_{i1}+rp_{i2})$. The remaining equation is
$$
\sum_i\frac{t_i r p_{i2}}{p_{i1}+rp_{i2}}=15.
$$
Its positive root reproduces the reported treatment estimate. Comparing the same site model with $r=1$ to the fitted model gives a <deviance> improvement about $9.750$ on one degree of freedom, with nominal likelihood-ratio $p\simeq0.0018$.
There are $16$ count observations and $9$ fitted mean parameters, leaving $7$ residual degrees of freedom. The <null deviance> $132.9485$ on $15$ degrees of freedom is for the intercept-only rate model, still including the exposure offset. The residual <Poisson deviance> is $16.27524$ on $7$ degrees of freedom. A chi-squared comparison gives approximately $p=0.023$, suggesting potential lack of fit of a single common treatment ratio; the extreme <deviance residuals> near $-2.03$ and $2.14$ also deserve inspection. Several after-cell expected counts are below one or near two, so this absolute-fit calibration is only approximate. Site-specific treatment effects, <overdispersion> or temporal dependence are possible explanations to investigate, with a <parametric bootstrap> available to calibrate the sparse-count fit statistic. A before/after association alone does not isolate a causal effect from secular changes or <regression to the mean> at selected sites.
Back to article page