I am currently experimenting with survival analysis in R. One important Model is the Cox Proportional Hazard Model. Using the default lung data the R enviroment provides, I would like to play with the model, using the mlr-package.
My code:
data("lung") # get data
lung = na.omit(lung) # remove rows with missing values
lung$status = (lung$status == 2) # convert to logical
n = nrow(lung)
lung.train = sample(n, size = 0.8*n)
lung.test = setdiff(1:n, train.set)
# cox proportional hazard
coxph.lrn = makeLearner("surv.coxph")
coxph.tsk = makeSurvTask(data = lung, target = c("time", "status"))
coxph.mod = train(coxph.lrn, coxph.tsk, subset = lung.test)
coxph.tsk.pred = predict(coxph.mod, task = coxph.tsk, subset = lung.test)
The output of coxph.tsk.pred
will be the following:
Prediction: 35 observations
predict.type: response
threshold:
time: 0.00
id truth.time truth.event response
4 2 210 TRUE 1.1528966
21 13 301 TRUE 0.1532789
30 20 12 TRUE 1.9269353
31 21 473 TRUE -0.3327164
35 24 53 TRUE 2.0432497
41 29 460 TRUE 0.3784922
... (#rows: 35, #cols: 4)
Question 1: What does response
tell me?
Assumption: exp(response) is the risk ratio between an individual and the average individual. Is this correct?
Question 2: I can use the concordance index to measure the performance of models predictions, using
performance(coxph.tsk.pred, measures = cindex)
# output: 0.79
What does the 0.79 tell me?
Assumption: Cindex compares, if two individuals are concordant and outputs 1, if the are. In this case in my understanding cindex should compare the predicted risk of patients and have a look, if a patient with higher risk dies earlier than one with lower risk. This model seems to predict that correctly in ~80% of the cases. Is my assumption correct?