[R] Median expected survival

Andrews, Chris chrisaa at med.umich.edu
Fri Jul 11 13:46:41 CEST 2014

Hi Lars,

Graph it:


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.


-----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).





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))

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

  predictors(s) not in model: data

Thank you for your help.



	[[alternative HTML version deleted]]

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

More information about the R-help mailing list