Accuracy Measures {JMbayes2} | R Documentation |
Time-Dependent Predictive Accuracy Measures for Joint Models
Description
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.
Usage
tvROC(object, newdata, Tstart, ...)
## S3 method for class 'jm'
tvROC(object, newdata, Tstart, Thoriz = NULL,
Dt = NULL, type_weights = c("model-based", "IPCW"), ...)
tvAUC(object, newdata, Tstart, ...)
## S3 method for class 'jm'
tvAUC(object, newdata, Tstart, Thoriz = NULL,
Dt = NULL, type_weights = c("model-based", "IPCW"), ...)
## S3 method for class '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 |
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 |
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; |
Dt |
numeric scalar denoting the length of the time interval of prediction; either |
integrated |
logical; if |
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 |
eventData_fun |
a function that takes as input the |
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
|
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 |
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 |
strata |
character vector with the names of stratifying variables. |
seed |
integer denoting the seed. |
... |
additional arguments passed to |
Value
A list of class tvAUC
with components:
auc |
a numeric scalar denoting the estimated prediction error. |
Tstart |
a copy of the |
Thoriz |
a copy of the |
nr |
a numeric scalar denoting the number of subjects at risk at time |
classObject |
the class of |
nameObject |
the name of |
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 |
Thoriz |
a copy of the |
nr |
a numeric scalar denoting the number of subjects at risk at time |
classObject |
the class of |
nameObject |
the name of |
Author(s)
Dimitris Rizopoulos d.rizopoulos@erasmusmc.nl
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.
See Also
Examples
# 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
tvAUC(roc)
plot(roc, legend = TRUE, optimal_cutoff = "Youden")