Fit a random effects model using Ohlsson's methodology. In this function you explicitly specify the power parameter p. See hierCredTweedie when you also want to estimate the p.

hierCredGLM(
  formula,
  data,
  weights,
  p = 1.5,
  link.power = 0,
  muHatGLM = TRUE,
  epsilon = 1e-04,
  maxiter = 500,
  maxiterGLM = 500,
  verbose = FALSE,
  returnData = TRUE,
  balanceProperty = TRUE,
  y = TRUE,
  ...
)

Arguments

formula

object of type formula that specifies which model should be fitted. Syntax is the same as for lmer and glmer. For example, Yijkt ~ x1 + x2 + (1 | Industry / Branch).

data

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

weights

variable name of the exposure weight.

p

the value for the power parameter of the Tweedie distribution, which is passed to tweedie. Default is 1.5.

index of power link function, which is passed to tweedie. link.power = 0 produces a log-link. Defaults to the canonical link, which is 1 - p.

muHatGLM

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

epsilon

positive convergence tolerance \(\epsilon\); the iterations converge when 7 \(||\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.

maxiterGLM

maximum number of iterations when fitting the GLM part. Passed to glm.

verbose

logical indicating if output should be produced during the algorithm.

returnData

logical indicating if input data has to be returned.

balanceProperty

logical indicating if the balance property should be satisfied.

y

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

...

arguments passed to glm

Value

An object of type hierCredGLM with the following slots:

call

the matched call

HierarchicalResults

results of the hierarchical 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.

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.

Examples

# \donttest{
data("dataCar")
fit = hierCredGLM(Y ~ area + (1 | VehicleType / VehicleBody), dataCar, weights = w,
p = 1.7)
fit
#> Call:
#> hierCredGLM(formula = Y ~ area + (1 | VehicleType/VehicleBody), 
#>     data = dataCar, weights = w, p = 1.7)
#> 
#> 
#> Combination of the hierarchical credibility model with a GLM
#> 
#> Estimated variance parameters:
#>   Var(V[jk]): 349.7505 
#>   Var(V[j]): 629.4394 
#> Unique number of categories of VehicleType: 2
#> Unique number of categories of VehicleBody: 9
#> 
#> Results contract-specific risk factors:
#> 
#> 
#> Call:  glm(formula = FormulaGLM, family = tweedie(var.power = p, link.power = 0), 
#>     data = data, weights = data$wijkt, model = T, y = T)
#> 
#> Coefficients:
#> (Intercept)        areaB        areaC        areaD        areaE        areaF  
#>     5.63463      0.04712      0.07701     -0.18517      0.13033      0.46341  
#> 
#> Degrees of Freedom: 67565 Total (i.e. Null);  67560 Residual
#> Null Deviance:	    1403000 
#> Residual Deviance: 1400000 	AIC: NA
summary(fit)
#> Call:
#> hierCredGLM(formula = Y ~ area + (1 | VehicleType/VehicleBody), 
#>     data = dataCar, weights = w, p = 1.7)
#> 
#> 
#> Combination of the hierarchical credibility model with a GLM
#> 
#> Estimated variance parameters:
#>   Individual contracts: 4290291 
#>   Var(V[jk]): 349.7505 
#>   Var(V[j]): 629.4394 
#> Unique number of categories of VehicleType: 2
#> Unique number of categories of VehicleBody: 9
#> 
#> Results contract-specific risk factors:
#> 
#> 
#> Call:
#> glm(formula = FormulaGLM, family = tweedie(var.power = p, link.power = 0), 
#>     data = data, weights = data$wijkt, model = T, y = T)
#> 
#> Coefficients:
#>             Estimate Std. Error t value Pr(>|t|)    
#> (Intercept)  5.63463    0.08794  64.075   <2e-16 ***
#> areaB        0.04712    0.13009   0.362   0.7172    
#> areaC        0.07701    0.11713   0.658   0.5108    
#> areaD       -0.18517    0.15477  -1.196   0.2315    
#> areaE        0.13033    0.16747   0.778   0.4364    
#> areaF        0.46341    0.19218   2.411   0.0159 *  
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> (Dispersion parameter for Tweedie family taken to be 314.1876)
#> 
#>     Null deviance: 1403377  on 67565  degrees of freedom
#> Residual deviance: 1400154  on 67560  degrees of freedom
#> AIC: NA
#> 
#> Number of Fisher Scoring iterations: 11
#> 
ranef(fit)
#> $sector
#> Key: <VehicleType>
#>         VehicleType        Uj
#>              <char>     <num>
#> 1:   Common vehicle 0.9573893
#> 2: Uncommon vehicle 1.0525247
#> 
#> $group
#> Key: <VehicleType, VehicleBody>
#>         VehicleType VehicleBody       Ujk
#>              <char>      <char>     <num>
#> 1:   Common vehicle       HBACK 1.0252939
#> 2:   Common vehicle       SEDAN 0.9528740
#> 3:   Common vehicle         UTE 0.9971015
#> 4: Uncommon vehicle       COUPE 1.0233226
#> 5: Uncommon vehicle       HDTOP 1.0065053
#> 6: Uncommon vehicle       MIBUS 1.0042123
#> 7: Uncommon vehicle       PANVN 1.0023449
#> 8: Uncommon vehicle       STNWG 0.9836377
#> 9: Uncommon vehicle       TRUCK 1.0077063
#> 
fixef(fit)
#> (Intercept)       areaB       areaC       areaD       areaE       areaF 
#>  5.63463077  0.04712428  0.07701333 -0.18517287  0.13033063  0.46341174 
# }