imbs-hl / survivalsvm

Survival Support Vector Analysis
16 stars 8 forks source link

Calculation of the concordance index #2

Open annette987 opened 5 years ago

annette987 commented 5 years ago

I followed the example from your paper (see below) and then tried to compute the concordance index using your function conindex. But I get a much lower value than you achieved. Similarly when I run the same test on my own data I get a very low concordance index using conindex.

  1. How did you calculate the c-index values reported in your paper?
  2. Am I doing something wrong?
data(veteran, package = "survival")
set.seed(123)
n <- nrow(veteran)
train.index <- sample(1:n, 0.7 * n, replace = FALSE)
test.index <- setdiff(1:n, train.index)

survsvm.reg <- survivalsvm(Surv(diagtime, status) ~ .,
                           subset = train.index, data = veteran,
                           type = "regression", gamma.mu = 1,
                           opt.meth = "quadprog", kernel = "add_kernel")

print(survsvm.reg)

pred.survsvm.reg <- predict(object = survsvm.reg,
                            newdata = veteran, subset = test.index)

print(pred.survsvm.reg)
conindex(pred.survsvm.reg, veteran$time[test.index])
survivalsvm result

Call:

 survivalsvm(Surv(diagtime, status) ~ ., subset = train.index, data = veteran, type = "regression", gamma.mu = 1, opt.meth = "quadprog", kernel = "add_kernel") 

Survival svm approach              : regression 
Type of Kernel                     : add_kernel 
Optimization solver used           : quadprog 
Number of support vectors retained : 39 
survivalsvm version                : 0.0.5 

survivalsvm prediction

Type of survivalsvm                      : regression 
Type of kernel                           : add_kernel 
Optimization solver used in model        : quadprog 
predicted risk ranks                     : 13.89 14.95 11.12 15.6 10.7 ...
survivalsvm version                      : 0.0.5 
  C Index 
0.5005848 
mnwright commented 5 years ago

Ouch, I think we have a typo in that example. The time variable in the veteran data is called time and not diagtime. It should read

survsvm.reg <- survivalsvm(Surv(time, status) ~ .,
                           subset = train.index, data = veteran,
                           type = "regression", gamma.mu = 1,
                           opt.meth = "quadprog", kernel = "add_kernel")

@fouodo Don't we need the censoring status to calculate the C-index? I'll open a pull request for that. See #3.

@annette987 In the meantime, you could use

Hmisc::rcorr.cens(pred.survsvm.reg$predicted, Surv(veteran$time[test.index], veteran$status[test.index]))

to calculate the C-index.