Skip to contents

Adjust the intercept of a log-link GLM returned by refit() to multiply its response-scale predictions by a specified factor while preserving tariff relativities. Apply this adjustment after all refinement decisions are complete.

Usage

adjust_intercept(model, factor)

Arguments

model

A fitted refined GLM returned by refit(). It must inherit from refitrestricted or refitsmooth and use a log link.

factor

Positive finite numeric scalar. 1 retains the prediction level, values above 1 increase it, and values below 1 decrease it.

Value

A fitted glm that also inherits from calibrated_model. Attributes calibration_factor, calibration_original_intercept, calibration_intercept, calibration_log_shift, calibration_call and calibrated_at record the calibration.

Details

For a refined GLM with a log link, calibration adds log(factor) to the intercept. Consequently, every response-scale prediction is multiplied by factor, while all non-intercept coefficients and tariff relativities remain unchanged.

The returned object is a copied, internally consistent fitted model. Its coefficients, linear predictors, fitted values, working residuals, deviance and AIC are updated to the calibrated level. The original refined model is not modified. Calibration metadata store the factor, log shift, original and calibrated intercept, creation time and call.

Refinement and calibration

Model refinement changes or constrains the relative tariff structure and is evaluated through prepare_refinement(), one or more add_*() operations, and refit(). Model calibration changes only the final overall level. A calibrated model cannot be calibrated again or used as the starting point for further refinement. Retain the rating_refinement specification and recalibrate a newly refitted model if earlier decisions need to be revised.

Examples

restrictions <- data.frame(
  zip = c("0", "1", "2", "3"),
  zip_restricted = c(0.90, 1.00, 1.05, 1.10)
)

mod_initial <- glm(
  nclaims ~ zip + offset(log(exposure)),
  family = poisson(),
  data = MTPL
)

mod_refined <- mod_initial |>
  prepare_refinement() |>
  add_restriction(restrictions) |>
  refit(intercept_only = TRUE)

mod_calibrated <- adjust_intercept(mod_refined, factor = 1.05)

rating_table(mod_calibrated)
#>      risk_factor       level est_mod_calibrated
#> 1    (Intercept) (Intercept)           0.138615
#> 2 zip_restricted           0           0.900000
#> 3 zip_restricted           1           1.000000
#> 4 zip_restricted           2           1.050000
#> 5 zip_restricted           3           1.100000

evaluation <- extract_model_data(mod_refined)
predictions <- add_prediction(
  evaluation, mod_refined, mod_calibrated,
  predictions = c("expected_claim_count_before", "expected_claim_count_after")
)
# These are expected counts over each record's exposure, not premiums.
with(predictions, sum(expected_claim_count_after) / sum(expected_claim_count_before))
#> [1] 1.05