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?