Skip to content

Median expected survival

3 messages · Lars Bishop, Marco Barbàra, Andrews, Chris

#
Hi, Lars.

I don't understand well your question. why don't you simply type

 pred_leuk

Call: survfit(formula = leuk.cox, newdata = leuk_new)

   records n.max n.start events median 0.95LCL 0.95UCL
1       42    42      42     30      1       1      23
2       42    42      42     30      7       5      NA
3       42    42      42     30     15      10      NA
4       42    42      42     30     NA      NA      NA
5       42    42      42     30      8       5      NA
6       42    42      42     30     23      22      NA
7       42    42      42     30      8       6      NA
8       42    42      42     30     NA      22      NA
9       42    42      42     30      6       4      NA
10      42    42      42     30     23      17      NA

Yes, the quantile method returns the correct medians. The NAs usually
appear when the unit belongs to a category for which median survival
time has not yet been reached, so there is no way for the model to
estimate the median time. You can see the expected survival curve with
plot(predl_leuk)
1 day later
#
Hi Lars,

Graph it:

plot(pred_leuk)

will show that some of the survival curves do not reach 0.5 before you run out of data.  Thus the median is not estimated and you get NA.

Chris

-----Original Message-----
From: Lars Bishop [mailto:lars52r at gmail.com] 
Sent: Thursday, July 10, 2014 6:23 AM
To: r-help at r-project.org
Subject: [R] Median expected survival

Hi All,

Apologies for the simple question, but I could not find a straightforward
answer based on my limited knowledge of survival analysis.

I?m trying to obtain the predicted median survival time for each subject on
a new dataset from a fitted coxph{survival} or cph{rms} object. Would the
quantile.survfit function (as used below) return the expected median
survival? Why this function returns NAs in this case, when all predictors
have non-missing values?

As an alternative, I?ve tried to use the Quntile{rms} function as in my
second chunk of code, but in this case I get an error message (most likely
due to my lack of understanding as well).

library(MASS)

library(survival)

library(rms)

data(gehan)

leuk.cox <-coxph(Surv(time, cens) ~ treat + factor(pair), data = gehan)

leuk_new <- gehan[1:10, ] # take first 10 patients

pred_leuk <- survfit(leuk.cox, newdata=leuk_new)

quantile(pred_leuk, 0.5)$quantile



### alternative using rms

leuk.cox.rms <-cph(Surv(time, cens) ~ treat + factor(pair), data = gehan,
surv = T)

med <- Quantile(leuk.cox.rms)

Predict(leuk.cox.rms, data = leuk_new, fun=function(x)med(lp=x))
x)) :

  predictors(s) not in model: data


Thank you for your help.

Best,

Lars.



**********************************************************
Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues