Tutorials › Generalized Linear Models › Penalized Poisson Regression With Exposure Offsets

Penalized GLM Estimation · Tutorial 913 of 981

Penalized Poisson Regression With Exposure Offsets

Fit penalized Poisson log-linear models with known exposure, interpret their coefficients as log-rate effects, and compare ridge, lasso, and elastic-net predictions.

Advanced 10 min read

What You'll Learn

  • Express known exposure as a fixed log-offset in the Poisson linear predictor.
  • Distinguish a modeled log-rate effect from the exposure-scaled predicted count.
  • Write the ridge, lasso, and elastic-net Poisson objectives with an unpenalized offset.
  • Derive the penalized score and coordinatewise KKT condition.
  • Calculate and compare fitted coefficients and counts under different penalties.
  • Recognize why coefficient shrinkage need not imply uniform shrinkage of every prediction.

Why Exposure Belongs in the Offset

When counts are observed over unequal amounts of time, area, or opportunity, the count alone is not a comparable measure of event frequency. A count of 12 events over 6,000 person-years represents a lower rate than 12 events over 1,000 person-years. Poisson regression handles this difference by placing the logarithm of known exposure in the linear predictor as a fixed offset. Penalization then acts on modeled covariate effects, not on the known exposure.

Let \(Y_i\) be the count for observation \(i\), \(E_i>0\) its known exposure, and \(x_i\) its vector of predictors. Under the Poisson model, \(Y_i\) has mean \(\mu_i\), and a log link with exposure offset gives the following specification.

Definition: A penalized Poisson regression with a fixed exposure offset has independent responses \(Y_i\mid x_i,E_i\sim\operatorname{Poisson}(\mu_i)\), with \(\log\mu_i=\log E_i+x_i^\mathsf{T}\beta\). The quantity \(\log E_i\) is a known offset: its coefficient is fixed at one, rather than estimated. The model-implied event rate per unit exposure is \(\mu_i/E_i=\exp(x_i^\mathsf{T}\beta)\).

The coefficient vector \(\beta\) describes log-rate effects. For a one-unit increase in predictor \(j\), holding the other predictors fixed, the modeled rate is multiplied by \(\exp(\beta_j)\). The expected count is different: it is the rate multiplied by exposure, \(\mu_i=E_i\exp(x_i^\mathsf{T}\beta)\). Thus equal covariates but unequal exposures generally produce unequal predicted counts.

Penalized Objective and Score

For observed counts \(y_1,\ldots,y_n\), omit the Poisson terms \(\log(y_i!)\), which do not depend on the coefficients. A common objective to minimize is the negative log-likelihood plus a penalty:

$$ Q(\beta)=\sum_{i=1}^n\left\{E_i\exp(x_i^\mathsf{T}\beta)-y_i\left(\log E_i+x_i^\mathsf{T}\beta\right)\right\} +\lambda\left\{\alpha\|\beta\|_1+\frac{1-\alpha}{2}\|\beta\|_2^2\right\}. $$

Here \(\lambda\geq0\) controls the overall penalty and \(0\leq\alpha\leq1\) mixes the lasso and ridge components. Ridge is obtained at \(\alpha=0\), lasso at \(\alpha=1\), and intermediate values give the elastic net. If the model includes an intercept, it is conventionally excluded from the penalty; the same is true of the fixed offset, which is not an estimated coefficient. The objective can equivalently be written using \(\mu_i=E_i\exp(x_i^\mathsf{T}\beta)\); the offset contribution to the term linear in \(y_i\) is then a constant with respect to \(\beta\).

Let \(X\) be the matrix whose \(i\)th row is \(x_i^\mathsf{T}\), and let \(\mu\) and \(y\) denote the vectors of means and observed counts. Differentiating the smooth negative log-likelihood gives \(X^\mathsf{T}(\mu-y)\). Therefore, for coordinates included in the penalty, the stationarity condition is

$$ X^\mathsf{T}(\mu-y)+\lambda(1-\alpha)\beta+\lambda\alpha z=0, \qquad z_j\in\partial|\beta_j|. $$

The subgradient is \(z_j=\operatorname{sign}(\beta_j)\) when \(\beta_j\ne0\), and any value in \([-1,1]\) when \(\beta_j=0\). An unpenalized intercept instead has its ordinary score equation, with no penalty term. The offset changes each \(\mu_i\) through the known factor \(E_i\), but it creates no additional derivative with respect to \(\beta\).

Two Properties of the Offset Model

Result: In a Poisson log-link model with fixed positive exposure \(E_i\) and linear predictor \(\log E_i+x_i^\mathsf{T}\beta\), the expected count per unit exposure is \(\exp(x_i^\mathsf{T}\beta)\). Consequently, a coefficient \(\beta_j\) is a log rate ratio for a one-unit change in \(x_{ij}\), holding other predictors fixed.

Proof. By the Poisson mean model and the log link, \(\log E[Y_i\mid x_i,E_i]=\log\mu_i=\log E_i+x_i^\mathsf{T}\beta\). Exponentiating both sides gives \(\mu_i=E_i\exp(x_i^\mathsf{T}\beta)\). Since \(E_i>0\), dividing by exposure yields \(\mu_i/E_i=\exp(x_i^\mathsf{T}\beta)\). Increasing \(x_{ij}\) by one changes the rate from its original value to that value multiplied by \(\exp(\beta_j)\), as claimed. \(\square\)

Result: For finite observations with \(E_i>0\), the smooth negative Poisson log-likelihood has Hessian \(X^\mathsf{T}\operatorname{diag}(\mu_i)X\). It is convex in \(\beta\); if \(X\) has full column rank, it is strictly convex. Adding a convex ridge, lasso, or elastic-net penalty preserves convexity, and under full column rank the total objective is strictly convex. Thus, if a finite minimizer is attained under that rank condition, it is unique.

Proof. The smooth objective, up to terms independent of \(\beta\), is \(\sum_i\{E_i\exp(x_i^\mathsf{T}\beta)-y_i x_i^\mathsf{T}\beta\}\). Its gradient is \(X^\mathsf{T}(\mu-y)\), because the derivative of \(\mu_i\) with respect to \(\beta\) is \(\mu_i x_i\). Differentiating again gives \(X^\mathsf{T}\operatorname{diag}(\mu_i)X\). For any vector \(v\), \(v^\mathsf{T}X^\mathsf{T}\operatorname{diag}(\mu_i)Xv=\sum_i\mu_i(x_i^\mathsf{T}v)^2\geq0\), since every \(\mu_i>0\). This proves convexity. If \(X\) has full column rank, every nonzero \(v\) has \(Xv\ne0\), so the displayed sum is strictly positive and the smooth objective is strictly convex. Each specified penalty is convex; adding a convex function preserves convexity, and adding it to a strictly convex function preserves strict convexity. A strictly convex objective cannot have two distinct minimizers: strict convexity at their midpoint would give a value smaller than the common minimum. This proves the uniqueness statement whenever a finite minimizer exists. \(\square\)

Worked Coefficient Comparisons

The following examples use one observation and a single coefficient, with no intercept: \(x=1\), so the linear predictor is \(\log E+\beta\). This deliberately simple setup makes each penalty’s effect visible. The examples are calculations for these specified models, not a claim that penalization must reduce every coefficient or every prediction in a general multivariable model.

Worked Example: Ridge With Exposure 3

Observe \(y=6\) events over exposure \(E=3\). Use the ridge penalty \(\lambda\beta^2/2\) with \(\lambda=4\). The negative log-likelihood, omitting constants, is \(3\exp(\beta)-6(\log3+\beta)\). Its penalized derivative is \(3\exp(\beta)-6+4\beta\), so the minimizing coefficient solves \(3\exp(\beta)+4\beta=6\).

At \(\widehat\beta\approx0.39107402\), \(3\exp(\widehat\beta)\approx4.435704\) and \(4\widehat\beta\approx1.564296\). Their sum is approximately \(6.000000\), confirming the root to the shown precision. The fitted count is \(\widehat\mu=3\exp(\widehat\beta)\approx4.4357\), and the fitted rate is \(\widehat\mu/3\approx1.4786\). The unpenalized estimate would be \(\log(6/3)=\log2\approx0.69315\); ridge pulls this positive log-rate effect toward zero.

Worked Example: A Second Ridge Score Equation

Now observe \(y=9\) over exposure \(E=2\), again with \(x=1\) and no intercept, and use ridge penalty \(\beta^2/2\), so \(\lambda=1\). The penalized derivative is \(2\exp(\beta)-9+\beta\), giving the equation \(2\exp(\beta)+\beta=9\).

The root is \(\widehat\beta\approx1.34253394\). Substitution gives \(2\exp(\widehat\beta)\approx7.657466\), and therefore \(2\exp(\widehat\beta)+\widehat\beta\approx7.657466+1.342534=9.000000\). Thus the fitted rate is approximately \(7.657466/2=3.828733\). The explicit substitution is important: the count term and the ridge derivative together, not the count alone, equal the observed count in the penalized score equation.

To compare penalty types directly, keep the \(y=6,E=3,x=1\) observation from the first example and change only the penalty. Its unpenalized log-rate coefficient is \(\log2\approx0.69315\), and the unpenalized fitted count is 6.

Worked Example: Lasso Sets the Log-Rate Effect

For this same observation, use a lasso penalty \(\lambda|\beta|\) with \(\lambda=1\). At a positive coefficient, the derivative condition is \(3\exp(\beta)-6+1=0\), so \(3\exp(\widehat\beta)=5\). Hence \(\widehat\beta=\log(5/3)\approx0.510826\). This is positive, so the assumed subgradient \(+1\) is valid. At zero, the likelihood score is \(3-6=-3\), whose absolute value exceeds \(\lambda=1\); thus zero does not satisfy the lasso KKT condition. The fitted count is 5 and the fitted rate is \(5/3\). In this example lasso reduces the coefficient and count from their unpenalized values, but does not set the coefficient exactly to zero.

Worked Example: Elastic Net Between Ridge and Lasso

Use \(\lambda=2\) and \(\alpha=0.5\) on the same \(y=6,E=3,x=1\) observation. The penalty is \(2\{0.5|\beta|+(0.5/2)\beta^2\}=|\beta|+0.5\beta^2\). For a positive coefficient, its derivative is \(1+\beta\). The score equation becomes \(3\exp(\beta)-6+1+\beta=0\), or \(3\exp(\beta)+\beta=5\).

The root is approximately \(\widehat\beta=0.42253\): \(3\exp(0.42253)\approx4.57745\), and adding \(0.42253\) gives approximately \(4.99998\), consistent with 5 at the displayed precision. The fitted count is about \(4.5775\), and the fitted rate is about \(1.5258\). For this particular data point, the coefficient and fitted count lie below the unpenalized values and above the ridge example’s values. The penalties are not directly interchangeable, however: their scales and the mixing parameter both matter.

How to Interpret the Shrinkage

1
Keep exposure fixed.
Use the known \(E_i\) as \(\log E_i\) in the linear predictor; do not estimate or penalize an exposure coefficient.
2
Fit the penalized rate effects.
Minimize the Poisson negative log-likelihood plus the chosen penalty on the modeled coefficients, with the stated intercept convention.
3
Recover counts from rates.
For each observation, calculate the fitted rate \(\exp(x_i^\mathsf{T}\widehat\beta)\), then multiply by \(E_i\) to obtain \(\widehat\mu_i\).

Ridge continuously shrinks coefficients, while lasso can produce exact zeros; elastic net combines these behaviors. In a multivariable fit, these descriptions concern coefficient regularization, not a guarantee that every fitted count moves toward zero or that every prediction decreases. Correlated predictors, differing covariate patterns, and the exposure factor all affect fitted counts. For instance, even with a smaller estimated rate, a sufficiently larger exposure can yield a larger predicted count. A rate ratio \(\exp(\widehat\beta_j)\) should therefore be interpreted separately from any one exposure-specific count prediction.

Common Pitfall

A frequent error is to treat \(\log E_i\) as an ordinary predictor whose coefficient should be estimated or shrunk. That changes the model: the exposure relationship is no longer fixed to be proportional. Another error is to report \(\exp(\widehat\beta_j)\) as a predicted count. It is a multiplicative rate effect for a one-unit covariate change; the expected count for observation \(i\) is \(E_i\exp(x_i^\mathsf{T}\widehat\beta)\). Always state which quantity is being reported and include the exposure when calculating a count.

Key takeaway: In penalized Poisson regression with known exposure, the offset fixes the exposure contribution, while ridge, lasso, or elastic net regularizes the log-rate effects. Obtain a count prediction only after multiplying the modeled rate by the observation’s exposure.

Check Your Understanding

Work through these questions using the definitions and calculations above.

  1. If \(E_i=400\) and \(x_i^\mathsf{T}\beta=-1\), what is the fitted rate per unit exposure, and what is the fitted expected count?
  2. For a one-unit increase in a predictor with coefficient \(\beta_j\), what does \(\exp(\beta_j)\) represent in an exposure-offset Poisson model?
  3. Why does the fixed offset \(\log E_i\) contribute no derivative with respect to \(\beta\), even though exposure changes the fitted mean?
  4. In the \(y=6,E=3\) lasso example, verify the fitted count and explain why the positive-coefficient subgradient is appropriate.
  5. Can a penalized model with a lower fitted rate than another model still have a higher fitted count for a particular observation? Explain the role of exposure.
Clinical Biostats