Why an Offset Is Different From a Predictor
A predictor in a penalized regression contributes to the linear predictor through an estimated coefficient. An offset is different: it is a known contribution whose coefficient is fixed, usually at one. It enters the linear predictor, but it is not estimated from the response and is not shrunk by the penalty. This is useful when part of the relationship is established by the model design or supplied externally, while the remaining effects are learned from data.
For example, a count model may use exposure to convert an expected rate into an expected count. If a policy has 40 units of exposure, the model can include the logarithm of 40 as an offset. A logistic model might similarly include a known baseline log-odds contribution. In either case, the offset must be available not only when fitting the model, but also for every observation to be predicted.
If a known quantity \(z_i\) has a known coefficient \(c\) that is not one, its offset contribution is \(o_i=cz_i\). Supplying \(z_i\) alone would instead treat the known coefficient as one. Conversely, entering a known component as an ordinary predictor asks the model to estimate its coefficient, and a penalized fit may shrink that coefficient.
Offsets in the Penalized Objective
For a GLM with response \(y_i\), predictor vector \(x_i\), and offset \(o_i\), let \(g\) be the link function. The model specifies \(g(\mu_i)=\eta_i=\beta_0+o_i+x_i^\mathsf{T}\beta\), where \(\mu_i=E[Y_i\mid x_i,o_i]\). A typical elastic-net fitting objective is the average negative log-likelihood plus a penalty on the estimated predictor coefficients:
Here \(\ell\) is the GLM log-likelihood, \(\lambda\geq 0\) controls penalty strength, and \(0\leq\alpha\leq1\) controls the balance between lasso and ridge penalties. This expression shows the key distinction: \(o_i\) affects the likelihood through \(\eta_i\), but it is not a component of \(\beta\) and therefore does not appear in the penalty. In the usual glmnet setup, the intercept is also unpenalized by default; an offset is not the same thing as an intercept.
The exact likelihood and scaling depend on the response family. For example, a Poisson model with a log link has \(\log(\mu_i)=\eta_i\). A binomial model with a logit link has \(\log\{p_i/(1-p_i)\}=\eta_i\), where \(p_i=P(Y_i=1\mid x_i,o_i)\). The offset must be expressed on the linear-predictor scale. A positive exposure \(E_i\), for instance, contributes \(\log(E_i)\), not \(E_i\), to a log-link count model.
Why the Offset Is Not Shrunk
The distinction follows directly from the optimization problem. The offset is supplied as data and held fixed while the optimizer searches over \(\beta_0\) and \(\beta\). Changing \(\beta\) changes both the likelihood and the penalty. Changing an offset would change the specified model inputs, not a parameter being optimized.
For each observation, calculate \(o_i\) from known information. It is not part of the parameter vector being estimated.
Compute \(\eta_i=\beta_0+o_i+x_i^\mathsf{T}\beta\), then use the chosen GLM link to obtain the mean or probability.
The regularization term acts on \(\beta\), not on the supplied \(o_i\). Thus the offset contribution stays fixed even when \(\lambda\) changes.
This does not mean that an offset is automatically correct or that its contribution is immune to all model misspecification. It means only that the fitting procedure does not estimate or shrink it. If the supposed known relationship is uncertain, treating it as a fixed offset may understate that uncertainty. An ordinary predictor with an estimated coefficient may be more appropriate when the data should be allowed to revise the contribution.
Worked Examples
Worked Example: Exposure Offset in a Penalized Poisson Model
A hypothetical claim-count model uses a Poisson response and a log link. The exposure \(E\) is measured in policy-years, and the fitted penalized model has intercept \(\hat\beta_0=\log(0.10)\) and a binary predictor coefficient \(\hat\beta_1=\log(2)\). For a policy with exposure \(E=100\) and predictor \(x=1\), calculate the fitted expected count. Then calculate it for \(x=0\), holding exposure fixed.
Method. Use \(o=\log(E)\), so \(\log(\hat\mu)=\hat\beta_0+\log(E)+x\hat\beta_1\). The displayed coefficients are treated as the fitted values from the penalized model; the task is to apply the fitted model correctly.
For \(x=1\), substitute each contribution: \(\log(\hat\mu)=\log(0.10)+\log(100)+\log(2)\). Combining logarithms gives \(\log(\hat\mu)=\log(0.10\times100\times2)=\log(20)\). Therefore \(\hat\mu=20\) expected claims.
For \(x=0\), the predictor contribution is zero: \(\log(\hat\mu)=\log(0.10)+\log(100)+0=\log(10)\). Therefore \(\hat\mu=10\) expected claims. The fitted rate per policy-year is 0.20 when \(x=1\) and 0.10 when \(x=0\); multiplying each rate by 100 policy-years gives the two expected counts. The calculations check because the binary predictor doubles the rate and hence doubles the expected count at fixed exposure.
In R, the offset supplied to a Poisson fit would be `log(E)`, alongside the predictor matrix and response. The common mistake is to supply `E` itself: that would add 100 to the log mean instead of adding \(\log(100)\), producing an entirely different and inappropriate model.
Worked Example: A Known Baseline Contribution in Logistic Regression
A hypothetical binary-outcome model has a known baseline log-odds offset \(\log(1/49)\). Suppose a penalized fit gives an additional intercept \(\hat\beta_0=\log(2)\) and a penalized coefficient \(\hat\beta_1=\log(3)\) for an indicator \(z\). Calculate the fitted probabilities for \(z=0\) and \(z=1\).
Method. With the logit link, the linear predictor is the log odds. The fitted odds are the exponential of the offset plus the estimated intercept and predictor contribution.
For \(z=0\), the log odds are \(\log(1/49)+\log(2)+0=\log(2/49)\), so the odds are \(2/49\). Odds \(a\) correspond to probability \(a/(1+a)\), giving \(p=(2/49)/(1+2/49)=2/51=0.0392157\ldots\). Rounded to four decimal places, the fitted probability is 0.0392.
For \(z=1\), the log odds are \(\log(1/49)+\log(2)+\log(3)=\log(6/49)\), so the odds are \(6/49\). Thus \(p=(6/49)/(1+6/49)=6/55=0.1090909\ldots\). Rounded to four decimal places, the fitted probability is 0.1091. The odds for \(z=1\) are three times those for \(z=0\), as required by the coefficient \(\log(3)\). The probabilities are not three times one another because odds and probabilities are different scales.
The offset is fixed, but the additional intercept is estimated. Setting the intercept to zero would be a separate modeling choice, not a consequence of including an offset. A common mistake is to multiply the baseline probability by three and report that as the second probability; the correct operation multiplies the odds by three and then converts back to probability.
Worked Example: Supplying Offsets for Prediction
A hypothetical Poisson model has a log link, fitted intercept \(\hat\beta_0=\log(0.02)\), and fitted coefficient \(\hat\beta_1=\log(2)\) for binary predictor \(x\). The model includes exposure \(E\) and a known multiplier \(q\) through the offset \(o=\log(Eq)\). For two new observations, the inputs are \((E,q,x)=(5,2,1)\) and \((40,1,0)\). Find both predicted means and state the offset vector in the same row order.
Method. Calculate one offset for each new row, in the order of the rows in the new predictor matrix. Then add it to the fitted intercept and predictor contribution.
For the first row, \(Eq=5\times2=10\), so its offset is \(\log(10)\). Its log mean is \(\log(0.02)+\log(10)+\log(2)=\log(0.02\times10\times2)=\log(0.4)\). The predicted mean is therefore 0.4.
For the second row, \(Eq=40\times1=40\), so its offset is \(\log(40)\). Its predictor is zero, and its log mean is \(\log(0.02)+\log(40)+0=\log(0.8)\). The predicted mean is therefore 0.8. The offset vector is \((\log(10),\log(40))\), aligned with the two new rows. Both predictions check by multiplying the baseline rate 0.02 by exposure, the known multiplier, and \(2^x\).
In an R prediction call, supply the new predictor matrix and this matching offset vector using `newoffset`. If the model was tuned with `cv.glmnet`, pass the training offset to `cv.glmnet` and the new offset when predicting from the selected fit. The common mistake is to reuse the training offset vector for new rows or to supply the new offsets in a different order: either makes the fixed contribution belong to the wrong observations.
Using Offsets with glmnet
For a standard single-response fit, the offset is a numeric value for each training observation. A typical fitting pattern is `glmnet(x, y, family="poisson", offset=log(E), alpha=..., lambda=...)`, where `x` is the predictor matrix and `E` is the positive training exposure. For logistic regression, use the appropriate known contribution on the logit scale. If the model is tuned with `cv.glmnet`, supply the training offsets to that call as well, so each resampled fit uses the corresponding observations' known contributions.
For prediction, the new offset must match the new rows and the scale used during fitting. A typical pattern is `predict(fit, newx=x_new, s=..., type="response", newoffset=offset_new)`. For a cross-validated fit, the selected penalty value can be supplied through the cross-validation fit's prediction method, with the new offsets passed for those prediction rows. Check the package documentation for the exact argument requirements of the installed glmnet version, particularly when using less common response families.
Before fitting, verify that the offset is finite, correctly transformed, and aligned row by row with both the response and predictor matrix. Before prediction, repeat the alignment check against the new predictor matrix. For a log-exposure offset, exposure must be positive because \(\log(E)\) is undefined at zero; zero-exposure observations require an appropriate modeling decision rather than an arbitrary numerical substitute.
Common Exam Traps
- Using the wrong scale. A log-link model requires \(\log(E)\) as its exposure offset, not \(E\). The offset belongs on the linear-predictor scale.
- Penalizing a known coefficient by accident. Putting a known component into the predictor matrix makes its coefficient estimated. With regularization, that estimated coefficient can be shrunk. To keep a contribution fixed, calculate it and supply it as an offset.
- Assuming the intercept is fixed. An offset does not generally remove or fix the model intercept. If the intercept should not be estimated, that must be specified separately and justified.
- Forgetting the prediction offset. A fitted model with an offset needs the corresponding new offsets to form valid predictions. Training offsets are not substitutes for offsets on new observations.
- Confusing an offset with an observation weight. An offset changes the linear predictor. A weight changes how an observation contributes to fitting. They have different roles.
For actuarial prediction work, offsets can encode exposure or a known multiplicative adjustment while regularization estimates the remaining effects. The modeling decision is substantive: use an offset only when its contribution and coefficient are genuinely known and intended to remain fixed. This topic is aligned with the SOA Exam PA (Predictive Analytics) syllabus.
Check Your Understanding
For each problem, use the stated link and offset definition, and keep the offset on the linear-predictor scale.
- A Poisson log-link model has baseline rate 0.04, exposure 25, and a binary predictor with coefficient \(\log(1.5)\). What is the expected count when the predictor equals one? (Answer: 1.5)
- A logistic model has offset \(\log(1/19)\), no additional intercept, and a binary coefficient \(\log(2)\). Calculate the fitted probability for predictor values zero and one, to four decimals. (Answer: 0.0500 and 0.0952)
- A Poisson model has baseline rate 0.03, exposure 50, known multiplier \(q=0.8\), and predictor coefficient \(\log(2)\). Find the expected count when the predictor equals one. (Answer: 2.4)
- A new Poisson prediction row has exposure 12, known multiplier 1.5, fitted baseline rate 0.02, and predictor contribution zero. State its offset and expected count. (Answer: offset \(\log(18)\); expected count 0.36)
- A model has offset \(o_i\), intercept \(\beta_0\), and estimated coefficients \(\beta\). Which parts are penalized by the usual elastic-net term, and why is the offset unchanged as \(\lambda\) varies? (Answer: the estimated predictor coefficients \(\beta\) are penalized; the fixed offset is not a parameter in the penalty.)