Skip to contents

Hachemeister's regression model, as actuar::cm(~risk, regformula = formula, regdata = data): risk i in period t has ratio X_it with weight w_it and a mean on a design shared by the risks (a trend line ~ time, say). Each risk's own weighted least squares fit is shrunk towards the collective by a credibility matrix. estimator applies only with adjust_intercept = TRUE, whose formula must have an intercept as its first column; at the origin the between covariance is always Hachemeister's iterative estimator, as in actuar.

Usage

hachemeister(
  ratios,
  weights = NULL,
  formula = ~time,
  data = data.frame(time = seq_len(ncol(ratios))),
  estimator = c("unbiased", "iterative"),
  adjust_intercept = FALSE,
  tol = sqrt(.Machine$double.eps),
  max_iter = 100
)

hachemeister_fit(
  collective = numeric(0),
  coefficients = NULL,
  individual = NULL,
  credibility = NULL,
  between = NULL,
  within_variance = numeric(0),
  risk_weights = numeric(0),
  transition = NULL,
  iterations = numeric(0),
  terms = NULL
)

Arguments

ratios

A matrix, one row per risk and one column per period; NA for a missing cell.

weights

A matrix of the same shape with NA in the same places, or NULL for equal weights.

formula

A one-sided formula for the design, evaluated in data.

data

A data frame with one row per period; by default time = 1, 2, ....

estimator

"unbiased" or "iterative".

adjust_intercept

Put the intercept at the barycentre of the periods.

tol, max_iter

Tolerance and iteration limit of the iterations.

Value

A hachemeister_fit with properties collective (named by the design's columns), coefficients and individual (one row per risk), credibility (a p x p x risks array in the basis fitted), between, within_variance, risk_weights, transition (R with the design Y = Q R when adjusted, else NULL) and iterations; predict(fit, newdata) gives each risk's premium at each row of newdata.

Details

The method, its estimators and its reference are documented once, in the Rust reference.

Examples

x <- rbind(c(10, 12, 13, 15, 16), c(8, 8.5, 9.5, 9, 10), c(14, 13, 16, 17, 19))
fit <- hachemeister(x, adjust_intercept = TRUE)
fit@collective
#> (Intercept)        time 
#>    9.316667    1.116667 
predict(fit, data.frame(time = 6))
#>          [,1]     [,2]    [,3]
#> [1,] 17.54476 10.64054 19.8647