Learn R Programming

actuaRE (version 1.0.0)

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

Description

Fit a single-level random effects model using Ohlsson's methodology combined with Buhlmann-Straub credibility. This function estimates the power parameter p. For fixed p, see buhlmannStraubGLM.

Usage

buhlmannStraubTweedie(
  formula,
  data,
  weights,
  muHatGLM = FALSE,
  epsilon = 1e-04,
  maxiter = 500,
  verbose = FALSE,
  returnData = TRUE,
  cpglmControl = list(bound.p = c(1.01, 1.99)),
  balanceProperty = TRUE,
  optimizer = "bobyqa",
  y = TRUE,
  ...
)

Value

An object of type buhlmannStraubTweedie with the following slots:

call

the matched call

CredibilityResults

results of the Buhlmann-Straub credibility model.

fitGLM

the results from fitting the GLM part.

iter

total number of iterations.

Converged

logical indicating whether the algorithm converged.

LevelsCov

object that summarizes the unique levels of each of the contract-specific covariates.

fitted.values

the fitted mean values, resulting from the model fit.

prior.weights

the weights (exposure) initially supplied.

y

if requested, the response vector. Default is TRUE.

Arguments

formula

object of type formula that specifies which model should be fitted. Syntax follows lmer: e.g., Y ~ x1 + x2 + (1 | Cluster). Only one random effect is allowed.

data

an object that is coercible by as.data.table, containing the variables in the model.

weights

variable name of the exposure weight.

muHatGLM

indicates which estimate has to be used in the algorithm for the intercept term. Default is TRUE, which uses the intercept as estimated by the GLM. If FALSE, the estimate of the Buhlmann-Straub credibility model is used.

epsilon

positive convergence tolerance \(\epsilon\); the iterations converge when \(||\theta[k] - \theta[k - 1]||^2_2/||\theta[k - 1]||^2_2 < \epsilon\). Here, \(\theta[k]\) is the parameter vector at the \(k^{th}\) iteration.

maxiter

maximum number of iterations.

verbose

logical indicating if output should be produced during the algorithm.

returnData

logical indicating if input data has to be returned.

cpglmControl

a list of parameters to control the fitting process in the GLM part. By default, cpglmControl = list(bound.p = c(1.01, 1.99)) which restricts the range of the power parameter p to [1.01, 1.99] in the fitting process. This list is passed to cpglm.

balanceProperty

logical indicating if the balance property should be satisfied.

optimizer

a character string that determines which optimization routine is to be used in estimating the index and the dispersion parameters. Possible choices are "nlminb" (the default, see nlminb), "bobyqa" (bobyqa) and "L-BFGS-B" (optim).

y

logical indicating whether the response vector should be returned as a component of the returned value.

...

arguments passed to cpglm.

Details

When estimating the GLM part, this function uses the cpglm function from the cplm package.

References

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

Ohlsson, E. (2008). Combining generalized linear models and credibility models in practice. Scandinavian Actuarial Journal 2008(4), 301–314.

See Also

buhlmannStraubTweedie-class, buhlmannStraub, buhlmannStraubGLM, hierCredTweedie, cpglm, plotRE, adjustIntercept, BalanceProperty

Examples

Run this code
# \donttest{
data("hachemeister", package = "actuar")
X = as.data.frame(hachemeister)
Df = reshape(X, idvar = "state",
             varying = list(paste0("ratio.", 1:12), paste0("weight.", 1:12)),
             direction = "long")
Df$time_factor = factor(Df$time)
fit = buhlmannStraubTweedie(ratio.1 ~ time_factor + (1 | state), Df,
                            weights = weight.1, epsilon = 1e-6)
summary(fit)
ranef(fit)
fixef(fit)
# }

Run the code above in your browser using DataLab