# \donttest{
# load the data set in the package
library("survival")
library("numDeriv")
library("survexp.fr")
breast$sexe <- "female"
fit.haz <- exphaz(
formula = 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.bs3 <- mexhazLT(formula = 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", random ="hosp")
mod.bs3
mod.bs4 <- mexhazLT(formula = 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 = "rescaled", random = "hosp")
mod.bs4
anova(mod.bs3, mod.bs4)
# }
Run the code above in your browser using DataLab