Title: | Concordance Probability Estimates in Survival Analysis |
---|---|
Description: | Concordance probability estimate (CPE) is a commonly used performance measure in survival analysis that evaluates the predictive accuracy of a survival model. It measures how well a model can distinguish between pairs of individuals with different survival times. Specifically, it calculate the proportion of all pairs of individuals whose predicted survival times are correctly ordered. |
Authors: | Qianxing Mo [aut, cre], Mithat Gonen [ctb], Glenn Heller [ctb] |
Maintainer: | Qianxing Mo <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.6.3 |
Built: | 2024-10-31 06:44:18 UTC |
Source: | CRAN |
A function to calculate Gonen and Heller concordance probability estimate (CPE) for the Cox proportional hazards model.
phcpe(coxfit, CPE.SE=FALSE,out.ties=FALSE)
phcpe(coxfit, CPE.SE=FALSE,out.ties=FALSE)
coxfit |
A coxph or cph object |
CPE.SE |
A logical value indicating whether the standard error of the CPE should be calculated |
out.ties |
If out.ties is set to FALSE,pairs of observations tied on covariates will be used to calculate the CPE. Otherwise, they will not be used. |
CPE |
Concordance Probability Estimate |
CPE.SE |
the Standard Error of the Concordance Probability Estimate |
Qianxing Mo, Mithat Gonen and Glenn Heller; [email protected]
Mithat Gonen and Glenn Heller. (2005). Concordance probability and discriminatory power in proportional hazards regression. Biometrika, 92, 4, pp.965-970 Glenn Heller and Qianxing Mo. (2016). Estimating the concordance probability in a survival analysis with a discrete number of risk groups. Lifetime Data Analysis, 22(2):263-79.
### create a simple data set for testing set.seed(199) nn <- 1000 time <- rexp(nn) status <- sample(0:1, nn, replace=TRUE) covar <- matrix(rnorm(3*nn), ncol=3) survd <- data.frame(time, status, covar) names(survd) <- c("time","status","x1","x2","x3") coxph.fit <- coxph(Surv(time,status)~x1+x2+x3,data=survd) ### Calculate CPE only (needs much less time). phcpe(coxph.fit) phcpe(coxph.fit,out.ties=TRUE) #result is identical because the covariates are not tied # ### Calculate CPE and CPE.SE phcpe(coxph.fit, CPE.SE=TRUE) phcpe(coxph.fit, CPE.SE=TRUE,out.ties=TRUE) #*** For unknown reason, 'coxph.fit' may need to be removed before running cph()*** rm(coxph.fit) cph.fit <- cph(Surv(time, status)~x1+x2+x3, data=survd,method="breslow") ### Calculate CPE only (needs much less time). phcpe(cph.fit) phcpe(cph.fit,out.ties=TRUE) ### Calculate CPE and CPE.SE phcpe(cph.fit, CPE.SE=TRUE) phcpe(cph.fit, CPE.SE=TRUE,out.ties=TRUE)
### create a simple data set for testing set.seed(199) nn <- 1000 time <- rexp(nn) status <- sample(0:1, nn, replace=TRUE) covar <- matrix(rnorm(3*nn), ncol=3) survd <- data.frame(time, status, covar) names(survd) <- c("time","status","x1","x2","x3") coxph.fit <- coxph(Surv(time,status)~x1+x2+x3,data=survd) ### Calculate CPE only (needs much less time). phcpe(coxph.fit) phcpe(coxph.fit,out.ties=TRUE) #result is identical because the covariates are not tied # ### Calculate CPE and CPE.SE phcpe(coxph.fit, CPE.SE=TRUE) phcpe(coxph.fit, CPE.SE=TRUE,out.ties=TRUE) #*** For unknown reason, 'coxph.fit' may need to be removed before running cph()*** rm(coxph.fit) cph.fit <- cph(Surv(time, status)~x1+x2+x3, data=survd,method="breslow") ### Calculate CPE only (needs much less time). phcpe(cph.fit) phcpe(cph.fit,out.ties=TRUE) ### Calculate CPE and CPE.SE phcpe(cph.fit, CPE.SE=TRUE) phcpe(cph.fit, CPE.SE=TRUE,out.ties=TRUE)
A function to calculate Gonen and Heller concordance probability estimate (CPE) for the Cox proportional hazards model.
phcpe2(coef,coef.var,design, CPE.SE=FALSE,out.ties=FALSE)
phcpe2(coef,coef.var,design, CPE.SE=FALSE,out.ties=FALSE)
coef |
The coefficients of the Cox model. |
coef.var |
The covariance matrix of the coefficients of the Cox model. |
design |
A design matrix for covariates. The rows correspond to subjects, and the columns correspond to covariates. |
CPE.SE |
A logical value indicating whether the standard error of the CPE should be calculated |
out.ties |
If out.ties is set to FALSE,pairs of observations tied on covariates will be used to calculate the CPE. Otherwise, they will not be used. |
CPE |
Concordance Probability Estimate |
CPE.SE |
the Standard Error of the Concordance Probability Estimate |
Qianxing Mo, Mithat Gonen and Glenn Heller; [email protected]
Mithat Gonen and Glenn Heller. (2005). Concordance probability and discriminatory power in proportional hazards regression. Biometrika, 92, 4, pp.965-970 Glenn Heller and Qianxing Mo. (2016). Estimating the concordance probability in a survival analysis with a discrete number of risk groups. Lifetime Data Analysis, 22(2):263-79.
### create a simple data set for testing set.seed(199) nn <- 1000 time <- rexp(nn) status <- sample(0:1, nn, replace=TRUE) covar <- matrix(rnorm(3*nn), ncol=3) survd <- data.frame(time, status, covar) names(survd) <- c("time","status","x1","x2","x3") coxph.fit <- coxph(Surv(time,status)~x1+x2+x3,data=survd) phcpe(coxph.fit,CPE.SE=TRUE) phcpe2(coef=coxph.fit$coefficients,coef.var=coxph.fit$var,design=model.matrix(coxph.fit)) #*** For unknown reason, 'coxph.fit' may need to be removed before running cph()*** rm(coxph.fit) cph.fit <- cph(Surv(time, status)~x1+x2+x3, data=survd,method="breslow") ### Calculate CPE only (needs much less time). phcpe2(cph.fit$coefficients,coef.var=cph.fit$var,design=model.matrix(cph.fit),CPE.SE=TRUE)
### create a simple data set for testing set.seed(199) nn <- 1000 time <- rexp(nn) status <- sample(0:1, nn, replace=TRUE) covar <- matrix(rnorm(3*nn), ncol=3) survd <- data.frame(time, status, covar) names(survd) <- c("time","status","x1","x2","x3") coxph.fit <- coxph(Surv(time,status)~x1+x2+x3,data=survd) phcpe(coxph.fit,CPE.SE=TRUE) phcpe2(coef=coxph.fit$coefficients,coef.var=coxph.fit$var,design=model.matrix(coxph.fit)) #*** For unknown reason, 'coxph.fit' may need to be removed before running cph()*** rm(coxph.fit) cph.fit <- cph(Surv(time, status)~x1+x2+x3, data=survd,method="breslow") ### Calculate CPE only (needs much less time). phcpe2(cph.fit$coefficients,coef.var=cph.fit$var,design=model.matrix(cph.fit),CPE.SE=TRUE)