← All projects

Personal actuarial analytics project · 2026

Motor Insurance Claim-Count Modelling

An exposure-aware comparison of Poisson-family GLMs and XGBoost for insurance claim frequency, with validation-led selection, DHARMa diagnostics, calibration and explainability.

RPoisson GLMNegative binomialXGBoostDHARMaSHAP
CLAIM FREQUENCY / FREMTP L2VALIDATED
Zero-claim policies96.32%677,991 policies audited

Final test comparison

XGBoost Poisson0.2355 deviance0.3446 Gini
Nonlinear Poisson GLM0.2416 deviance0.2918 Gini
Aggregate A/E1.00008XGBoost final refit
26,444 observed claims0.0738 claims / policy-yearMore ranking power, calibration retained

Central question

Can statistical and machine-learning count models estimate claim frequency, rank policy risk and remain well calibrated on unseen policies?

01

Project overview

This project models annualised motor-insurance claim frequency as a count outcome. Exposure enters the GLMs through a log offset and the XGBoost model through its base margin, ensuring that policies observed for different lengths of time remain comparable.

The analysis separates data audit, exploratory work, model development, validation-based selection and final test reporting. Severity variables are kept outside the frequency models to prevent target leakage.

677,991policies audited

358,483 policy-years of exposure

96.32%zero-claim policies

Highly sparse count outcome

0.0738claims per policy-year

26,444 observed claims

0.3446test Gini

Final refit XGBoost

Evidence summary

Sparse claims, calibrated forecasts and a measurable ranking gain

The case study follows the complete modelling path from portfolio audit and GLM evolution to validation-led selection, test calibration, residual checks and explainability.

01 · Portfolio audit

More than 96% of policies recorded no claim

The outcome was a sparse count, making exposure-aware count modelling essential.
Bar chart showing 96.32 percent of policies with zero claims, 3.48 percent with one claim and 0.20 percent with two or more claims.
Audited portfolio and split structure
SamplePoliciesExposureClaimsClaim frequency
Full portfolio677,991358,482.8426,4440.07377
Training406,793214,928.9715,8680.07383
Validation135,59771,824.165,2920.07368
Test135,60171,729.705,2840.07367

What it showsAcross 677,991 policies and 358,483 policy-years, the portfolio recorded 26,444 claims. Zero claims were observed for 96.32% of policies, one claim for 3.48% and two or more for only 0.20%.

Why it mattersThe distribution rules out ordinary linear regression and explains the use of Poisson-family likelihoods and a Poisson XGBoost objective.

LimitationThe public freMTPL2 portfolio represents one insurance market and period. Model performance and feature relationships may not transfer unchanged to another book of business.

02 · GLM evolution

Exposure and nonlinear terms produced the useful GLM gains

Validation mean Poisson deviance, rather than training fit alone, guided model complexity.
Line chart of GLM validation mean Poisson deviance across seven development stages, showing the largest improvement after adding main effects and exposure.
Validation-led finalist selection
ModelMAERMSEPoisson devianceGiniA/E
XGBoost Poisson + exposure0.072130.205230.236340.344200.99536
Poisson nonlinear + exposure0.073090.207040.243210.289670.99817
Negative binomial + interactions0.073240.207050.243280.287970.99429

What it showsAdding rating factors and the exposure offset reduced validation deviance from about .252-.254 to .244. Nonlinear terms improved it further to .24321, while extra interactions produced no meaningful validation gain.

Why it mattersThe curve identifies where additional complexity stopped improving unseen-policy performance and supports the nonlinear Poisson model as the GLM finalist.

LimitationThe negative-binomial interaction model achieved the best training AIC and BIC, yet its validation deviance was slightly worse. Information criteria and held-out predictive performance answer different questions.

03 · Final test comparison

XGBoost improved risk ranking without losing aggregate calibration

Both finalists were refitted on training plus validation data before the untouched test set was scored.
Final-refit performance on 135,601 test policies
ModelPredicted claimsA/EMAERMSEDevianceGini
XGBoost Poisson5,283.591.000080.072000.201330.235540.34456
Nonlinear Poisson GLM5,285.750.999670.073010.202780.241560.29182
Calibration chart comparing observed and predicted claim frequency across test-set risk deciles for XGBoost and nonlinear Poisson GLM finalists.

What it showsXGBoost achieved test deviance .23554 and Gini .34456, compared with .24156 and .29182 for the nonlinear Poisson GLM. It predicted 5,283.6 claims against 5,284 observed, giving A/E = 1.00008.

Why it mattersThe machine-learning model produced a clear discrimination gain and retained portfolio-level calibration. Its RMSE advantage was smaller, so the benefit is mainly stronger risk ordering rather than a dramatic reduction in row-level error.

LimitationAggregate A/E can conceal local miscalibration. The decile chart should be monitored on new data, especially in the highest-risk segment where small deviations matter most.

04 · Explainability

Bonus-malus dominated the nonlinear model

Gain-based importance identifies the variables XGBoost used most strongly when splitting the portfolio.
Horizontal bar chart of XGBoost feature importance led by bonus-malus, driver age, log density and vehicle age.

What it showsBonus-malus contributed 47.3% of total split gain, followed by driver age at 13.8%, log density at 11.4% and vehicle age at 9.0%. The remaining individual features were much smaller.

Why it mattersThe ranking highlights the policy and driver characteristics most useful for separating low- and high-frequency risk within this dataset.

LimitationImportance is not an effect direction or a causal estimate. Correlated variables can share or displace importance, and rating factors require governance and fairness review before operational use.

05 · GLM diagnostics

Good calibration did not remove every residual concern

Simulation-based DHARMa checks were run on a representative training sample for the selected nonlinear Poisson GLM.
DHARMa diagnostic plots for the selected nonlinear Poisson GLM, including residual uniformity and residual versus predicted checks.
Selected GLM DHARMa tests
TestStatisticp-valueDecision at 5%
Uniformity0.01045.0755No concern flagged
Dispersion0.98937.8667No concern flagged
Zero inflation1.00322.0400Concern flagged
Outliers256< .001Concern flagged

What it showsUniformity (p = .076) and dispersion (p = .867) were not flagged at 5%. Zero inflation (p = .040) and outliers (p < .001) remained significant.

Why it mattersThe selected GLM is a useful transparent benchmark, yet its distributional assumptions do not fully reproduce rare or excess-zero behaviour in the data.

LimitationDHARMa was run on a representative sample for computational feasibility. Diagnostic significance should be combined with effect size, plots and out-of-sample behaviour rather than used as an automatic rejection rule.

02

Portfolio structure and modelling challenge

The audited portfolio contained 677,991 unique policies, 358,483 policy-years of exposure and 26,444 claims. Most policies recorded no claim, 3.48% recorded one claim and only 0.20% recorded two or more.

That sparsity makes ordinary linear regression unsuitable. The project compared exposure-aware Poisson specifications, quasi-Poisson and negative-binomial alternatives, then introduced XGBoost with a Poisson objective as a nonlinear comparator.

03

Validation-led model selection

The nonlinear Poisson GLM was the best GLM on validation mean Poisson deviance. The negative-binomial interaction model achieved the lowest in-sample AIC and BIC, yet it did not generalise as well on the validation criterion. This distinction prevented an in-sample fit statistic from deciding the final model.

XGBoost ranked first on validation data and was therefore refitted on the combined training and validation sample before the untouched test set was evaluated.

04

Final test result

On 135,601 test policies, final-refit XGBoost predicted 5,283.6 claims against 5,284 observed, giving an actual-to-expected ratio of 1.00008. It achieved MAE 0.0720, RMSE 0.2013, mean Poisson deviance 0.2355 and normalised Gini 0.3446.

The final nonlinear Poisson GLM was also well calibrated at portfolio level, with an actual-to-expected ratio of 0.99967. Its test deviance was 0.2416 and Gini was 0.2918. XGBoost therefore added more ranking power while preserving aggregate calibration, although its raw-error advantage was modest.

05

Diagnostics, interpretation and governance

DHARMa checks for the selected GLM found no uniformity or dispersion concern at the 5% level, while zero-inflation and outlier tests remained significant. This means good portfolio-level calibration does not remove all distributional misspecification.

Bonus-malus score was the strongest XGBoost feature, followed by driver age, log population density and vehicle age. These rankings describe predictive contribution rather than causal effects and should be monitored for stability and fairness before operational pricing use.

People behind the project

Project contributors

Project lead and actuarial data analyst

Toni Cata

Next project

Bitcoin Volatility Forecasting

View report