8.4 One-Way, Two-Way & Partial Dependence Exhibits
Key Takeaways
- The one-way exhibit — observed and fitted values by level of a predictor, with exposure bars behind them — is the workhorse diagnostic and presentation graphic of a GLM build.
- A one-way plot of the raw target shows the univariate relationship, while the fitted line shows the GLM's estimate after other variables are controlled; a gap between them is informative, not an error.
- Partial residual plots are the standard tool for detecting non-linearity in a continuous predictor already in the model.
- Two-way exhibits, with one predictor on the axis and a second as separate series, are how an interaction is discovered and how it is explained.
- Partial dependence plots generalise the one-way exhibit to any model but assume predictor independence, so with strongly correlated predictors they average over combinations that never occur.
The One-Way Exhibit
If a PCPA candidate builds only one kind of graphic, it should be this one. It serves as an exploratory diagnostic, a model-checking tool, and a presentation exhibit, and it appears in nearly every actuarial rate indication.
Construction:
- Group the data by level of the predictor — categorical levels, or bands of a continuous variable.
- Within each group compute exposure, the observed statistic (frequency, severity or pure premium), and the fitted value from the model.
- Plot observed and fitted as lines or points on the primary axis.
- Plot exposure as bars on a secondary axis, behind the lines.
Read it for four things:
| What you see | What it means |
|---|---|
| Fitted tracks observed closely | The model captures this variable's effect |
| Systematic gap in one region | Missing non-linearity, or an omitted interacting variable |
| Observed bounces wildly where bars are short | Thin data — do not read a pattern into it |
| Observed and fitted diverge in direction | A genuine problem: check coding, base level, or a correlated predictor |
[!WARNING] Observed and fitted are not supposed to be identical. The observed line is the raw univariate average; the fitted line is the model's estimate of this variable's effect after controlling for everything else. If territory correlates with vehicle type, the GLM will and should produce a flatter territory effect than the one-way average. That difference is the whole point of a multivariate model, and explaining it is one of the more valuable sentences you can write.
Detecting Non-Linearity: Partial Residual Plots
A one-way plot of the raw target shows the relationship before the model. To ask whether a continuous predictor already in the model has been given the right functional form, use a partial residual plot.
The partial residual for predictor $x_j$ adds back that predictor's fitted contribution to the working residual:
Plotting the partial residuals against $x_j$ isolates the relationship between that predictor and the response with all other predictors held fixed. If the term is correctly specified, the plot shows a straight line of slope $\hat{\beta}_j$. Curvature means the linear term is wrong, and the remedies are the familiar ones: a polynomial term, a piecewise-linear function, a spline, or banding the variable into a categorical.
Because the plot is one point per record, it is usually smoothed or bucketed before reading.
Two-Way Exhibits and Interactions
An interaction exists when the effect of one predictor depends on the level of another. The exhibit that reveals it puts one predictor on the x-axis and shows a separate series for each level of the second.
| Pattern | Interpretation |
|---|---|
| Series are roughly parallel on the log scale | No interaction; a multiplicative model with two main effects is adequate |
| Series converge, diverge, or cross | Interaction: the effect of the first predictor differs by level of the second |
The classic P&C examples are driver age by territory, age by vehicle class in personal auto, and construction class by protection class in property. Because a log-link GLM is multiplicative, "parallel on the log scale" is the right test — two series can visibly diverge on a dollar scale while being perfectly proportional.
Two cautions. First, every interaction costs degrees of freedom — a five-level by four-level interaction adds twelve parameters — so the cells must have enough exposure. Second, a two-way exhibit built on thin cells will show an apparent interaction that is noise; always show the cell exposures alongside.
Partial Dependence Plots
A partial dependence plot (PDP) generalises the one-way fitted line to any model, including ones with no coefficients to read. For a predictor $x_S$:
The recipe: set the predictor of interest to a fixed value for every record, leave all other predictors at their actual values, score the whole data set, and average the predictions. Repeat across the range of the predictor.
For a GLM this simply retraces the fitted relativities, which is why the direct coefficient table is usually the better exhibit. The PDP earns its place when a model's structure cannot be read off coefficients, or when several models must be compared on a common footing.
Individual conditional expectation (ICE) curves are the same computation without the averaging — one curve per record. They reveal heterogeneity that the average conceals: if half the curves rise and half fall, the PDP can look flat while the predictor matters enormously in opposite directions for different risks. That pattern is itself evidence of an interaction worth modelling.
The Correlated-Predictor Caveat
PDP and ICE both assume the predictor of interest can be varied independently of the others. When predictors are strongly correlated, the averaging step evaluates the model at combinations that do not occur in reality — a 19-year-old driver assigned a retiree's vehicle and tenure profile — and the model is being extrapolated outside its data.
The practical defences: check the correlation structure before trusting a PDP, restrict the plotted range to where data actually exists, inspect ICE curves rather than only the average, and prefer exhibits built on observed cells when the predictors are heavily entangled.
Choosing Among Them
| Question | Exhibit |
|---|---|
| What does the raw data say about this variable? | One-way observed, with exposure |
| Has the model captured this variable? | One-way observed vs. fitted |
| Is this continuous term the right shape? | Partial residual plot |
| Does this variable's effect depend on another? | Two-way exhibit, or ICE curves |
| What does this model say about this variable, independent of its form? | Partial dependence plot |
For a PCPA project constrained to five exhibits, the one-way observed-versus-fitted plot for the most important rating variable and a two-way exhibit for a modelled interaction typically carry more rubric credit than any model-agnostic alternative.
A one-way exhibit shows the observed frequency for Territory 3 at 1.62 times the base level while the GLM fitted relativity is 1.40. What is the most likely explanation?
A partial residual plot for vehicle age, currently entered as a single linear term, shows clear curvature. What does this indicate and what is the standard remedy?
Why can a partial dependence plot be misleading when two predictors are correlated at 0.95?