Machine Learning Models for Predicting Claim Counts

Prediction of claim counts using the feature based development factors introduced in the manuscript Hiabu M., Hofman E. and Pittarello G. (2023) . Implementation of Neural Networks, Extreme Gradient Boosting, and Cox model with splines to optimise the partial log-likelihood of proportional hazard models.


CRAN-ready checks DOI

ReSurv

ReSurv predicts incurred-but-not-reported (IBNR) claim counts from individual claims data. It links reverse-time proportional hazards to development factors, with Cox regression ("COX"), gradient boosting ("XGB"), and neural networks ("NN"). It includes simulation, preprocessing, cross-validation, prediction, and comparison with realized claim counts.

Installation

Install the development version with R 4.1 or later:

install.packages("remotes")
remotes::install_github("edhofman/ReSurv")

Neural networks use the native R torch backend. Before using hazard_model = "NN", install the optional package and its runtime:

install.packages("torch")
torch::install_torch()

Python and a virtual environment are no longer required. Cox and XGBoost models do not require torch.

Example

library(ReSurv)
claims <- data_generator(
  random_seed = 1964, scenario = "alpha", time_unit = 1,
  years = 4, period_exposure = 100
)
individual <- IndividualDataPP(
  claims, categorical_features = "claim_type",
  accident_period = "AP", calendar_period = "RP",
  input_time_granularity = "years", output_time_granularity = "years",
  years = 4
)
fit <- ReSurv(individual, hazard_model = "COX", eta = 0)
prediction <- predict(fit)
summary(prediction)
head(predictReserve(fit, granularity = "output"))

The reserve table contains accident period (AP), development period (DP), calendar period (CP), and predicted count (IBNR). Periods start at one and CP = AP + DP - 1. Preprocessing retains the observed upper triangle for fitting; the development horizon is controlled by years.

ReSurvCV() selects NN or XGB hyperparameters. Pass its hparameters.best component to ReSurv() to fit the selected model. Score_Reserving() compares models against realized claims and optionally adds chain-ladder and clmplus benchmarks. See the getting-started article on the documentation website and the R help pages for parameters and return values. The vignette source is vignettes/getting-started.Rmd in this repository.

Reference

Hiabu, M., Hofman, E., and Pittarello, G. (2023). A machine learning approach based on survival analysis for IBNR frequencies in non-life reserving. doi:10.48550/arXiv.2312.14549.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("ReSurv")

1.1.0 by Emil Hofman, a month ago


https://github.com/edhofman/ReSurv, https://edhofman.github.io/ReSurv/


Report a bug at https://github.com/edhofman/ReSurv/issues


Browse source code at https://github.com/cran/ReSurv


Authors: Emil Hofman [aut, cre, cph] , Gabriele Pittarello [aut, cph] (ORCID: , Munir Hiabu [aut, cph]


Documentation:   PDF Manual  


GPL (>= 2) license


Imports stats, dplyr, actuar, fastDummies, data.table, purrr, tidyr, ggplot2, lubridate, survival, SynthETIC, xgboost

Suggests bshazard, clmplus, knitr, torch, rmarkdown, rpart, testthat


See at CRAN