3
$\begingroup$

I'm currently trying to make some simple models of client lifetime value. I'm using the following simplified formula for some survival analysis on client values

fit1 <- coxph( Surv(Start, Start + Time, Death) ~ Service, survData)

I can call basehaz on fit1 and obtain the following cumulative hazard table (this is just the head of the table.

haztable <- basehaz(fit1)

        hazard time
1  0.01091445    2
2  0.04350026    3
3  0.07699729    4
4  0.12015616    5
5  0.16105550    6
6  0.19153200    7
7  0.22920218    9

What I would like to do now is to use this data and hazard rate information to calculate the expected survival times, but I'm running into errors.

survexp(fit1, survData, ratetable=haztable) for example gets me the Invalid rate table error. The default ratetable seems to be taken from the US census data table. I'm unclear as to how to proceed to define my own and call it.

Can anybody advise?

$\endgroup$
3
+50
$\begingroup$

The function "survexp" provides survival probabilities at different time points. In your example, you could obtain them using

survexp(~Service, ratetable=fit1, data = survData)

Since you are interested in expected survival times (rather than survival probabilities at different time points), you should follow the discussion in Prediction in Cox regression and e.g. get group medians by calling

 survfit(fit1, newdata = survData)
$\endgroup$
  • $\begingroup$ Ok, that's great answer does what I asked and a bit more. I suspect I will award you the loot, but I'll just wait a few hours to see if anyone else surpasses this (I doubt it). $\endgroup$ – Simon Hayward Oct 7 '13 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.