Title: | Estimators of Prediction Accuracy for Time-to-Event Data |
---|---|
Description: | Provides a variety of functions to estimate time-dependent true/false positive rates and AUC curves from a set of censored survival data. |
Authors: | Sergej Potapov [aut], Werner Adler [aut], Matthias Schmid [aut], Frederic Bertrand [cre, aut] |
Maintainer: | Frederic Bertrand <[email protected]> |
License: | GPL-2 |
Version: | 1.3-0 |
Built: | 2024-11-01 11:22:07 UTC |
Source: | https://github.com/fbertran/survauc |
Chambless and Diao's estimator of cumulative/dynamic AUC for right-censored time-to-event data
AUC.cd(Surv.rsp, Surv.rsp.new = NULL, lp, lpnew, times)
AUC.cd(Surv.rsp, Surv.rsp.new = NULL, lp, lpnew, times)
Surv.rsp |
A |
Surv.rsp.new |
A |
lp |
The vector of predictors estimated from the training data. |
lpnew |
The vector of predictors obtained from the test data. |
times |
A vector of time points at which to evaluate AUC. |
This function implements the estimator of cumulative/dynamic AUC proposed in
Section 3.3 of Chambless and Diao (2006). In contrast to the general form of
Chambless and Diao's estimator, AUC.cd
is restricted to Cox regression.
Specifically, it is assumed that lp
and lpnew
are the predictors of
a Cox proportional hazards model. Estimates obtained from
AUC.cd
are valid as long as the Cox model is specified correctly.
The iauc
summary measure is given by the integral of AUC on
[0, max(times
)] (weighted by the estimated probability density of
the time-to-event outcome).
Note that the recursive estimators proposed in Sections 3.1 and 3.2 of Chambless and Diao (2006) are not implemented in the survAUC package.
AUC.cd
returns an object of class survAUC
. Specifically,
AUC.cd
returns a list with the following components:
auc |
The cumulative/dynamic AUC estimates (evaluated at |
times |
The vector of time points at which AUC is evaluated. |
iauc |
The summary measure of AUC. |
Chambless, L. E. and G. Diao (2006).
Estimation of time-dependent area under
the ROC curve for long-term risk prediction.
Statistics in Medicine
25, 3474–3486.
AUC.uno
, AUC.sh
, AUC.hc
,
IntAUC
data(cancer,package="survival") TR <- ovarian[1:16,] TE <- ovarian[17:26,] train.fit <- survival::coxph(survival::Surv(futime, fustat) ~ age, x=TRUE, y=TRUE, method="breslow", data=TR) lp <- predict(train.fit) lpnew <- predict(train.fit, newdata=TE) Surv.rsp <- survival::Surv(TR$futime, TR$fustat) Surv.rsp.new <- survival::Surv(TE$futime, TE$fustat) times <- seq(10, 1000, 10) AUC_CD <- AUC.cd(Surv.rsp, Surv.rsp.new, lp, lpnew, times)
data(cancer,package="survival") TR <- ovarian[1:16,] TE <- ovarian[17:26,] train.fit <- survival::coxph(survival::Surv(futime, fustat) ~ age, x=TRUE, y=TRUE, method="breslow", data=TR) lp <- predict(train.fit) lpnew <- predict(train.fit, newdata=TE) Surv.rsp <- survival::Surv(TR$futime, TR$fustat) Surv.rsp.new <- survival::Surv(TE$futime, TE$fustat) times <- seq(10, 1000, 10) AUC_CD <- AUC.cd(Surv.rsp, Surv.rsp.new, lp, lpnew, times)
Hung and Chiang's estimator of cumulative/dynamic AUC for right-censored time-to-event data
AUC.hc(Surv.rsp, Surv.rsp.new, lpnew, times)
AUC.hc(Surv.rsp, Surv.rsp.new, lpnew, times)
Surv.rsp |
A |
Surv.rsp.new |
A |
lpnew |
The vector of predictors obtained from the test data. |
times |
A vector of time points at which to evaluate AUC. |
This function implements the estimator of cumulative/dynamic AUC proposed by
Hung and Chiang (2010). The estimator is based on inverse-probability-of-censoring
weights and does not assume a specific working model for deriving the predictor
lpnew
. It is assumed, however, that there is a one-to-one
relationship between the predictor and the expected survival times conditional
on the predictor. The iauc
summary measure is given by the integral of AUC on
[0, max(times
)] (weighted by the estimated probability density of
the time-to-event outcome).
Note that the estimator implemented in AUC.hc
is restricted to situations
where the random censoring assumption holds (formula (4) in Hung and Chiang 2010).
AUC.hc
returns an object of class survAUC
. Specifically,
AUC.hc
returns a list with the following components:
auc |
The cumulative/dynamic AUC estimates (evaluated at |
times |
The vector of time points at which AUC is evaluated. |
iauc |
The summary measure of AUC. |
Hung, H. and C.-T. Chiang (2010).
Estimation methods for time-dependent
AUC models with survival data.
Canadian Journal of Statistics
38, 8–26.
AUC.uno
, AUC.sh
, AUC.cd
,
IntAUC
data(cancer,package="survival") TR <- ovarian[1:16,] TE <- ovarian[17:26,] train.fit <- survival::coxph(survival::Surv(futime, fustat) ~ age, x=TRUE, y=TRUE, method="breslow", data=TR) lpnew <- predict(train.fit, newdata=TE) Surv.rsp <- survival::Surv(TR$futime, TR$fustat) Surv.rsp.new <- survival::Surv(TE$futime, TE$fustat) times <- seq(10, 1000, 10) AUC_hc <- AUC.hc(Surv.rsp, Surv.rsp.new, lpnew, times) AUC_hc
data(cancer,package="survival") TR <- ovarian[1:16,] TE <- ovarian[17:26,] train.fit <- survival::coxph(survival::Surv(futime, fustat) ~ age, x=TRUE, y=TRUE, method="breslow", data=TR) lpnew <- predict(train.fit, newdata=TE) Surv.rsp <- survival::Surv(TR$futime, TR$fustat) Surv.rsp.new <- survival::Surv(TE$futime, TE$fustat) times <- seq(10, 1000, 10) AUC_hc <- AUC.hc(Surv.rsp, Surv.rsp.new, lpnew, times) AUC_hc
Song and Zhou's estimators of AUC for right-censored time-to-event data
AUC.sh(Surv.rsp, Surv.rsp.new=NULL, lp, lpnew, times, type="incident", savesensspec=FALSE) sens.sh(Surv.rsp, lp, lpnew, times, type="incident") spec.sh(Surv.rsp, lp, lpnew, times)
AUC.sh(Surv.rsp, Surv.rsp.new=NULL, lp, lpnew, times, type="incident", savesensspec=FALSE) sens.sh(Surv.rsp, lp, lpnew, times, type="incident") spec.sh(Surv.rsp, lp, lpnew, times)
Surv.rsp |
A |
Surv.rsp.new |
A |
lp |
The vector of predictors estimated from the training data. |
lpnew |
The vector of predictors obtained from the test data. |
times |
A vector of time points at which to evaluate AUC. |
type |
A string defining the type of true positive rate (TPR):
|
savesensspec |
A logical specifying whether sensitivities and specificities should be saved. |
The sens.sh
and spec.sh
functions implement the estimators of
time-dependent true and false positive rates proposed by Song and Zhou (2008).
The AUC.sh
function implements the estimators of cumulative/dynamic and
incident/dynamic AUC proposed by Song and Zhou (2008). These estimators are given
by the areas under the time-dependent ROC curves estimated by
sens.sh
and spec.sh
. In case of cumulative/dynamic
AUC, the iauc
summary measure is given by the integral of AUC on
[0, max(times
)] (weighted by the estimated probability density of
the time-to-event outcome). In case of incident/dynamic AUC, iauc
is
given by the integral of AUC on [0, max(times
)] (weighted by 2 times
the product of the estimated probability density and the estimated survival
function of the time-to-event outcome).
The results obtained from spec.sh
, spec.sh
and AUC.sh
are valid as long as lp
and lpnew
are the predictors of
a correctly specified Cox proportional hazards model. In this case, the
estimators remain valid even if the censoring times depend on the values of
the predictors.
AUC.sh
returns an object of class survAUC
. Specifically,
AUC.sh
returns a list with the following components:
auc |
The cumulative/dynamic or incident/dynamic AUC estimates
(evaluated at |
times |
The vector of time points at which AUC is evaluated. |
iauc |
The summary measure of AUC. |
sens.sh
and spec.sh
return matrices of dimensions times
x
lpnew + 1
. The elements of these matrices are the sensitivity and
specificity estimates for each threshold of lpnew
and for each time point
specified in times
.
Song, X. and X.-H. Zhou (2008).
A semiparametric approach for the covariate
specific ROC curve with survival outcome.
Statistica Sinica
18, 947–965.
AUC.uno
, AUC.cd
, AUC.hc
,
GHCI
, IntAUC
data(cancer,package="survival") TR <- ovarian[1:16,] TE <- ovarian[17:26,] train.fit <- survival::coxph(survival::Surv(futime, fustat) ~ age, x=TRUE, y=TRUE, method="breslow", data=TR) lp <- predict(train.fit) lpnew <- predict(train.fit, newdata=TE) Surv.rsp <- survival::Surv(TR$futime, TR$fustat) Surv.rsp.new <- survival::Surv(TE$futime, TE$fustat) times <- seq(10, 1000, 10) AUC_sh <- AUC.sh(Surv.rsp, Surv.rsp.new, lp, lpnew, times) names(AUC_sh) AUC_sh$iauc
data(cancer,package="survival") TR <- ovarian[1:16,] TE <- ovarian[17:26,] train.fit <- survival::coxph(survival::Surv(futime, fustat) ~ age, x=TRUE, y=TRUE, method="breslow", data=TR) lp <- predict(train.fit) lpnew <- predict(train.fit, newdata=TE) Surv.rsp <- survival::Surv(TR$futime, TR$fustat) Surv.rsp.new <- survival::Surv(TE$futime, TE$fustat) times <- seq(10, 1000, 10) AUC_sh <- AUC.sh(Surv.rsp, Surv.rsp.new, lp, lpnew, times) names(AUC_sh) AUC_sh$iauc
Uno's estimator of cumulative/dynamic AUC for right-censored time-to-event data
AUC.uno(Surv.rsp, Surv.rsp.new, lpnew, times, savesensspec=FALSE) sens.uno(Surv.rsp, Surv.rsp.new, lpnew, times) spec.uno(Surv.rsp.new, lpnew, times)
AUC.uno(Surv.rsp, Surv.rsp.new, lpnew, times, savesensspec=FALSE) sens.uno(Surv.rsp, Surv.rsp.new, lpnew, times) spec.uno(Surv.rsp.new, lpnew, times)
Surv.rsp |
A |
Surv.rsp.new |
A |
lpnew |
The vector of predictors obtained from the test data. |
times |
A vector of time points at which to evaluate AUC. |
savesensspec |
A logical specifying whether sensitivities and specificities should be saved. |
The sens.uno
and spec.uno
functions implement the estimators of
time-dependent true and false positive rates proposed in Section 5.1 of Uno et
al. (2007).
The AUC.uno
function implements the estimator of cumulative/dynamic AUC
that is based on the TPR and FPR estimators proposed by
Uno et al. (2007). It is given by the area(s) under the time-dependent
ROC curve(s) estimated by sens.sh
and spec.sh
. The iauc
summary measure is given by the integral of AUC on
[0, max(times
)] (weighted by the estimated probability density of
the time-to-event outcome).
Uno's estimators are based on inverse-probability-of-censoring
weights and do not assume a specific working model for deriving the predictor
lpnew
. It is assumed, however, that there is a one-to-one
relationship between the predictor and the expected survival times conditional
on the predictor. Note that the estimators implemented in sens.uno
,
spec.uno
and AUC.uno
are restricted to situations
where the random censoring assumption holds.
AUC.uno
returns an object of class survAUC
. Specifically,
AUC.uno
returns a list with the following components:
auc |
The cumulative/dynamic AUC estimates (evaluated at |
times |
The vector of time points at which AUC is evaluated. |
iauc |
The summary measure of AUC. |
sens.uno
and spec.uno
return matrices of dimensions times
x
(lpnew + 1)
. The elements of these matrices are the sensitivity and
specificity estimates for each threshold of lpnew
and for each time point
specified in times
.
Uno, H., T. Cai, L. Tian, and L. J. Wei (2007).
Evaluating prediction rules for
t-year survivors with censored regression models.
Journal of the American
Statistical Association 102, 527–537.
AUC.cd
, AUC.sh
, AUC.hc
,
IntAUC
data(cancer,package="survival") TR <- ovarian[1:16,] TE <- ovarian[17:26,] train.fit <- survival::coxph(survival::Surv(futime, fustat) ~ age, x=TRUE, y=TRUE, method="breslow", data=TR) lpnew <- predict(train.fit, newdata=TE) Surv.rsp <- survival::Surv(TR$futime, TR$fustat) Surv.rsp.new <- survival::Surv(TE$futime, TE$fustat) times <- seq(10, 1000, 10) AUC_Uno <- AUC.uno(Surv.rsp, Surv.rsp.new, lpnew, times) names(AUC_Uno) AUC_Uno$iauc
data(cancer,package="survival") TR <- ovarian[1:16,] TE <- ovarian[17:26,] train.fit <- survival::coxph(survival::Surv(futime, fustat) ~ age, x=TRUE, y=TRUE, method="breslow", data=TR) lpnew <- predict(train.fit, newdata=TE) Surv.rsp <- survival::Surv(TR$futime, TR$fustat) Surv.rsp.new <- survival::Surv(TE$futime, TE$fustat) times <- seq(10, 1000, 10) AUC_Uno <- AUC.uno(Surv.rsp, Surv.rsp.new, lpnew, times) names(AUC_Uno) AUC_Uno$iauc
C-statistic by Begg et al.
BeggC(Surv.rsp, Surv.rsp.new, lp, lpnew)
BeggC(Surv.rsp, Surv.rsp.new, lp, lpnew)
Surv.rsp |
A |
Surv.rsp.new |
A |
lp |
The vector of predictors estimated from the training data. |
lpnew |
The vector of predictors obtained from the test data. |
This function implements the C-statistic proposed by
Begg et al. (2000). It has the same interpretation as Harrell's C for
survival data (implemented in the rcorr.cens
function of the Hmisc
package). BeggC
is restricted to Cox regression.
Specifically, it is assumed that lp
and lpnew
are the predictors of
a Cox proportional hazards model. Estimates obtained from
BeggC
are valid as long as the Cox model is specified correctly.
The estimated C-statistic.
Begg, B. C., L. D. Craemer, E. S. Venkatraman and J. Rosai (2000).
Comparing tumor
staging and grading systems: a case study and a review of the issues, using thymoma as a model.
Statistics in Medicine 19, 1997–2014.
data(cancer,package="survival") TR <- ovarian[1:16,] TE <- ovarian[17:26,] train.fit <- survival::coxph(survival::Surv(futime, fustat) ~ age, x=TRUE, y=TRUE, method="breslow", data=TR) lp <- predict(train.fit) lpnew <- predict(train.fit, newdata=TE) Surv.rsp <- survival::Surv(TR$futime, TR$fustat) Surv.rsp.new <- survival::Surv(TE$futime, TE$fustat) Cstat <- BeggC(Surv.rsp, Surv.rsp.new, lp, lpnew) Cstat
data(cancer,package="survival") TR <- ovarian[1:16,] TE <- ovarian[17:26,] train.fit <- survival::coxph(survival::Surv(futime, fustat) ~ age, x=TRUE, y=TRUE, method="breslow", data=TR) lp <- predict(train.fit) lpnew <- predict(train.fit, newdata=TE) Surv.rsp <- survival::Surv(TR$futime, TR$fustat) Surv.rsp.new <- survival::Surv(TE$futime, TE$fustat) Cstat <- BeggC(Surv.rsp, Surv.rsp.new, lp, lpnew) Cstat
Gonen and Heller's Concordance Index for Cox proportional hazards models
GHCI(lpnew)
GHCI(lpnew)
lpnew |
The vector of predictors obtained from the test data. |
This function implements the concordance probability estimator proposed by
Gonen and Heller (2005). It has the same interpretation as Harrell's C for
survival data (implemented in the rcorr.cens
function of the Hmisc
package).
The results obtained from GHCI
are valid as long as lpnew
is the
predictor of a correctly specified Cox proportional hazards model. In this case, the
estimator remains valid even if the censoring times depend on the values of
the predictor.
Note that the smoothed version of GHCI
, which is proposed in Section 3 of
Gonen and Heller (2005), is not implemented in R package survAUC.
A length-one numeric vector containing the concordance probability estimate.
Harrell, F. E., R. M. Califf, D. B. Pryor, K. L. Lee and R. A. Rosati (1982).
Evaluating
the yield of medical tests.
Journal of the American Medical Association
247, 2543–2546.
Harrell, F. E., K. L. Lee, R. M. Califf, D. B. Pryor and R. A. Rosati (1984).
Regression
modeling strategies for improved prognostic prediction.
Statistics in Medicine
3, 143–152.
Gonen, M. and G. Heller (2005).
Concordance probability and discriminatory
power in proportional hazards regression.
Biometrika
92, 965–970.
data(cancer,package="survival") TR <- ovarian[1:16,] TE <- ovarian[17:26,] train.fit <- survival::coxph(survival::Surv(futime, fustat) ~ age, x=TRUE, y=TRUE, method="breslow", data=TR) lpnew <- predict(train.fit, newdata=TE) GHCI(lpnew)
data(cancer,package="survival") TR <- ovarian[1:16,] TE <- ovarian[17:26,] train.fit <- survival::coxph(survival::Surv(futime, fustat) ~ age, x=TRUE, y=TRUE, method="breslow", data=TR) lpnew <- predict(train.fit, newdata=TE) GHCI(lpnew)
Compute summary measures of a time-dependent AUC curve
IntAUC(AUC, times, S, tmax, auc.type="cumulative")
IntAUC(AUC, times, S, tmax, auc.type="cumulative")
AUC |
A vector of AUCs. |
times |
The vector of time points corresponding to |
S |
A vector of survival probabilities corresponding to |
tmax |
A number specifying the upper limit of the time range for which to compute the summary measure. |
auc.type |
A string defining the type of AUC. 'cumulative' refers to cumulative/dynamic AUC, 'incident' refers to incident/dynamic AUC. |
This function calculates the integral under a time-dependent AUC curve (“IAUC”
measure) using the integration limits [0, tmax
]. The values of the AUC curve are
specified via the AUC
argument.
In case auc.type = "cumulative"
(cumulative/dynamic IAUC), the values of
AUC
are weighted by the estimated probability density of
the time-to-event outcome. In case auc.type = "incident"
(incident/dynamic
IAUC), the values of AUC
are weighted by 2 times the product of the estimated
probability density and the (estimated) survival function of the time-to-event outcome.
The survival function has to be specified via the S
argument.
As shown by Heagerty and Zheng (2005), the incident/dynamic version of IAUC can be interpreted as a global concordance index measuring the probability that observations with a large predictor value have a shorter survival time than observations with a small predictor value. The incident/dynamic version of IAUC has the same interpretation as Harrell's C for survival data.
A scalar number corresponding to the summary measure of interest.
Harrell, F. E., R. M. Califf, D. B. Pryor, K. L. Lee and R. A. Rosati (1982).
Evaluating
the yield of medical tests.
Journal of the American Medical Association
247, 2543–2546.
Harrell, F. E., K. L. Lee, R. M. Califf, D. B. Pryor and R. A. Rosati (1984).
Regression
modeling strategies for improved prognostic prediction.
Statistics in Medicine
3, 143–152.
Heagerty, P. J. and Y. Zheng (2005).
Survival model predictive accuracy and
ROC curves.
Biometrics 61, 92–105.
AUC.cd
, AUC.sh
, AUC.uno
,
AUC.hc
data(cancer,package="survival") TR <- ovarian[1:16,] TE <- ovarian[17:26,] train.fit <- survival::coxph(survival::Surv(futime, fustat) ~ age, x=TRUE, y=TRUE, method="breslow", data=TR) lp <- predict(train.fit) lpnew <- predict(train.fit, newdata=TE) Surv.rsp <- survival::Surv(TR$futime, TR$fustat) Surv.rsp.new <- survival::Surv(TE$futime, TE$fustat) times <- seq(10, 1000, 10) AUC_CD <- AUC.cd(Surv.rsp, Surv.rsp.new, lp, lpnew, times) IntAUC(AUC_CD$auc, AUC_CD$times, runif(length(times),0,1), median(times), auc.type="cumulative")
data(cancer,package="survival") TR <- ovarian[1:16,] TE <- ovarian[17:26,] train.fit <- survival::coxph(survival::Surv(futime, fustat) ~ age, x=TRUE, y=TRUE, method="breslow", data=TR) lp <- predict(train.fit) lpnew <- predict(train.fit, newdata=TE) Surv.rsp <- survival::Surv(TR$futime, TR$fustat) Surv.rsp.new <- survival::Surv(TE$futime, TE$fustat) times <- seq(10, 1000, 10) AUC_CD <- AUC.cd(Surv.rsp, Surv.rsp.new, lp, lpnew, times) IntAUC(AUC_CD$auc, AUC_CD$times, runif(length(times),0,1), median(times), auc.type="cumulative")
R2-type Coefficients for Cox proportional hazards models
OXS(Surv.rsp, lp, lp0) Nagelk(Surv.rsp, lp, lp0) XO(Surv.rsp, lp, lp0)
OXS(Surv.rsp, lp, lp0) Nagelk(Surv.rsp, lp, lp0) XO(Surv.rsp, lp, lp0)
Surv.rsp |
A |
lp |
The vector of predictors. |
lp0 |
The vector of predictors obtained from the covariate-free null model. |
The OXS
, Nagelk
and XO
functions implement three types of R2 coefficients for right-censored
time-to-event data: (a) The coefficient proposed by O'Quigley et al. (2005) (OXS
), (b)
the coefficient proposed by Nagelkerke (1991) (Nagelk
) and (c) the
coefficient proposed by Xu and O'Quigley (1999) (XO
).
Because the OXS
, Nagelk
and XO
functions assume that lp
and lpnew
were
derived from a correctly specified Cox proportional hazards model, estimates obtained from these functions are only
valid if the Cox model holds.
The estimated R2 coefficient.
Nagelkerke, N. J. D. (1991).
A note on a general definition of the coefficient of
determination.
Biometrika 78, 691–692.
O'Quigley, J., R. Xu, and J. Stare (2005).
Explained randomness in proportional
hazards models.
Statistics in Medicine 24, 479–489.
Xu, R. and J. O'Quigley (1999).
A measure of dependence for proportional
hazards models.
Journal of Nonparametric Statistics 12, 83–107.
data(cancer,package="survival") TR <- ovarian[1:16,] TE <- ovarian[17:26,] train.fit <- survival::coxph(survival::Surv(futime, fustat) ~ age, x=TRUE, y=TRUE, method="breslow", data=TR) model0 <- survival::coxph(survival::Surv(futime, fustat)~1, data=TR) model1 <- survival::coxph(survival::Surv(futime, fustat)~age, data=TR) f0 <- rep(0,nrow(TE)) f1 <- predict(model1, newdata=TE) Surv.res <- survival::Surv(TE$futime, TE$fustat) OXS(Surv.res, f1, f0) Nagelk(Surv.res, f1, f0) XO(Surv.res, f1, f0)
data(cancer,package="survival") TR <- ovarian[1:16,] TE <- ovarian[17:26,] train.fit <- survival::coxph(survival::Surv(futime, fustat) ~ age, x=TRUE, y=TRUE, method="breslow", data=TR) model0 <- survival::coxph(survival::Surv(futime, fustat)~1, data=TR) model1 <- survival::coxph(survival::Surv(futime, fustat)~age, data=TR) f0 <- rep(0,nrow(TE)) f1 <- predict(model1, newdata=TE) Surv.res <- survival::Surv(TE$futime, TE$fustat) OXS(Surv.res, f1, f0) Nagelk(Surv.res, f1, f0) XO(Surv.res, f1, f0)
Plot a survAUC
object generated by the functions AUC.uno
,
AUC.sh
, AUC.cd
, AUC.hc
and
predErr
.
## S3 method for class 'survAUC' plot(x, col="red", type="l", ylim=c(0,1), xlab="Time",ylab="AUC", main="Time-dependent AUC", add=FALSE, ...) ## S3 method for class 'survErr' plot(x, col="red", type="l", ylim=c(0,1), xlab="Time",ylab="Prediction error", main="Time-dependent Prediction Error", add=FALSE, ...)
## S3 method for class 'survAUC' plot(x, col="red", type="l", ylim=c(0,1), xlab="Time",ylab="AUC", main="Time-dependent AUC", add=FALSE, ...) ## S3 method for class 'survErr' plot(x, col="red", type="l", ylim=c(0,1), xlab="Time",ylab="Prediction error", main="Time-dependent Prediction Error", add=FALSE, ...)
x |
An object of class |
col |
The color used to draw the AUC curve. |
type |
The type of plot to be drawn. See
argument 'type' of the |
ylim |
The y limits of the plot. |
xlab |
The title of the x axis. See |
ylab |
The title of the y axis. See |
main |
The main title of the plot. See |
add |
A logical specifying whether the AUC-Curve should be added to an already existing plot. |
... |
Graphics parameters that can be passed to 'plot'. |
AUC.sh
, AUC.cd
, AUC.hc
, AUC.uno
, predErr
data(cancer,package="survival") TR <- ovarian[1:16,] TE <- ovarian[17:26,] train.fit <- survival::coxph(survival::Surv(futime, fustat) ~ age, x=TRUE, y=TRUE, method="breslow", data=TR) lp <- predict(train.fit) lpnew <- predict(train.fit, newdata=TE) Surv.rsp <- survival::Surv(TR$futime, TR$fustat) Surv.rsp.new <- survival::Surv(TE$futime, TE$fustat) times <- seq(10, 600, 10) AUC_sh <- AUC.sh(Surv.rsp, Surv.rsp.new, lp, lpnew, times) plot(AUC_sh) abline(h = 0.5) BrierScore <- predErr(Surv.rsp, Surv.rsp.new, lp, lpnew, times, type = "brier", int.type = "weighted") plot(BrierScore) abline(h = 0.25)
data(cancer,package="survival") TR <- ovarian[1:16,] TE <- ovarian[17:26,] train.fit <- survival::coxph(survival::Surv(futime, fustat) ~ age, x=TRUE, y=TRUE, method="breslow", data=TR) lp <- predict(train.fit) lpnew <- predict(train.fit, newdata=TE) Surv.rsp <- survival::Surv(TR$futime, TR$fustat) Surv.rsp.new <- survival::Surv(TE$futime, TE$fustat) times <- seq(10, 600, 10) AUC_sh <- AUC.sh(Surv.rsp, Surv.rsp.new, lp, lpnew, times) plot(AUC_sh) abline(h = 0.5) BrierScore <- predErr(Surv.rsp, Surv.rsp.new, lp, lpnew, times, type = "brier", int.type = "weighted") plot(BrierScore) abline(h = 0.25)
Inverse-probability-of-censoring weighted estimators of absolute and squared deviations between survival functions
predErr(Surv.rsp, Surv.rsp.new, lp, lpnew, times, type = "brier", int.type = "unweighted")
predErr(Surv.rsp, Surv.rsp.new, lp, lpnew, times, type = "brier", int.type = "unweighted")
Surv.rsp |
A |
Surv.rsp.new |
A |
lp |
The vector of predictors estimated from the training data. |
lpnew |
The vector of predictors obtained from the test data. |
times |
A vector of time points at which to evaluate the prediction error curve. |
type |
A string specifying the type of prediction error curve: 'brier' refers to the squared deviation between predicted and observed survival (Brier score), 'robust' refers to the absolute deviation between predicted and observed survival. |
int.type |
A string specifying the type of integration method for the prediction error curves. Either 'unweighted' or 'weighted'. |
This function implements two types of prediction error curves for right-censored
time-to-event data: The Brier Score (type = "brier"
, Gerds and Schumacher 2006) estimates the squared
deviation between predicted and observed survival whereas the method proposed
by Schmid et al. (2011) estimates the absolute deviation between predicted and
observed survival (type = "robust"
).
Both methods are based on inverse-probability-of-censoring
weights and do not assume a specific working model for survival prediction.
Note, however, that the estimators implemented in predErr
,
are restricted to situations where the random censoring assumption holds.
Time-independent summary measures of prediction error are given by the
the areas under the prediction error curves. If int.type = "weighted"
,
prediction errors are weighted by the estimated probability density of
the time-to-event outcome.
predErr
returns an object of class survErr
. Specifically,
predErr
returns a list containing the following components:
error |
The prediction error estimates (evaluated at |
times |
The vector of time points at which prediction errors are evaluated. |
ierror |
The integrated prediction error. |
Gerds, T. A. and M. Schumacher (2006).
Consistent estimation of the expected
Brier score in general survival models with right-censored event times.
Biometrical Journal 48, 1029–1040.
Schmid, M., T. Hielscher, T. Augustin, and O. Gefeller (2011).
A robust alter-
native to the Schemper-Henderson estimator of prediction error.
Biometrics
67, 524–535.
data(cancer,package="survival") TR <- ovarian[1:16,] TE <- ovarian[17:26,] train.fit <- survival::coxph(survival::Surv(futime, fustat) ~ age, x=TRUE, y=TRUE, method="breslow", data=TR) lp <- predict(train.fit) lpnew <- predict(train.fit, newdata=TE) Surv.rsp <- survival::Surv(TR$futime, TR$fustat) Surv.rsp.new <- survival::Surv(TE$futime, TE$fustat) times <- 1:500 predErr(Surv.rsp, Surv.rsp.new, lp, lpnew, times, type = "brier", int.type = "unweighted") predErr(Surv.rsp, Surv.rsp.new, lp, lpnew, times, type = "robust", int.type = "unweighted") predErr(Surv.rsp, Surv.rsp.new, lp, lpnew, times, type = "brier", int.type = "weighted")
data(cancer,package="survival") TR <- ovarian[1:16,] TE <- ovarian[17:26,] train.fit <- survival::coxph(survival::Surv(futime, fustat) ~ age, x=TRUE, y=TRUE, method="breslow", data=TR) lp <- predict(train.fit) lpnew <- predict(train.fit, newdata=TE) Surv.rsp <- survival::Surv(TR$futime, TR$fustat) Surv.rsp.new <- survival::Surv(TE$futime, TE$fustat) times <- 1:500 predErr(Surv.rsp, Surv.rsp.new, lp, lpnew, times, type = "brier", int.type = "unweighted") predErr(Surv.rsp, Surv.rsp.new, lp, lpnew, times, type = "robust", int.type = "unweighted") predErr(Surv.rsp, Surv.rsp.new, lp, lpnew, times, type = "brier", int.type = "weighted")
Schemper and Henderson's estimator of the absolute deviation between survival functions
schemper(train.fit, traindata, newdata)
schemper(train.fit, traindata, newdata)
train.fit |
A |
traindata |
A data frame containing the set of training data. |
newdata |
A data frame containing the set of test data. |
This code has been adapted from Lusa et al. (2007). Schemper and Henderson's estimator (as implemented by Lusa et al. 2007) assumes that predictions of the time-to-event outcome were obtained from a Cox proportional hazards model. The estimator is valid as long as the Cox model is specified correctly.
Technical details:
The Cox model has to be estimated via the cph
function of the
Design package.
The survival times and the censoring indicators have to be labelled “time” and “status”, respectively (see example below).
In contrast to the other estimators implemented in the survAUC package,
schemper
does not estimate the survival function of the censoring distribution
from the training data but from the test data.
For details on the estimator and its implementation, we refer to Schemper and Henderson (2000) and Lusa et al. (2007).
schemper
returns a list with the following components:
Model |
The call to |
D |
The estimator of predictive accuracy obtained from the covariate-free null model. |
Dx |
The estimator of predictive accuracy obtained from the Cox model. |
V |
The estimator of relative gains in predictive accuracy. |
Mhat |
The absolute distance estimator obtained from the Cox model (evaluated at the event times of the test data). |
Mhat.0 |
The absolute distance estimator obtained from the covariate-free null model (evaluated at the event times of the test data). |
timep |
The event times of the test data. |
Schemper, M. and R. Henderson (2000).
Predictive accuracy and explained
variation in Cox regression.
Biometrics 56, 249–255.
Lusa, L., R. Miceli and L. Mariani (2007).
Estimation of predictive accuracy in
survival analysis using R and S-PLUS.
Computer Methods and Programms in Biomedicine 87, 132–137.
data(cancer,package="survival") ovarian$time <- ovarian$futime ovarian$status <- ovarian$fustat set.seed(2011) trobs <- sample(1:26,16) TR <- ovarian[trobs,] TE <- ovarian[-trobs,] train.fit <- rms::cph(survival::Surv(time, status) ~ age, x=TRUE, y=TRUE, method="breslow", data=TR) schemper(train.fit, TR, TE)
data(cancer,package="survival") ovarian$time <- ovarian$futime ovarian$status <- ovarian$fustat set.seed(2011) trobs <- sample(1:26,16) TR <- ovarian[trobs,] TE <- ovarian[-trobs,] train.fit <- rms::cph(survival::Surv(time, status) ~ age, x=TRUE, y=TRUE, method="breslow", data=TR) schemper(train.fit, TR, TE)
Censoring-adjusted C-statistic by Uno et al.
UnoC(Surv.rsp, Surv.rsp.new, lpnew, time = NULL)
UnoC(Surv.rsp, Surv.rsp.new, lpnew, time = NULL)
Surv.rsp |
A |
Surv.rsp.new |
A |
lpnew |
The vector of predictors obtained from the test data. |
time |
A positive number restricting the upper limit of the time range under consideration. |
This function implements the censoring-adjusted C-statistic proposed by
Uno et al. (2011). It has the same interpretation as Harrell's C for
survival data (implemented in the rcorr.cens
function of the Hmisc
package).
Uno's estimator is based on inverse-probability-of-censoring
weights and does not assume a specific working model for deriving the predictor
lpnew
. It is assumed, however, that there is a one-to-one
relationship between the predictor and the expected survival times conditional
on the predictor. Note that the estimator implemented in UnoC
is restricted to situations where the random censoring assumption holds.
The estimated C-statistic.
Harrell, F. E., R. M. Califf, D. B. Pryor, K. L. Lee and R. A. Rosati (1982).
Evaluating
the yield of medical tests.
Journal of the American Medical Association
247, 2543–2546.
Harrell, F. E., K. L. Lee, R. M. Califf, D. B. Pryor and R. A. Rosati (1984).
Regression
modeling strategies for improved prognostic prediction.
Statistics in Medicine
3, 143–152.
Uno, H., T. Cai T, M. J. Pencina, R. B. D'Agostino and W. L. Wei (2011).
On the
C-statistics for evaluating overall adequacy of risk prediction procedures with censored
survival data.
Statistics in Medicine 30, 1105–1117.
data(cancer,package="survival") TR <- ovarian[1:16,] TE <- ovarian[17:26,] train.fit <- survival::coxph(survival::Surv(futime, fustat) ~ age, x=TRUE, y=TRUE, method="breslow", data=TR) lpnew <- predict(train.fit, newdata=TE) Surv.rsp <- survival::Surv(TR$futime, TR$fustat) Surv.rsp.new <- survival::Surv(TE$futime, TE$fustat) Cstat <- UnoC(Surv.rsp, Surv.rsp.new, lpnew) Cstat
data(cancer,package="survival") TR <- ovarian[1:16,] TE <- ovarian[17:26,] train.fit <- survival::coxph(survival::Surv(futime, fustat) ~ age, x=TRUE, y=TRUE, method="breslow", data=TR) lpnew <- predict(train.fit, newdata=TE) Surv.rsp <- survival::Surv(TR$futime, TR$fustat) Surv.rsp.new <- survival::Surv(TE$futime, TE$fustat) Cstat <- UnoC(Surv.rsp, Surv.rsp.new, lpnew) Cstat