On Jul 5, 2014, at 5:28 AM, Axel Urbiz wrote:
> Dear R users,
>
> My apologies for the simple question, as I'm starting to learn the
> concepts
> behind the Cox PH model. I was just experimenting with the survival
> and rms
> packages for this.
>
> I'm simply trying to obtain the expected survival time (as opposed
> to the
> probability of survival at a given time t).
What does "expected survival time" actually mean? Do you want the
median survival time?
> I can't seem to find an option
> from the "type" argument in the predict methods from
coxph{survival}
> or
> cph{rms} that will give me expected survival times.
>
> library(rms)
> options(na.action=na.exclude) # retain NA in predictions
> fit <- coxph(Surv(time, status) ~ age + ph.ecog, lung)
> fit2 <- cph(Surv(time, status) ~ age + ph.ecog, lung)
> head(predict(fit,type="lp"))
> head(predict(fit2,type="lp"))
`predict` will return the results of the regression, i.e. the log-
hazard ratios for each term in the RHS of the formula. What you want
(as described in the Index for the survival package) is either
`survfit` or `survexp`.
require(survival)
help(pack=survival)
?survfit
?survexp
?summary.survfit
?quantile.survfit # to get the median
?print.summary.survfit
require(rms)
help(pack=rms)
The rms-package also adds a `survfit.cph` function but I have found
the `survest` function also provides useful added features, beyond
those offered by survfit
>
>
> Thank you.
>
> Regards,
> Axel.
>
> [[alternative HTML version deleted]]
This is a plain text mailing list.
--
David Winsemius, MD
Alameda, CA, USA