Why Exposure and Weighting Need Careful Comparisons
Two candidate models can be fitted to the same rows and still answer different questions. A count model that accounts for how long each policy was observed estimates a rate per unit of exposure; a model that ignores exposure may instead predict the number of claims over the observed periods. Likewise, a fitting weight can change which observations matter most to an algorithm. A comparison is meaningful only after the target, exposure treatment, and weighting scheme are made explicit.
This tutorial focuses on how to compare generalized linear models (GLMs) and tree models when exposure or observation importance varies. The key distinction is that a GLM offset enters its linear predictor in a specified way, while a tree usually handles related information through a response transformation, case weights, or a modeling design chosen for that tree. These approaches may sometimes target the same rate, but they are not automatically equivalent.
Offsets in a Poisson Count GLM
Suppose \(N_i\) is a count observed over known exposure \(e_i>0\), such as policy-years, and \(x_i\) is a vector of predictors. Assume, conditional on the predictors and exposure, that \(N_i\) has a Poisson distribution with mean \(e_i\lambda_i\), where \(\lambda_i>0\) is the expected count per unit of exposure. With a log link, a GLM specifies \(\log(\lambda_i)=x_i^\top\beta\). Therefore,
The term \(\log(e_i)\) is an offset: its coefficient is fixed at one, rather than estimated as another regression coefficient. This encodes proportionality between expected count and exposure. It is appropriate when the exposure unit and the rate interpretation are substantively justified. It is not a general adjustment for every variable correlated with observation duration, nor does it establish that the rate is constant over the exposure period.
Worked Example: Applying a Poisson GLM Offset
A hypothetical insurer models claim counts using a Poisson GLM. Assume counts are conditionally independent with \(N_i\sim\operatorname{Poisson}(e_i\lambda_i)\), exposure is measured in policy-years, and the fitted rate model is \(\log(\lambda_i)=\beta_0+\beta_1x_i\). The fitted coefficients are \(\beta_0=\log(0.02)\) and \(\beta_1=\log(1.5)\). For a record with \(x_i=1\) and \(e_i=2\) policy-years, find the fitted rate and expected count.
Method. First calculate the rate from the predictor part of the model. Here \(x_i^\top\beta=\log(0.02)+\log(1.5)=\log(0.03)\), so \(\hat\lambda_i=0.03\) claims per policy-year.
Apply exposure. The offset adds \(\log(2)\) to the linear predictor for the count mean. Thus \(\log(\widehat{E[N_i]})=\log(2)+\log(0.03)=\log(0.06)\), giving \(\widehat{E[N_i]}=0.06\) claims.
Check. Expected count equals exposure times rate: \(2(0.03)=0.06\). The rate remains \(0.03\) per policy-year; it is not the predicted count. A common mistake is to report \(0.03\) as the expected count or to multiply by exposure twice.
Why Exposure Weighting Can Represent the Same Poisson Rate Fit
For the Poisson model above, the likelihood provides a precise connection between an offset formulation and a weighted rate formulation. Assume independent counts \(N_i\sim\operatorname{Poisson}(e_i\lambda_i)\) and, for this derivation, consider one common rate \(\lambda>0\) for all records. Ignoring terms that do not depend on \(\lambda\), the log-likelihood is
The first sum on the right is constant with respect to \(\lambda\). For a positive total count, differentiate the remaining terms and set the derivative to zero:
The same result follows by defining each observed rate as \(R_i=N_i/e_i\) and fitting a common rate using exposure weights \(e_i\) under the Poisson rate loss. Indeed, the rate-scale loss, up to terms independent of \(\lambda\), is \(\sum_i e_i(\lambda-R_i\log\lambda)\). Its derivative is \(\sum_i e_i-\sum_i e_iR_i/\lambda\), and \(e_iR_i=N_i\). Setting that derivative to zero gives the same estimate. Thus an exposure-weighted rate fit can reproduce the Poisson count likelihood’s rate estimate in this constant-rate setting.
This equivalence does not mean that every weighted tree and every offset GLM are the same model. It depends on the response, loss, weights, and implementation matching this likelihood relationship. In particular, a tree may use a different split criterion, leaf estimate, or interpretation of supplied weights.
Worked Example: Estimating a Common Rate From Unequal Exposure
A hypothetical portfolio has two groups. Assume independent Poisson claim counts with a common rate \(\lambda>0\) per unit of exposure. Group A has exposure \(e_1=1\) and count \(N_1=0\); Group B has exposure \(e_2=3\) and count \(N_2=3\). Find the common rate estimate, and explain why averaging the two observed rates without weights is inappropriate for the Poisson likelihood.
Method. The total count is \(N_1+N_2=0+3=3\). The total exposure is \(e_1+e_2=1+3=4\). The likelihood estimate is therefore \(\hat\lambda=3/4=0.75\) claims per exposure unit.
Check by the rate-scale loss. The observed rates are \(R_1=0/1=0\) and \(R_2=3/3=1\). The exposure-weighted rate is \(\{1(0)+3(1)\}/(1+3)=3/4=0.75\), agreeing with the count likelihood.
The unweighted average of the observed rates would be \((0+1)/2=0.50\). That calculation gives equal influence to groups with one and three exposure units, which is not the Poisson rate estimate. The common mistake is to average rates without accounting for the amount of exposure supporting each rate.
A boundary case is worth stating precisely. If the total count is zero, then for \(\lambda>0\) the likelihood is proportional to \(\exp(-\lambda\sum_i e_i)\). It increases as \(\lambda\) decreases toward zero. Over the parameter space \(\lambda>0\), the likelihood has a supremum at the boundary as \(\lambda\to0^+\), but does not attain it. If the parameter space is extended to \(\lambda\ge 0\), the maximum is attained at \(\lambda=0\). This distinction matters whenever a model’s stated parameter space excludes zero.
What a Tree Can—and Cannot—Do With Exposure
A GLM offset imposes a specific structure: on the log-mean scale, increasing exposure by a factor \(c\) increases the expected count by that same factor \(c\), while leaving the modeled rate unchanged. A standard tree does not generally include a term with a coefficient fixed at one. Supplying exposure as an ordinary predictor is different: the tree is free to split on it, and the resulting relationship need not be proportional.
A possible tree-based approach is to model the rate \(R_i=N_i/e_i\) and use exposure \(e_i\) as a case weight, provided the tree’s fitting criterion and leaf estimates are appropriate for that rate target. For a Poisson rate loss, the weighted formulation can match the likelihood contribution described above. But a software option called “weights” may have method-specific behavior: it may affect split selection, leaf estimates, or both, and its interpretation may not be identical across algorithms. Confirm the implementation rather than assuming that a weight argument creates an offset.
Another approach is to predict counts directly while supplying exposure as a predictor. This can be useful if the relationship is intentionally allowed to be flexible, but it no longer enforces the GLM’s proportional exposure structure. If the practical target is a rate, predictions should be converted and assessed on a consistent rate basis; if the target is a count over a specified exposure, predictions should correspond to that exposure.
Worked Example: Comparing Models With the Same Validation Weights
On a hypothetical validation set, three records have outcomes \(y=(2,4,10)\) and evaluation weights \(w=(1,1,3)\). Two models produce predictions A: \((3,5,8)\) and B: \((2,6,10)\). Using weighted root mean squared error, determine which model performs better for this weighted evaluation target. Treat the weights as nonnegative evaluation importance weights, not as exposure offsets.
Method. For predictions \(\hat y_i\), define weighted RMSE as \(\sqrt{\sum_i w_i(y_i-\hat y_i)^2/\sum_i w_i}\). The total weight is \(1+1+3=5\).
Model A. The errors are \(2-3=-1\), \(4-5=-1\), and \(10-8=2\). The weighted squared-error sum is \(1(1)+1(1)+3(4)=14\). Thus weighted MSE is \(14/5=2.8\), and weighted RMSE is \(\sqrt{2.8}=1.6733\), rounded to four decimals.
Model B. The errors are \(2-2=0\), \(4-6=-2\), and \(10-10=0\). The weighted squared-error sum is \(1(0)+1(4)+3(0)=4\). Thus weighted MSE is \(4/5=0.8\), and weighted RMSE is \(\sqrt{0.8}=0.8944\), rounded to four decimals.
Conclusion and check. Model B has the lower weighted RMSE for this stated validation target. Both models must be evaluated with the same rows, outcomes, weights, and formula. These evaluation weights do not imply that either model was fitted with those weights, and they do not make the weights equivalent to a GLM offset.
A Fair Cross-Model Comparison
When exposure or weights differ, write down the target before looking at a performance ranking. A comparison can be misleading if one model predicts counts over each record’s observed duration while another predicts rates, or if one model is judged with exposure-weighted loss and another with unweighted loss. Those are differences in estimand or evaluation, not necessarily evidence of an algorithmic advantage.
State whether the intended output is a count over a specified exposure, a rate per exposure unit, or another quantity. Use the same target for each candidate model.
Distinguish exposure used to define the count mean from sampling, importance, or frequency weights. Do not assume a model’s weight argument has the same interpretation as another model’s.
For the GLM, specify whether exposure enters as an offset and state the response distribution and link. For a tree, explain how exposure or weights enter the response, loss, splitting, or leaf calculation.
Use the same validation records, prediction target, and metric. Apply the intended evaluation weights consistently and report whether the resulting metric emphasizes records equally or emphasizes exposure or another population feature.
Common Traps and Interpretation Limits
- Using exposure as if it were an ordinary predictor. A predictor can be assigned a flexible relationship by a tree. An offset fixes the exposure coefficient at one on the log-mean scale. These encode different assumptions.
- Weighting rates by the wrong quantity. Under the Poisson rate setup, exposure weights yield the total-count divided by total-exposure estimate. An unweighted mean of group rates generally does not.
- Applying exposure twice. If a count prediction already uses \(\log(e_i)\) as an offset, multiplying that predicted count by exposure again is incorrect. The offset has already scaled the rate to the count mean.
- Calling every case weight an exposure adjustment. A sampling or business-importance weight may define a different target population or loss. Its purpose should be stated, and its fitting and evaluation use should not be conflated.
- Overstating equivalence. A tree fitted to rates with exposure weights can be aligned with a Poisson rate objective in a suitable setup. That fact does not establish that its splits, predictions, or assumptions match an offset GLM.
- Ignoring the zero-count boundary. For a strictly positive rate parameter, all-zero counts give a likelihood supremum approached as the rate tends to zero, not an attained maximum. A maximum at zero requires allowing zero in the parameter space.
Check Your Understanding
For each problem, identify the target and keep exposure adjustments distinct from general evaluation weights.
- A Poisson GLM has fitted rate \(0.025\) per exposure unit. A record has exposure \(4\) units. What is its fitted expected count? (Answer: \(0.10\) counts.)
- Two groups have independent Poisson counts with a common positive rate: counts \(2\) and \(0\), and exposures \(1\) and \(3\), respectively. What is the maximum-likelihood rate estimate over positive rates? (Answer: \(0.50\) per exposure unit.)
- Two records have Poisson counts \(1\) and \(4\), with exposures \(1\) and \(2\). Under a common-rate model, calculate the rate estimate and explain in one phrase why the larger-exposure record contributes more information. (Answer: \(5/3=1.6667\) per exposure unit; its count is supported by twice the exposure.)
- A validation set has outcomes \((0,2)\), predictions \((1,0)\), and evaluation weights \((1,3)\). Calculate weighted RMSE, rounded to four decimals. (Answer: \(\sqrt{13/4}=1.8028\).)
- All counts in a Poisson rate model are zero, total exposure is positive, and the parameter space is \(\lambda>0\). Does the likelihood attain a maximum? What changes if the space is extended to \(\lambda\ge0\)? (Answer: It does not attain a maximum over \(\lambda>0\); its supremum is approached as \(\lambda\to0^+\). Over \(\lambda\ge0\), the maximum is attained at \(\lambda=0\).)
The emphasis on aligned targets, defensible model comparisons, and clear limitations is aligned with the SOA Exam PA (Predictive Analytics) syllabus. In practice, documenting why exposure and weights were used is as important as reporting which candidate produced the smaller metric.