########################################
#### EPOCE on a joint frailty model ####
########################################
data(readmission)
modJoint.gap <- frailtyPenal(Surv(t.start,t.stop,event)~ cluster(id) +
dukes + charlson + sex + chemo + terminal(death),
formula.terminalEvent = ~ dukes + charlson + sex + chemo ,
data = readmission, n.knots = 8, kappa =c(2.11e+08,9.53e+11),
recurrentAG=TRUE)
# computation on the same dataset
temps <- c(200,500,800,1100)
epoce <- epoce(modJoint.gap,temps)
print(epoce)
plot(epoce)
# computation on a new dataset
# here a sample of readmission with the first 50 subjects
s <- readmission[1:100,]
epoce <- epoce(modJoint.gap,temps,newdata=s)
print(epoce)
plot(epoce)
#################################################
#### EPOCE on a joint model for a biomarker ####
######### and a terminal event ###############
#################################################
data(colorectal)
data(colorectalLongi)
# Survival data preparation - only terminal events
colorectalSurv <- subset(colorectal, new.lesions == 0)
modLongi <- longiPenal(Surv(time0, time1, state) ~ age +
treatment + who.PS, tumor.size ~ year*treatment + age +
who.PS, colorectalSurv, data.Longi =colorectalLongi,
random = c("1", "year"), id = "id", link = "Random-effects",
left.censoring = -3.33, hazard = "Weibull",
method.GH = "Pseudo-adaptive")
# computation on the same dataset
time <- c(1, 1.5, 2, 2.5)
epoce <- epoce(modLongi,time)
print(epoce)
plot(epoce)
# computation on a new dataset
# here a sample of colorectal data with the first 50 subjects
s <- subset(colorectal, new.lesions == 0 & ids.Longi <- subset(colorectalLongi, idepoce <- epoce(modLongi, time, newdata = s, newdata.Longi = s.Longi)
print(epoce)
plot(epoce)
###################################################
#### EPOCE on a joint model for a biomarker, ######
#### recurrent events and a terminal event ######
###################################################
data(colorectal)
data(colorectalLongi)
# (computation takes around 30 minutes)
modTriv <- model.weib.RE.gap <-trivPenal(Surv(gap.time, new.lesions) ~ cluster(id)
+ age + treatment + who.PS + prev.resection + terminal(state),
formula.terminalEvent =~ age + treatment + who.PS + prev.resection,
tumor.size ~ year * treatment + age + who.PS, data = colorectal,
data.Longi = colorectalLongi, random = c("1", "year"), id = "id",
link = "Random-effects", left.censoring = -3.33, recurrentAG = FALSE,
hazard = "Weibull", method.GH="Pseudo-adaptive", n.nodes=7)
# computation on the same dataset
time <- c(1, 1.5, 2, 2.5)
# (computation takes around 10 minutes)
epoce <- epoce(modTriv,time)
print(epoce)
plot(epoce)
# computation on a new dataset
# here a sample of colorectal data with the first 100 subjects
s <- subset(colorectal, ids.Longi <- subset(colorectalLongi, id# (computation takes around 10 minutes)
epoce <- epoce(modTriv, time, newdata = s, newdata.Longi = s.Longi)
print(epoce)
plot(epoce)
dev.off()Run the code above in your browser using DataLab