data(datCancer)
data(list.wicss)
don <- datCancer
don$agec <- don$age - 50 # using centered age for modelling
#-------------------- model with time and age
knots.t<-quantile(don$fu[don$dead==1],probs=seq(0,1,length=6)) # knots for time
knots.agec<-quantile(don$agec[don$dead==1],probs=seq(0,1,length=5)) # knots for age
formula <- as.formula(~tensor(fu,agec,df=c(length(knots.t),length(knots.agec)),
knots=list(fu=knots.t,age=knots.agec)))
mod <- survPen(formula,data=don,t1=fu,event=dead,n.legendre=20, expected=rate)
#-------------------- Age classes and associated weights for age-standardized
# net survival prediction
# weights of type 1
wicss <- list.wicss[["1"]]
# to estimate population net survival, prediction dataframe
# is needed. It should contain original data for age
pred.pop <- data.frame(age=don$age)
#-------------------- prediction : age-standardized net survival and population net survival
pred <- predSNS(mod,time.points=seq(0,5,by=0.1),newdata=pred.pop,
weight.table=wicss,var.name=list(agec="age"),
var.model=list(agec=function(age) age - 50),method="approx")
Run the code above in your browser using DataLab