Using the available longitudinal information up to a starting time point, these functions compute estimates of the ROC curve and the AUC, the Brier score and expected predictive cross-entropy at a horizon time point based on joint models.

tvROC(object, newdata, Tstart, ...)

# S3 method for jm
tvROC(object, newdata, Tstart, Thoriz = NULL,
    Dt = NULL, ...)

tvAUC(object, newdata, Tstart, ...)

# S3 method for jm
tvAUC(object, newdata, Tstart, Thoriz = NULL,
    Dt = NULL, ...)

# S3 method for tvROC
tvAUC(object, ...)

calibration_plot(object, newdata, Tstart, Thoriz = NULL,
    Dt = NULL, df_ns = 3, plot = TRUE, add_density = TRUE,
    col = "red", lty = 1, lwd = 1,
    col_dens = "grey", xlab = "Predicted Probabilities",
    ylab = "Observed Probabilities", main = "", ...)

calibration_metrics(object, newdata, Tstart, Thoriz = NULL,
    Dt = NULL, df_ns = 3, ...)

tvBrier(object, newdata, Tstart, Thoriz = NULL, Dt = NULL,
    integrated = FALSE, type_weights = c("model-based", "IPCW"),
    model_weights = NULL, eventData_fun = NULL,
    parallel = c("snow", "multicore"),
    cores = parallelly::availableCores(omit = 1L), ...)

tvEPCE(object, newdata, Tstart, Thoriz = NULL, Dt = NULL, eps = 0.001,
    model_weights = NULL, eventData_fun = NULL,
    parallel = c("snow", "multicore"),
    cores = parallelly::availableCores(omit = 1L), ...)

create_folds(data, V = 5, id_var = "id", strata = NULL, seed = 123L)

Arguments

object

an object inheriting from class jm, except for tvAUC.tvROC() where this is an object of class tvROC. For tvBrier() and tvEPCE() it can also be a library of joint models.

newdata

a data.frame that contains the longitudinal and covariate information for the subjects for which prediction of survival probabilities is required. The names of the variables in this data.frame must be the same as in the data.frames that were used to fit the linear mixed effects and the event process model that were supplied as the two first argument of jm.

Tstart

numeric scalar denoting the time point up to which longitudinal information is to be used to derive predictions.

Thoriz

numeric scalar denoting the time point for which a prediction of the survival status is of interest; Thoriz must be later than Tstart and either Dt or Thoriz must be specified. If Thoriz is NULL is set equal to Tstart + Dt.

Dt

numeric scalar denoting the length of the time interval of prediction; either Dt or Thoriz must be specified.

integrated

logical; if TRUE the integrated Brier score is calculated.

type_weights

character string denoting the type of weights to use to account for censorting. Options are model-based (default) and inverse probability of censoring weighting (using the Kaplan-Meier estimate of the censoring distribution).

eps

numeric scalar used in the approximation of the hazard function.

model_weights

a numeric vector of weights to combine predictions when object is a list of joint models of class "jmList".

eventData_fun

a function that takes as input the newdata and produces the dataset used for the event process model. This is useful when, for example, the event process model contains other time-varying covariates. It is important that this function does not alter the ordering of the subjects in newdata.

parallel

character string; what type of parallel computing to use.

cores

integer denoting the number of cores to be used when a library of joint models has been provided in object. If cores = 1, no parallel computing is used.

df_ns

the degrees of freedom for the natural cubic spline of the cloglog transformation of the predicted probabilities used in the Cox model that assess calibration.

plot

logical; should a plot be produced. If FALSE, a list is returned with the observed and predicted probabilities.

add_density

logical; should the kernal density estimation of the predicted probabilities be superimposed in the calibration plot.

col, lwd, lty, col_dens, xlab, ylab, main

graphical parameters.

data

the data.frame to split in folds.

V

numeric scalar denoting the number of folds.

id_var

character string denoting the name of the subject id variable in data.

strata

character vector with the names of stratifying variables.

seed

integer denoting the seed.

...

additional arguments passed to predict.jm().

Value

A list of class tvAUC with components:

auc

a numeric scalar denoting the estimated prediction error.

Tstart

a copy of the Tstart argument.

Thoriz

a copy of the Thoriz argument.

nr

a numeric scalar denoting the number of subjects at risk at time Tstart.

classObject

the class of object.

nameObject

the name of object.

A list of class tvROC with components:

TP, FP, nTP, nFN, nTN, qSN, qSP, qOverall

accuracy indexes.

F1score, Youden

numeric scalars with the optimal cut-point using the F1 score and the Youden index.

thr

numeric vector of thresholds.

Tstart

a copy of the Tstart argument.

Thoriz

a copy of the Thoriz argument.

nr

a numeric scalar denoting the number of subjects at risk at time Tstart.

classObject

the class of object.

nameObject

the name of object.

References

Antolini, L., Boracchi, P., and Biganzoli, E. (2005). A time-dependent discrimination index for survival data. Statistics in Medicine 24, 3927--3944.

Commenges, D., Liquet, B., and Proust-Lima, C. (2012). Choice of prognostic estimators in joint models by estimating differences of expected conditional Kullback-Leibler risks. Biometrics 68, 380--387.

Harrell, F., Kerry, L. and Mark, D. (1996). Multivariable prognostic models: issues in developing models, evaluating assumptions and adequacy, and measuring and reducing errors. Statistics in Medicine 15, 361--387.

Heagerty, P. and Zheng, Y. (2005). Survival model predictive accuracy and ROC curves. Biometrics 61, 92--105.

Rizopoulos, D. (2016). The R package JMbayes for fitting joint models for longitudinal and time-to-event data using MCMC. Journal of Statistical Software 72(7), 1--45. doi:10.18637/jss.v072.i07.

Rizopoulos, D. (2012) Joint Models for Longitudinal and Time-to-Event Data: with Applications in R. Boca Raton: Chapman and Hall/CRC.

Rizopoulos, D. (2011). Dynamic predictions and prospective accuracy in joint models for longitudinal and time-to-event data. Biometrics 67, 819--829.

Rizopoulos, D., Molenberghs, G. and Lesaffre, E.M.E.H. (2017). Dynamic predictions with time-dependent covariates in survival analysis using joint modeling and landmarking. Biometrical Journal 59, 1261--1276.

Author

Dimitris Rizopoulos d.rizopoulos@erasmusmc.nl

See also

Examples

# \donttest{
# We fit a multivariate joint model
pbc2.id$status2 <- as.numeric(pbc2.id$status != 'alive')
CoxFit <- coxph(Surv(years, status2) ~ sex, data = pbc2.id)
fm1 <- lme(log(serBilir) ~ ns(year, 3) * sex, data = pbc2,
           random = ~ ns(year, 3) | id, control = lmeControl(opt = 'optim'))
fm2 <- lme(prothrombin ~ ns(year, 2) * sex, data = pbc2,
           random = ~ ns(year, 2) | id, control = lmeControl(opt = 'optim'))
fm3 <- mixed_model(ascites ~ year * sex, data = pbc2,
                   random = ~ year | id, family = binomial())

jointFit <- jm(CoxFit, list(fm1, fm2, fm3), time_var = "year", n_chains = 1L)

roc <- tvROC(jointFit, newdata = pbc2, Tstart = 4, Dt = 3, cores = 1L)
roc
#> 
#> 	Time-dependent Sensitivity and Specificity for the Joint Model jointFit
#> 
#> At time: 7
#> Using information up to time: 4 (225 subjects still at risk)
#> 
#>    cut-off         SN         SP         qSN         qSP  
#> 1     0.02 0.01108858 0.99724832 0.006673795 0.380872674  
#> 2     0.03 0.02514248 0.99525214 0.016399360 0.465865684  
#> 3     0.05 0.06892037 0.99525214 0.052068245 0.732932842  
#> 4     0.06 0.08095754 0.99274214 0.060070216 0.673396462  
#> 5     0.07 0.08095754 0.98716536 0.055778300 0.518701008  
#> 6     0.08 0.10284649 0.98716536 0.074038808 0.587458007  
#> 7     0.13 0.12166020 0.98080508 0.085062712 0.520127029  
#> 8     0.14 0.14354915 0.98080508 0.103714225 0.568114326  
#> 9     0.15 0.16543809 0.98080508 0.122540050 0.607376660  
#> 10    0.18 0.18732704 0.98080508 0.141542644 0.640095272  
#> 11    0.19 0.18732704 0.97522830 0.137493317 0.571259000  
#> 12    0.20 0.21598454 0.97137598 0.159983433 0.570639729  
#> 13    0.21 0.25144573 0.96925708 0.190265812 0.593108474  
#> 14    0.22 0.26517610 0.96717847 0.201278366 0.589730914  
#> 15    0.23 0.28706504 0.96717847 0.221308904 0.611324024  
#> 16    0.25 0.32170969 0.96485154 0.251885684 0.623409353  
#> 17    0.26 0.36163014 0.95271519 0.281833903 0.574436700  
#> 18    0.30 0.36163014 0.94713841 0.278225028 0.542543894  
#> 19    0.31 0.36163014 0.94156162 0.274579700 0.513013518  
#> 20    0.34 0.40540802 0.94156162 0.317432682 0.546598793  
#> 21    0.36 0.42729697 0.93598484 0.335782567 0.535373830  
#> 22    0.37 0.44918591 0.93598484 0.357859226 0.549893398  
#> 23    0.41 0.47107486 0.93598484 0.380165849 0.563532992  
#> 24    0.42 0.47621158 0.93171677 0.382971762 0.548125692  
#> 25    0.45 0.48770517 0.92349150 0.390125203 0.521821859  
#> 26    0.46 0.48770517 0.91791471 0.386881188 0.500832721  
#> 27    0.47 0.48770517 0.91233793 0.383602478 0.480948274  
#> 28    0.50 0.50959412 0.91233793 0.406767075 0.494257293  
#> 29    0.51 0.51873208 0.90908928 0.414674154 0.488627225  
#> 30    0.52 0.54062103 0.90908928 0.438259407 0.501099732  
#> 31    0.54 0.56594137 0.90438674 0.463389055 0.499698057  
#> 32    0.55 0.59478617 0.88942858 0.487791504 0.470668716  
#> 33    0.56 0.60174621 0.88562505 0.493745179 0.463867402  
#> 34    0.57 0.64552410 0.88004826 0.541625987 0.470801157  
#> 35    0.58 0.68930199 0.88004826 0.593563643 0.490770925  
#> 36    0.61 0.68930199 0.87447148 0.591186822 0.476964496  
#> 37    0.62 0.68930199 0.85774113 0.583886587 0.438451824  
#> 38    0.63 0.69436107 0.85345328 0.588211022 0.431499794  
#> 39    0.65 0.71625001 0.85345328 0.615399115 0.441135390  
#> 40    0.66 0.71625001 0.84787650 0.613068201 0.429536863  
#> 41    0.68 0.71738117 0.83143434 0.607473848 0.397979780  
#> 42    0.69 0.74394216 0.82704788 0.639918659 0.401319587 *
#> 43    0.70 0.74394216 0.82147110 0.637653996 0.391378740  
#> 44    0.71 0.74842069 0.81703534 0.641738327 0.385566434  
#> 45    0.72 0.74842069 0.81145855 0.639456405 0.376149629  
#> 46    0.73 0.74842069 0.78915142 0.630030429 0.341098191  
#> 47    0.74 0.77030964 0.78915142 0.659997817 0.350124243  
#> 48    0.75 0.77030964 0.77799785 0.655464454 0.333993563  
#> 49    0.76 0.77030964 0.77242107 0.653152135 0.326246592  
#> 50    0.77 0.77258431 0.75627025 0.649530619 0.305833004  
#> 51    0.78 0.77258431 0.74511669 0.644662989 0.291990800  
#> 52    0.79 0.77258431 0.73953990 0.642178115 0.285322909  
#> 53    0.80 0.79680419 0.73455699 0.675751367 0.288991930  
#> 54    0.81 0.82257740 0.72439304 0.710724025 0.287223379  
#> 55    0.82 0.83099390 0.69865345 0.714087427 0.263011148  
#> 56    0.83 0.85699425 0.68297059 0.750571367 0.256962309  
#> 57    0.84 0.85750577 0.66637056 0.745546012 0.241751267  
#> 58    0.85 0.86178006 0.65072920 0.747158648 0.229549697  
#> 59    0.86 0.86767004 0.60761556 0.741093565 0.197395457  
#> 60    0.87 0.87371786 0.58684926 0.744022696 0.184570916  
#> 61    0.88 0.87371786 0.54781178 0.726793454 0.159154137  
#> 62    0.89 0.87429563 0.52007507 0.714308251 0.142991188  
#> 63    0.90 0.88007572 0.46020308 0.693375427 0.113472209  
#> 64    0.91 0.88189088 0.44393519 0.687358210 0.106324407  
#> 65    0.92 0.90607043 0.43336521 0.742266431 0.108441768  
#> 66    0.93 0.90709287 0.38343466 0.713642407 0.087321036  
#> 67    0.94 0.92977785 0.33344642 0.749206620 0.074231134  
#> 68    0.95 0.99609393 0.27784399 0.982422667 0.071513706  
#> 69    0.96 0.99928239 0.18385102 0.995107180 0.043575415  
#> 70    0.97 0.99955729 0.10584609 0.994757348 0.023375585  
#> 71    0.98 0.99990285 0.02228238 0.994535469 0.004586136  
#> 
tvAUC(roc)
#> 
#> 	Time-dependent AUC for the Joint Model jointFit
#> 
#> Estimated AUC: 0.8362
#> At time: 7
#> Using information up to time: 4 (225 subjects still at risk)
#> 
plot(roc, legend = TRUE, optimal_cutoff = "Youden")

# }