Description Usage Arguments Details Value Author(s) Examples
Calculate concordance index
1 2 3 4 5 6 7 8 9 |
prob |
predicted risk of failure event, either probability or risk score |
fstatus |
failure(event) variable |
ftime |
follow-up time variable for survival or competing risks predictions |
type |
type of regression models corresponding to different type of outcomes. 'logis' is the default value for binary outcome, 'surv' for ordinary survival outcome and 'crr' for competing risks outcome. |
failcode |
coding for failure(event). 1 is the default value. |
cencode |
coding for censoring. 0 is the defaul |
tol |
error tolerance. the default value is 1e-20. |
to calculate the discrimination metric, concordance index for binary, time-to event and competing risks outcomes
a vector of returned values.
N |
the total number of observations in the input data |
n |
the nonmissing number of observations that was used f or calculation |
usable |
the total number of usable pairs. |
oncordant |
the number of concordant pairs |
cindex |
the concordance index that equal to the number of concordant pairs divided by the total number of usable pairs. |
Changhong Yu, Michael Kattan, Brian Wells, Amy Nowacki.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | seed <- 5555
# simulated data to test the function
n <- 20000
ftime <- rexp(n)
fstatus <- sample(0:2,n,replace=TRUE)
cov <- matrix(runif(3*n),nrow=n)
dimnames(cov)[[2]] <- c('x1','x2','x3')
dat <- data.frame(ftime,fstatus,cov)
require(Design)
print(z <- cph(Surv(ftime,fstatus == 1) ~ x1 + x2 + x3,data = dat))
# summary(z)
z.p <- predict(z)
#debug(cindex)
cindex(prob=z.p,fstatus=fstatus,type="logis")
cindex(prob=z.p,fstatus=fstatus,ftime=ftime,type="surv")
cindex(prob=z.p,fstatus=fstatus,ftime=ftime,type="crr")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.