Tutorials › Generalized Linear Models › Score Equations With Known Offsets

Likelihood Scores and Equations · Tutorial 172 of 981

Score Equations With Known Offsets

Learn to derive and interpret regression score equations when a known offset is included in the linear predictor.

Intermediate 11 min read

What You'll Learn

  • Distinguish a known offset from a regression coefficient.
  • Derive the general GLM score with an offset by the chain rule.
  • Write the score equations for Poisson, grouped binomial, and gamma models with offsets.
  • Explain why the offset affects fitted means without adding a derivative term.
  • Identify common errors in constructing offset score equations.

Why an Offset Changes the Model but Is Not a Coefficient

Some regression models need a predictor contribution whose value is known in advance and whose coefficient is fixed at one. For example, a count observed over a longer period is expected to be larger even when its underlying rate is unchanged. A log-exposure term can represent that difference. It affects the model's fitted means, but it is not an additional regression coefficient to estimate.

The distinction is important when differentiating the likelihood. The fitted mean depends on the offset through the linear predictor, so the offset affects the value of the score. But because the offset is fixed, its derivative with respect to the regression coefficients is zero. The score still has one component for each regression coefficient, with the usual design vector multiplying the observation-specific contribution.

Definition: In a GLM, a known offset \(o_i\) is a fixed, known contribution to observation \(i\)'s linear predictor. With covariate vector \(x_i\) and regression coefficient vector \(\beta\), the predictor is $$ \eta_i=x_i^\mathsf{T}\beta+o_i. $$ The offset is not multiplied by an unknown coefficient. It may differ across observations, but it is held fixed when differentiating with respect to \(\beta\).

Deriving the General Score

Suppose \(Y_1,\ldots,Y_n\) are independent observations from a regular exponential-dispersion GLM, with fixed dispersion \(\phi>0\), mean \(\mu_i=E[Y_i]\), and variance \(\operatorname{Var}(Y_i)=\phi V(\mu_i)\). Write the link as \(\eta_i=g(\mu_i)\), and assume \(g\) is differentiable with \(g'(\mu_i)\ne 0\). The response support is assumed not to depend on \(\beta\), and the likelihood is differentiable in the parameter values under consideration.

For such a model, the part of the individual log-likelihood that depends on \(\mu_i\) can be written as \(\{y_i\theta_i-b(\theta_i)\}/\phi\), where \(d\mu_i/d\theta_i=V(\mu_i)\). Differentiating first with respect to \(\mu_i\) gives

$$ \frac{\partial \ell_i}{\partial \mu_i} = \frac{1}{\phi}\{y_i-b'(\theta_i)\}\frac{d\theta_i}{d\mu_i} = \frac{y_i-\mu_i}{\phi V(\mu_i)}. $$

Here \(b'(\theta_i)=\mu_i\). The offset enters through \(\eta_i=x_i^\mathsf{T}\beta+o_i\). Since \(o_i\) is fixed, \(\partial\eta_i/\partial\beta=x_i\). Also, differentiating \(\eta_i=g(\mu_i)\) gives \(\partial\mu_i/\partial\beta=x_i/g'(\mu_i)\). Applying the chain rule yields the coefficient score.

Theorem: Under the conditions above, the score vector for \(\beta\) in a GLM with known offsets is $$ U(\beta) = \frac{\partial\ell(\beta)}{\partial\beta} = \sum_{i=1}^n x_i\, \frac{y_i-\mu_i}{\phi V(\mu_i)g'(\mu_i)}, \qquad \mu_i=g^{-1}(x_i^\mathsf{T}\beta+o_i). $$ The score equations set this vector equal to zero. The offset affects each \(\mu_i\), but contributes no additional derivative with respect to \(\beta\).

To see every part of the differentiation, write \(\ell(\beta)=\sum_i\ell_i(\mu_i(\beta))\). For each \(i\), the chain rule gives

$$ \frac{\partial\ell_i}{\partial\beta} = \frac{\partial\ell_i}{\partial\mu_i} \frac{\partial\mu_i}{\partial\eta_i} \frac{\partial\eta_i}{\partial\beta} = \frac{y_i-\mu_i}{\phi V(\mu_i)} \frac{1}{g'(\mu_i)} x_i. $$

Summing these contributions gives the stated score. In particular, the derivative of \(o_i\) with respect to \(\beta\) is zero; the derivative of the entire predictor is \(x_i\), not \(x_i+o_i\). The offset nevertheless remains inside \(\mu_i=g^{-1}(x_i^\mathsf{T}\beta+o_i)\), where it can change the residual and the variance factor in the score. This is how a fixed quantity can affect an estimating equation without being a parameter.

Worked Score Equations

Worked Example: Poisson Rates With Log Exposure

Suppose \(Y_i\) are independent Poisson counts, with log link and known exposures \(e_i>0\). The offset is \(o_i=\log e_i\), so \(\log\mu_i=x_i^\mathsf{T}\beta+\log e_i\). Take two observations with \(e_1=2\), \(e_2=4\), covariate vectors \(x_1=(1,0)^\mathsf{T}\), \(x_2=(1,1)^\mathsf{T}\), counts \(y_1=3\), \(y_2=10\), and evaluate the score at \(\beta=(0,\log 2)^\mathsf{T}\).

The fitted means are

$$ \mu_1=\exp(0+\log 2)=2, \qquad \mu_2=\exp(0+\log 2+\log 4)=8. $$

For a Poisson model, \(V(\mu)=\mu\), \(\phi=1\), and for the log link \(g'(\mu)=1/\mu\). Thus the factor multiplying \(x_i\) in the general score is \(y_i-\mu_i\). The two residuals are \(3-2=1\) and \(10-8=2\), so

$$ U(\beta) = x_1(1)+x_2(2) = \begin{pmatrix}1\\0\end{pmatrix} + 2\begin{pmatrix}1\\1\end{pmatrix} = \begin{pmatrix}3\\2\end{pmatrix}. $$

The exposure offsets determine the fitted means 2 and 8. They do not add components to the score: its two entries correspond to the intercept and the covariate coefficient.

Worked Example: Grouped Binomial Logit With a Known Offset

Consider two grouped binomial observations with trial counts \(m_1=10\), \(m_2=8\) and success counts \(y_1=4\), \(y_2=6\). Use \(x_1=(1,0)^\mathsf{T}\), \(x_2=(1,1)^\mathsf{T}\), known offsets \(o_1=0\), \(o_2=\log 3\), and evaluate at \(\beta=(0,0)^\mathsf{T}\). The logit model is \(\operatorname{logit}(p_i)=x_i^\mathsf{T}\beta+o_i\), where \(\mu_i=m_i p_i\).

The linear predictors are \(0\) and \(\log 3\), giving \(p_1=1/2\) and \(p_2=3/4\). Therefore the fitted success counts are

$$ \mu_1=10\left(\frac12\right)=5, \qquad \mu_2=8\left(\frac34\right)=6. $$

For grouped binomial data, the logit score contribution is \(x_i(y_i-m_i p_i)=x_i(y_i-\mu_i)\). The residuals are \(4-5=-1\) and \(6-6=0\). Hence

$$ U(\beta) = x_1(-1)+x_2(0) = \begin{pmatrix}-1\\0\end{pmatrix}. $$

The second group's offset raises its fitted success probability to \(3/4\), but the score has no derivative term from \(\log 3\). The zero slope score here follows from the second group's zero residual; the intercept score is \(-1\) because the residuals across both groups sum to \(-1\).

Worked Example: Gamma Log-Link Regression With an Offset

Let \(Y_i\) have a gamma distribution with mean \(\mu_i\), variance \(\phi\mu_i^2\), and log link. Use \(\phi=1\), \(x_1=(1,0)^\mathsf{T}\), \(x_2=(1,1)^\mathsf{T}\), offsets \(o_1=0\), \(o_2=\log 2\), and \(\beta=(\log 2,0)^\mathsf{T}\). Suppose the observed responses are \(y_1=3\) and \(y_2=2\).

The fitted means are \(\mu_1=\exp(\log 2)=2\) and \(\mu_2=\exp(\log 2+\log 2)=4\). For this gamma model, \(V(\mu)=\mu^2\) and \(g'(\mu)=1/\mu\). The score contribution before multiplying by \(x_i\) is therefore

$$ \frac{y_i-\mu_i}{\phi V(\mu_i)g'(\mu_i)} = \frac{y_i-\mu_i}{\mu_i}, $$

because \(\phi=1\). The contributions are \((3-2)/2=1/2\) and \((2-4)/4=-1/2\). Thus

$$ U(\beta) = x_1\left(\frac12\right)+x_2\left(-\frac12\right) = \begin{pmatrix}1/2\\0\end{pmatrix} + \begin{pmatrix}-1/2\\-1/2\end{pmatrix} = \begin{pmatrix}0\\-1/2\end{pmatrix}. $$

The intercept score is zero because the two scalar contributions cancel. The slope score is \(-1/2\) because only the second observation has a nonzero slope covariate. The offset changes that observation's mean from what it would be without the offset, and hence changes its score contribution.

Two Useful Consequences

A familiar simplification occurs for the canonical link. In the exponential-dispersion model, the canonical link takes \(g(\mu)=\theta\), the natural parameter. Since \(d\theta/d\mu=1/V(\mu)\), it follows that \(g'(\mu)=1/V(\mu)\). Substituting this identity into the score formula proves the following result.

Corollary: For a canonical-link GLM with known offsets and fixed dispersion \(\phi\), $$ U(\beta)=\frac{1}{\phi}\sum_{i=1}^n x_i(y_i-\mu_i), \qquad \mu_i=g^{-1}(x_i^\mathsf{T}\beta+o_i). $$

Indeed, in the general score the denominator contains \(\phi V(\mu_i)g'(\mu_i)\). For the canonical link, \(V(\mu_i)g'(\mu_i)=V(\mu_i)/V(\mu_i)=1\), leaving \((y_i-\mu_i)/\phi\) as the scalar contribution. The offset remains in \(\mu_i\); the simplification does not remove its effect on the score.

The score is also unbiased at the true coefficient vector, subject to the model's mean specification. To state this precisely, assume the design vectors and offsets are fixed, the true parameter \(\beta_0\) gives the correct means \(\mu_i\), and the score terms have finite expectations. Then each residual has mean zero, and the score formula is a finite sum.

Result: Under the stated conditions, \(E[U(\beta_0)]=0\), including when the linear predictor contains known offsets.

For each observation, \(x_i\), \(\phi\), \(V(\mu_i)\), and \(g'(\mu_i)\) are fixed at \(\beta_0\). Therefore

$$ E\!\left[ x_i\frac{Y_i-\mu_i}{\phi V(\mu_i)g'(\mu_i)} \right] = x_i\frac{E[Y_i]-\mu_i}{\phi V(\mu_i)g'(\mu_i)} = 0. $$

Adding these zero expectations over the finite set of observations gives \(E[U(\beta_0)]=0\). The offsets do not disturb this calculation: they help determine \(\mu_i\), while \(E[Y_i]=\mu_i\) still holds under the correctly specified model. \(\square\)

Common Mistakes and Why the Distinction Matters

Offsets are useful when part of the predictor is known rather than estimated. Examples include log exposure in a rate model and a fixed calibration contribution in a predictor. Treating such a term correctly preserves the intended model while leaving the regression parameters to describe the effects that are actually being estimated.

  • Adding the offset to the design vector. Incorrect reasoning: “The predictor contains \(o_i\), so it contributes another derivative term.” The correction is that \(o_i\) is fixed, so \(\partial o_i/\partial\beta=0\). The derivative of \(x_i^\mathsf{T}\beta+o_i\) with respect to \(\beta\) is \(x_i\).
  • Dropping the offset before calculating the fitted mean. Incorrect reasoning: “It is not a coefficient, so it cannot affect the score.” The correction is that the offset enters \(\eta_i\), and \(\mu_i=g^{-1}(\eta_i)\). It therefore affects residuals and other mean-dependent score factors.
  • Confusing an offset with an ordinary covariate. An ordinary covariate has an unknown coefficient to estimate; an offset is included with its coefficient fixed at one. If the coefficient on a known quantity should be estimated, it belongs in the regression design as an ordinary predictor, not as an offset.
Key takeaway: To derive a GLM score with a known offset, keep the offset inside the linear predictor when computing each fitted mean, then differentiate with respect to the regression coefficients. The derivative is still the design vector, so the general score retains its usual form with offset-adjusted means.

Check Your Understanding

Use the general score formula to answer these questions.

  1. In a log-link Poisson model with exposure \(e_i\), what is the offset, and where does it appear in the fitted mean?
  2. Why does a known offset not contribute a separate term to \(\partial\eta_i/\partial\beta\)?
  3. For a canonical-link GLM, write the score equation with known offsets and identify where the offsets still affect it.
  4. In a grouped binomial logit model, explain why a group-specific offset can change the score even though it is not estimated.
  5. What modeling change is needed if the coefficient multiplying a known predictor contribution should be estimated rather than fixed at one?
Clinical Biostats