[R] Survival Analysis and Predict time-to-death

Göran Broström goran.brostrom at umu.se
Tue Aug 18 22:46:55 CEST 2015



On 2015-08-18 01:44, David Winsemius wrote:
>
> On Aug 17, 2015, at 1:51 PM, David Winsemius wrote:
>
>>
>> On Aug 17, 2015, at 12:10 PM, survivalUser wrote:
>>
>>> Dear All,
>>>
>>> I would like to build a model, based on survival analysis on some
>>> data, that is able to predict the /*expected time until death*/
>>> for a new data instance.
>>
>> Are you sure you want to use life expectancy as the outcome? In
>> order to establish a mathematical expectation  you need to have
>> know the risk at all time in the future, which as pointed out in
>> the print.survfit help page is undefined unless the last
>> observation is a death. Very few datasets support such an estimate.
>> If on the other hand you have sufficient events in the future, then
>> you may be able to more readily justify an estimate of a median
>> survival.
>
> Dear survivalUser;
>
> I've been reminded that you later asked for a parametric model built
> with survreg. The above commentary applies to the coxph models and
> objects and not to survreg objects. If you do have a parametric
> model, even with incomplete observation then calculating life
> expectancy should be a simple matter of plugging the parameters for
> the distribution's mean value, since life-expectancy is the
> statistical mean. So maybe you do want such a modle. The default
> survreg  distribution is "weibull" so just go to your mathematical
> statistics text and look up the formula for the mean of a Weibull
> distribution with the estimated parameters.
>
No need for 'the mathematical statistics text': The necessary 
information is found on the help page for the Weibull distribution: E(T) 
=  b Gamma(1 + 1/a), where 'b' is scale (really!) and 'a' is shape. You 
must however take into account the special parametrization that is used 
by 'survreg'; see its help page for how to do it.

Alternatively, use 'aftreg' in the package 'eha' and get the same 
parametrization as in base  R.

After getting the baseline expectation by the formula above, simply 
multiply that value by exp(-lp) to get the expected life for an 
individual with linear predictor lp.

A useful alternative is simulation (use 'rweibull') or numerical 
integration, especially for estimating remaining expected life 'later in 
life'. And for other distributions than the Weibull.


Göran Broström
(author of the eha package)



More information about the R-help mailing list