data(kidney)
#Shared frailty model
frailtyPenal(Surv(time,status)~sex+age+cluster(id),
n.knots=12,kappa1=1000,data=kidney)
#model without frailties (e.g., Cox proportional hazards
# estimated via penalized likelihood)
frailtyPenal(Surv(time,status)~sex+age+cluster(id),
n.knots=12,kappa1=1000,data=kidney,Frailty=FALSE)
# truncated data
# first, we create a hypothetical truncated data
kidney$tt0<-rep(0,nrow(kidney))
kidney$tt0[1:3]<-c(2,9,13)
# then, we fit the model
frailtyPenal(Surv(tt0,time,status)~sex+age+cluster(id),
n.knots=12,kappa1=1000,data=kidney)
#stratified data. Let's use another dataset
data(readmission)
frailtyPenal(Surv(time,event)~as.factor(dukes)+cluster(id)+strata(sex),
n.knots=10,kappa1=10000,kappa2=10000,data=readmission)
#Andersen-Gill counting-process approach with time-dependent covariate
frailtyPenal(Surv(t.start,t.stop,event)~as.factor(sex)+as.factor(dukes)+
as.factor(charlson)+cluster(id),data=readmission, Frail=TRUE,
n.knots=6,kappa1=100000,recurrentAG=TRUE)
# with the use of the cross validation approach, to find the smoothing parameter
frailtyPenal(Surv(t.start,t.stop,event)~as.factor(sex)+as.factor(dukes)+
as.factor(charlson)+cluster(id),data=readmission, Frail=TRUE,
n.knots=6,kappa1=5000,recurrentAG=TRUE,cross.validation=TRUE)Run the code above in your browser using DataLab