# \donttest{
#fit a joint model with competing risks and subject-specific variability
example <- lsjm(formFixed = y~visit,
formRandom = ~ visit,
formGroup = ~ID,
formSurv = Surv(time, event ==1 ) ~ 1,
timeVar = "visit",
data.long = Data_toy,
variability_hetero = TRUE,
formFixedVar =~visit,
formRandomVar =~visit,
correlated_re = TRUE,
sharedtype = c("current value", "variability"),
hazard_baseline = "Weibull",
formSlopeFixed =~1,
formSlopeRandom = ~1,
indices_beta_slope = c(2),
competing_risk = TRUE,
formSurv_CR = Surv(time, event ==2 ) ~ 1,
hazard_baseline_CR = "Weibull",
sharedtype_CR = c("current value", "variability"),
S1 = 100,
S2 = 1000,
nproc = 1,
maxiter = 100,
Comp.Rcpp = TRUE
)
#Prediction for individuals 1 and 3 to experiment the event 1
#at time 1.5, 2, and 3, given their measurements until time 1:
newdata <- Data_toy[which(Data_toy$ID %in% c(1,3)),]
pred.new <- predyn(newdata,example,1, c(1.5,2,2.8,3), event = 1, IC = 95,
nb.draws = 100, graph = TRUE)
# }
Run the code above in your browser using DataLab