Learn R Programming

actuaRE: Handling Single-Level and Hierarchically Structured Risk Factors using Credibility and Random Effects Models

Fits random effects models for multi-level/high-cardinality factors using credibility theory (Buhlmann-Straub for single-level, Jewell for hierarchical structures), GLM extensions following Ohlsson (2008) doi:10.1080/03461230701878612, or Tweedie generalized linear mixed models. Provides functions for model fitting, visualization, and prediction. See Campo, B.D.C. and Antonio, K. (2023) doi:10.1080/03461238.2022.2161413.

Installation

On current R (>= 3.0.0)

  • Development version from Github:
library("devtools"); install_github("BavoDC/actuaRE", dependencies = TRUE, build_vignettes = TRUE)

(This requires devtools >= 1.6.1, and installs the "master" (development) branch.) This approach builds the package from source, i.e. make and compilers must be installed on your system -- see the R FAQ for your operating system; you may also need to install dependencies manually. Specify build_vignettes=FALSE if you have trouble because your system is missing some of the LaTeX/texi2dvi tools.

Documentation

The basic functionality of the package is explained and demonstrated in the vignette, which you can access using

vignette("actuaRE")

or via the homepage of the package.

Citation

If you use this package, please cite:

  • Campo, B.D.C. and Antonio, Katrien (2023). Insurance pricing with hierarchically structured data an illustration with a workers' compensation insurance portfolio. Scandinavian Actuarial Journal, doi: 10.1080/03461238.2022.2161413
  • Campo, B.D.C. (2026). The actuaRE package: Handling Single-Level and Hierarchically Structured Risk Factors using Credibility and Random Effects Models. R package version 1.0.0, https://cran.r-project.org/package=actuaRE

Copy Link

Version

Install

install.packages('actuaRE')

Monthly Downloads

422

Version

1.0.0

License

GPL (>= 3)

Maintainer

De Cock Bavo

Last Published

February 27th, 2026

Functions in actuaRE (1.0.0)

predict.hierCredGLM

Model predictions
isNested

Is f1 nested within f2?
predict.hierCredTweedie

Model predictions
hierCredibility

Hierarchical credibility model of Jewell
plotRE

Visualizing the random effect estimates using ggplot2
modular

Modular Functions for Mixed Model Fits
hierCredibility-class

Class "hierCredibility" of fitted hierarchical credibility models
predict.hierCredibility

Model predictions
is.formula

Formula
nobars

Omit terms separated by vertical bars in a formula
weights-actuaRE

Extract the model weights
ranef-actuaRE

Extract the random effect estimates from a fitted random effects model
tweedieGLMM

Fitting a Tweedie GLMM, using initial estimates from credibility models
print.BalanceProperty

Print method for an object of class BalanceProperty
simulatedclustereddata

Simulated data sets to illustrate the package functionality
ranef

Extract the modes of the random effects
adjustIntercept

Adjust the intercept to regain the balance property
predict.buhlmannStraubTweedie

Class "buhlmannStraubTweedie" of fitted Buhlmann-Straub GLM credibility models
NrUnique

Number of unique elements in a vector
buhlmannStraub

Buhlmann-Straub credibility model
predict.buhlmannStraub

Class "buhlmannStraub" of fitted Buhlmann-Straub credibility models
BalanceProperty

Balance property
buhlmannStraubTweedie

Combining the Buhlmann-Straub credibility model with a Tweedie GLM (Ohlsson, 2008)
actuaRE-package

tools:::Rd_package_title("actuaRE")
predict.buhlmannStraubGLM

Class "buhlmannStraubGLM" of fitted Buhlmann-Straub GLM credibility models
buhlmannStraubGLM

Combining the Buhlmann-Straub credibility model with a GLM (Ohlsson, 2008)
.addREs

Add random effects to the data frame
hierCredGLM

Combining the hierarchical credibility model with a GLM (Ohlsson, 2008)
hierCredTweedie-class

Class "hierCredTweedie" of fitted random effects models estimated with Ohlsson's GLMC algorithm
fixef-actuaRE

Extract the fixed-effects estimates from a fitted random effects model
dataCar

data Car
hachemeisterLong

Hachemeister Data Set
hierCredTweedie

Combining the hierarchical credibility model with a GLM (Ohlsson, 2008)
hierCredGLM-class

Class "hierCredGLM" of fitted random effects models estimated with Ohlsson's GLMC algorithm
fixef

Extract fixed-effects estimates
findbars

Determine random-effects expressions from a formula