Plot survival estimates and calculate inverse-probability-of-censoring weighted Brier scores and cumulative/dynamic time-dependent AUC.
# S3 method for rfsrc
plot.survival(x, show.plots = TRUE, subset,
collapse = FALSE, cens.model = c("km", "rfsrc"), ...)get.brier.survival(o, subset = NULL,
cens.model = c("km", "rfsrc"), papply = lapply,
times = NULL, conf.int = FALSE, keep.matrix = TRUE)
get.auct.survival(o, subset = NULL,
cens.model = c("km", "rfsrc"), papply = lapply,
times = NULL, conf.int = FALSE)
plotBrierAUC(x, subset = NULL,
cens.model = c("km", "rfsrc"), papply = lapply,
times = NULL, conf.int = TRUE,
plots = c("brier", "auct"), show.plots = TRUE, ...)
get.brier.survival returns a list containing
brier.score, the optional brier.matx, integrated scores
crps and crps.std, the estimated censoring distribution,
aligned grow and evaluation event information, survival predictions,
mortality, and the selected subset. When confidence intervals are
requested, brier.score also contains std.err,
lower, upper, and n.eval.
get.auct.survival returns a corresponding list whose
auct.score contains time, auct, n.case,
n.control, effective sample sizes n.case.eff and
n.control.eff, and largest normalized weights
max.case.weight and max.control.weight. The columns
std.err, lower, and upper are included when
confidence intervals are requested.
plotBrierAUC invisibly returns a list containing the requested
Brier and/or AUC result objects.
With evaluation outcomes, plot.survival invisibly returns the
mortality-stratified and overall Brier and cumulative integrated Brier
curves. Without evaluation outcomes, it invisibly returns the predicted
survival curves and their ensemble mean.
An object of class (rfsrc, grow) or
(rfsrc, predict). The two numerical helpers and
plotBrierAUC also accept an object of class
(rfsrc, forest).
Should plots be displayed?
Vector indicating which predicted cases are to be used. All cases are used if not specified.
Collapse the individual survival functions into their ensemble mean?
Method used to estimate the censoring distribution for inverse probability of censoring weighting. In all cases the censoring model is estimated from the full grow data, not from the evaluation outcomes:
km:Kaplan--Meier estimator.
rfsrc:Random survival forest estimator of the
conditional censoring distribution. When censoring is present,
this option requires the grow and evaluation covariates to be stored
in the object. Because
rfsrc.fast uses forest=FALSE by default, use
cens.model="km" for its default reduced object or refit with
forest=TRUE.
Function used in place of lapply for repeated
calculations.
Optional numeric vector of prediction horizons. The forest survival curves are evaluated as right-continuous step functions. The forest time grid is used by default.
Controls pointwise confidence intervals. Use
FALSE for no intervals, TRUE for 95 percent intervals,
or a numeric value strictly between zero and one for a different
confidence level.
Should the subject-by-time matrix of IPCW Brier
contributions be retained? This matrix is used by
plot.survival for mortality-stratified curves.
One or both of "brier" and "auct".
"auc" is also accepted as an alias for "auct".
Further graphical arguments. For plotBrierAUC,
col, lwd, lty, and type control
the estimated curve; band.col and band.border control
the confidence band.
Hemant Ishwaran and Udaya B. Kogalur
plot.survival produces the following plots, going from top to
bottom and left to right:
Forest estimated survival function for each individual. The thick red line is the ensemble mean survival and the thick green line is the marginal Nelson--Aalen survival estimate.
Brier score stratified by ensemble mortality. Stratification is into four groups corresponding to the 0--25, 25--50, 50--75 and 75--100 percentile ranges of mortality. The red line is the overall Brier score.
Cumulative integrated Brier score divided by elapsed time, labeled CRPS in the plot.
Mortality (Ishwaran et al., 2008) versus observed time. Blue points are events and black points are censored observations. Mortality is estimated risk calibrated to the scale of the number of events. For example, a mortality value of 100 means that if all individuals had the same covariate values, an average of 100 events would be expected.
Whenever possible, out-of-bag predictions are used. For a prediction
object, the predicted test survival curves and test outcomes are used
for scoring, while the censoring distribution is still estimated from
the grow data. If a prediction object contains no outcomes,
plot.survival displays only its predicted survival curves.
Brier score, AUC, CRPS, and mortality-versus-time cannot be calculated
without evaluation outcomes. Direct calls to get.brier.survival,
get.auct.survival, or plotBrierAUC therefore require
outcomes for the cases being evaluated.
For subject \(i\) at horizon \(t\), the IPCW Brier contribution is
$$
L_i(t) =
\frac{I(T_i \le t, \Delta_i > 0)}{\widehat G(T_i-)}
\widehat S_i(t)^2
+
\frac{I(T_i > t)}{\widehat G(t)}
\{1-\widehat S_i(t)\}^2,
$$
with subject-specific values of \(\widehat G\) when
cens.model="rfsrc". The Brier score is the sample mean of these
contributions.
The time-dependent AUC uses a cumulative/dynamic definition. Cases at \(t\) are observed events satisfying \(T_i \le t\); controls satisfy \(T_i > t\); observations censored at or before \(t\) are not included in the case-control comparison. The time-specific risk score is \(1-\widehat S_i(t)\), and comparisons are weighted by the same grow-data censoring distribution.
When confidence intervals are requested, the Brier standard error is obtained by deleting one subject-level IPCW loss at a time while holding the survival predictions and censoring weights fixed.
The AUC standard error uses a stratified delete-one jackknife. One observed case or control is deleted at a time, the remaining IPCW weights within that stratum are renormalized, and the resulting case-delete and control-delete variance components are added. With equal weights this calculation reduces exactly to the ordinary DeLong variance. The effective case and control sample sizes and the largest normalized IPCW weights are returned to diagnose horizons at which a few observations dominate the weighted comparison.
Both are pointwise conditional standard errors, and the reported
intervals are pointwise normal approximations rather than simultaneous
bands. The survival predictions and the estimated censoring distribution
are treated as fixed. They do not account for uncertainty from training
the survival forest or estimating the censoring model. For an independent
prediction sample, the intervals have a direct conditional test-performance
interpretation. For a grow object, shared out-of-bag fits and the shared
censoring estimate induce dependence among subject-level quantities, so
the intervals should be viewed as fixed-fit working intervals rather than
repeated-training confidence intervals. A score and its interval are
returned as NA at a horizon where a required censoring survival
probability is zero. The AUC standard error is also NA if fewer
than two cases or two controls are available, or if deleting one subject
leaves no positive IPCW weight in its stratum.
plotBrierAUC is a base-R plotting helper. It calls a shared
numerical engine so that Brier score and AUC use the same fitted
censoring model, then adds the requested pointwise confidence bands.
Only right-censored survival families are supported. Competing-risk
analyses should use plot.competing.risk.
Gerds T.A. and Schumacher M. (2006). Consistent estimation of the expected Brier score in general survival models with right-censored event times, Biometrical Journal, 48:1029--1040.
Graf E., Schmoor C., Sauerbrei W. and Schumacher M. (1999). Assessment and comparison of prognostic classification schemes for survival data, Statistics in Medicine, 18:2529--2545.
DeLong E.R., DeLong D.M. and Clarke-Pearson D.L. (1988). Comparing the areas under two or more correlated receiver operating characteristic curves: a nonparametric approach, Biometrics, 44:837--845.
Efron B. and Tibshirani R.J. (1993). An Introduction to the Bootstrap. Chapman and Hall, New York.
Heagerty P.J. and Zheng Y. (2005). Survival model predictive accuracy and ROC curves, Biometrics, 61:92--105.
Ishwaran H. and Kogalur U.B. (2007). Random survival forests for R, R News, 7(2):25--31.
Ishwaran H., Kogalur U.B., Blackstone E.H. and Lauer M.S. (2008). Random survival forests, Annals of Applied Statistics, 2:841--860.
plot.competing.risk.rfsrc,
predict.rfsrc,
rfsrc
# \donttest{
## veteran data
data(veteran, package = "randomForestSRC")
plot.survival(rfsrc(Surv(time, status) ~ ., veteran),
cens.model = "rfsrc")
## pbc data
data(pbc, package = "randomForestSRC")
pbc.obj <- rfsrc(Surv(days, status) ~ ., pbc)
## standard survival diagnostics
plot.survival(pbc.obj)
plot.survival(pbc.obj, subset = c(3, 10), collapse = TRUE)
## Brier and AUCT helpers with pointwise intervals
brier.obj <- get.brier.survival(pbc.obj, conf.int = TRUE)
head(brier.obj$brier.score)
auct.obj <- get.auct.survival(pbc.obj, conf.int = TRUE)
head(auct.obj$auct.score)
## compare two grow-data censoring models
brier.km <- get.brier.survival(pbc.obj, cens.model = "km")
brier.rf <- get.brier.survival(pbc.obj, cens.model = "rfsrc")
plot(brier.km$brier.score$time,
brier.km$brier.score$brier.score, type = "s", col = 2,
xlab = "Time", ylab = "Brier Score")
lines(brier.rf$brier.score$time,
brier.rf$brier.score$brier.score, type = "s", col = 4)
legend("bottomright",
legend = c("cens.model = km", "cens.model = rfsrc"),
col = c(2, 4), lty = 1)
## Brier and AUCT curves with confidence bands
plotBrierAUC(pbc.obj)
plotBrierAUC(pbc.obj, plots = "auct", conf.int = 0.90)
plotBrierAUC(pbc.obj, plots = "brier", conf.int = 0.90)
# }
Run the code above in your browser using DataLab