[R] How do i compute predicted failure time from a cox model?
Frank E Harrell Jr
f.harrell at vanderbilt.edu
Mon Feb 16 15:06:15 CET 2009
Eleni Rapsomaniki wrote:
> Given a cox model:
>
> library(Hmisc); library(survival); (library(Design);
> cox.model=cph(Surv(futime, fustat) ~ age, data=ovarian, surv=T)
> str(cox.model)
>
> What I need is the total estimated time until failure (death), not the probability of failing at a given time (survival probability), or hazard etc, which is what I get from survest and predict for example.
>
> I suspect the answer is embarrassing simple...
>
> (BTW sorry for the duplicate email, the earlier HTML version of my message could not be viewed)
> Eleni Rapsomaniki
>
> Research Associate
> Strangeways Research Laboratory
> Department of Public Health and Primary Care
>
Eleni,
You can't get the predicted mean from a Cox model unless the longest
followed subject died. You can get the mean restricted life:
library(Design) # implies Hmisc and survival
f <- cph(..., surv=TRUE)
M <- Mean(f, tmax=3) # area under S(t) from 0 to 3 time units
M( ) # evaluate the mean at a vector of linear predictor values
M(predict(f, data.frame( ))) # evaluate at user-chosen predictor values
The mean restricted life is the life expectency given failure before
time tmax. You have to use a parametric model to get the unrestricted
mean lifetime estimate.
Also see the Quantile function in Design to derive a function to
estimate various quantiles of survival time. In Design, functions
beginning with an upper case letter (like Mean, Quantile, Function,
Hazard) are function generators.
Frank
>
>
--
Frank E Harrell Jr Professor and Chair School of Medicine
Department of Biostatistics Vanderbilt University
More information about the R-help
mailing list