predyn: Dynamic prediction for new individuals

View source: R/predyn.R

predynR Documentation

Dynamic prediction for new individuals

Description

Dynamic prediction for new individuals

Usage

predyn(
  newdata,
  object,
  s,
  times,
  event = 1,
  IC = 95,
  nb.draws = 500,
  graph = FALSE
)

Arguments

newdata

data frame : collected data for a new individual

object

lsjm object : estimation of the model

s

numeric : the time to begin prediction

times

numeric vector : future times to calculate predictions

event

integer (0, 1 or 2) : the event of interest for the prediction

IC

integer : percentage of confidence for the interval confidence (between 0 and 100), 95 by default, NULL if no IC

nb.draws

integer : the number of simulations to compute the interval confidence (by bootstrap), 500 by default

graph

boolean : indicator to plot the graphs or not

Value

A table of dynamic predictions

Examples




#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)



FlexVarJM documentation built on Nov. 21, 2023, 1:06 a.m.