Model Fit
Study guides: Exam MAS-I, Exam 8
Model Fit is how closely a fitted model's predictions agree with the observed outcomes. For a generalized linear model, the fit is summarized by the scaled deviance, which is
D^* = 2\left[l_{\text{sat}} - l_{\text{model}}\right]
l_{\text{sat}}is the maximized log-likelihood of the saturated model.l_{\text{model}}is the maximized log-likelihood of the fitted model.
The deviance is D = \phi D^*, so the scaled deviance is the deviance divided by the dispersion parameter \phi. The deviance measures how far the model is from the saturated model, so a smaller deviance means a better fit and a large deviance a poor one.
A Poisson GLM has maximized log-likelihood
-1480, and the saturated model has-1350. What is the model's deviance?
- The scaled deviance is
D^* = 2[-1{,}350 - (-1{,}480)] = 260.- A Poisson model has
\phi = 1, so the deviance is alsoD = 260.
The null model and the saturated model
The fit of every model lies between two extremes:
- The null model has only an intercept, and it predicts the mean of the response,
\bar{y}, for every record. Its deviance is the null deviance. - The saturated model has as many linearly independent parameters as records. It reproduces every observed response exactly, so its linear predictor is
g(y_i)for each record, whatever the linkg. Its deviance is zero.
Deviance and added parameters
Adding a parameter to a model never raises its deviance. A lower deviance alone is therefore not a reason to adopt a more complex model, because it would always favour the largest model and lead to overfitting. Nested models are compared by a likelihood ratio test of the added parameters, and any models by a criterion that charges for each parameter, such as AIC or BIC.
A Poisson frequency GLM on 20,000 policies has null deviance 9,840. Adding 11 rating-variable parameters lowers the deviance to 9,312. Are the variables significant?
- For a Poisson model
\phi = 1, so the drop in deviance is the likelihood ratio statistic,9{,}840 - 9{,}312 = 528.- The statistic has 11 degrees of freedom, and
\chi^2_{0.05,\,11} = 19.68.528 > 19.68, so the variables are significant.- They explain only
528/9{,}840 = 5.4\%of the null deviance, which is usual for claim counts, where most of the variation is random.
Diagnostic plots of fit
The diagnostic plots show where a model fits badly:
- A residual plot against the fitted values shows a trend when the mean is misspecified and a fan when the variance function is wrong.
- A marginal model plot overlays a smooth of the observed response and a smooth of the fitted values against each predictor. The two agree when the model captures that predictor's relationship and separate when structure is missing.
- A QQ plot of the deviance residuals should track the reference line with only small random departures, because the deviance residuals of a correct model follow the assumed distribution.
When the deviance residuals of a Gamma severity model rise above the line at the high end, the claims are more right-skewed than the Gamma captures. A distribution with a heavier right tail, such as the inverse Gaussian, is the natural alternative.
Actual-to-predicted ratio
A rating model's fit is checked on a holdout sample by grouping the records and comparing actual with predicted losses in each group. The actual-to-predicted ratio of a group is
\frac{\text{total actual losses}}{\text{total predicted losses}}
A ratio near 1 indicates a good fit in that group. The fit is judged by how far the ratio is from 1, not by the dollar size of the gap. A better model has ratios close to 1 in every group, such as every quantile of the prediction. An overall ratio near 1 only shows that the total predicted equals the total actual, and it can hide errors that offset at the two ends.
On holdout data, a pure premium model's predicted and actual losses are compared by vehicle age band. Where does the model fit badly?
Vehicle age Predicted Actual 0 to 3 years 1,200,000 1,236,000 4 to 7 years 1,500,000 1,470,000 8 to 11 years 900,000 882,000 12 years and over 400,000 460,000
- The actual-to-predicted ratios are 1.03, 0.98, 0.98 and 1.15.
- Overall, the ratio is
4{,}048{,}000/4{,}000{,}000 = 1.012, so the model is balanced in total.- The model under-predicts the oldest vehicles by 15%, which is where it fits badly.
Model stability
Model stability is the sensitivity of a model's results, such as its relativities, to small changes in the data, such as removing or adding a few records. A record with a large Cook's distance is highly influential, because the parameter estimates change materially when it is removed. Estimates that change across cross-validation folds or bootstrap samples show a fit that may not hold on new data.
Choosing the model with the lowest deviance The deviance never rises when a parameter is added, so the model with the most parameters always has the lowest deviance. Compare models with a likelihood ratio test or with AIC or BIC, which account for the added parameters.