library(actuar)
library(actuaRE)
data("hachemeister", package = "actuar")
# Prepare data
X = as.data.frame(hachemeister)
Df = reshape(X, idvar = "state",
varying = list(paste0("ratio.", 1:12), paste0("weight.", 1:12)),
direction = "long")
# Fit Buhlmann-Straub model
fitBS = buhlmannStraub(ratio.1, weight.1, state, Df)
summary(fitBS)
# Compare with actuar package
fit <- cm(~state, hachemeister, ratios = ratio.1:ratio.12,
weights = weight.1:weight.12)
summary(fit)
Run the code above in your browser using DataLab