# \donttest{
library("xhaz")
data("breast")
# load the data sets 'breast'.
# Flexible mexhaz model: baseline excess hazard with cubic B-splines
# assumption on the life table available :
# other cause mortality in the cohort is comparable to the mortality
# observed in the general population with the same characteristics.
# The life table to be used is survexp.us. Note that SEX is coded 2 instead of female in survexp.us.
breast$sexe <- "female"
fit.haz <- exphaz(
formula = survival::Surv(temps, statut) ~ 1,
data = breast, ratetable = survexp.us,
only_ehazard = FALSE,
rmap = list(age = 'age', sex = 'sexe', year = 'date'))
breast$expected <- fit.haz$ehazard
breast$expectedCum <- fit.haz$ehazardInt
mod.bs <- mexhazLT(formula = survival::Surv(temps, statut) ~ agecr + armt,
data = breast,
ratetable = survexp.us, degree = 3,
knots=quantile(breast[breast$statut==1,]$temps, probs=c(1:2/3)),
expected = "expected",expectedCum = "expectedCum",
base = "exp.bs", pophaz = "classic")
mod.bs
BIC(mod.bs)
# }
Run the code above in your browser using DataLab