0
$\begingroup$

I have developed a survival model using Cox Regression. The aim is to obtain individual probabilities of survival on a given date or time. Now the steps used are:

fit<-coxph(Surv(time,status=0)~$X_1+X_2+X_3+X_4+.....+X_p$)

summary(fit)
cox_fit<-survfit(fit)
cox_lp_predict<-predict(fit,type='lp')
basehaz_cox<-basehaz(fit)

individual_probability_at_t1<-as.data.frame(exp(-b_1)^(exp(cox_lp_predict)))
individual_probability_at_t2<-as.data.frame(exp(-b_2)^(exp(cox_lp_predict)))

fit<-coxph(Surv(time,status=0)~$X_1+X_2+X_3+X_4+.....+X_p$)Here status =0 because we want to analyse those observations where status=0, infact in my case status is churn flag=0$=>$ No churn,1$=>$Churn

cox_lp_predict<-predict(fit,type='lp')#This step is to find $X_1\beta_1+X_2\beta_2+.....+x_p\beta_p$ for each observation

basehaz_cox<-basehaz(fit)#Now let's say after obtaining the base hazard we get the cumulative base hazard i.e $H_0(t)$ at $t=t_1$ is $=b_1$

And let's say after obtaining the base hazard we get the cumulative base hazard using basehaz_cox<-basehaz(fit) i.e $H_0(t)$ at $t=t_2$ is $=b_2$

individual_probability_at_t1<-as.data.frame(exp(-b_1)^(exp(cox_lp_predict)))This is in line with the formula $S(t|X)=exp(-\int_0^t h_0(t)dt)^{exp(\beta_1x_1+...\beta_px_p)}=S(t|X)=exp(-H_0(t))^{exp(\beta_1x_1+...\beta_px_p)}$

Now my question is that when we obtain an appended dataframe i.e

Merged_individual_prob_at_t1_t2<-merge(individual_probability_at_t1$Probability_at_t1,individual_probability_at_t2$Probability_at_t2)

We get a table like this :

Serial No.   Prob(T>230)  Prob(T>360)   Prob(T>500)
1            0.1125       0.3455        0.3221
2            0.2344       0.3244        0.2877
3            0.2556       0.4456        0.3211

And so on.

My question exactly here for certain observations like the ones I show above the survival probability increases for a certain duration of time and then it reduces like the above table. Mind it most of the observations show a decreasing survival probability over the three time instances calculated but for some of them this increasing trend for a certain period comes and then it again starts reducing. My question is why does this happen? Is my approach correct? If not rectify me anywhere,please help.

$\endgroup$
  • 2
    $\begingroup$ The question as it is presented now is pretty messy. You should run diagnostics and figure out exactly where the logic breaks down and ask a specific question for that specific step. $\endgroup$ – user2974951 Oct 2 '18 at 7:45
  • $\begingroup$ First how to obtain individual probabilities of each individual at time t?Second, how do I interpret the increase and then decrease in survival probabilities of certain individuals over time? $\endgroup$ – Nothing Oct 2 '18 at 7:49
1
$\begingroup$

If you want to get individual probabilities from a fitted Cox model from the survival package in R, you can use the survfit() method, e.g.,

fm <- coxph(Surv(time, status == 0) ~ x1 + x2 + x3, data = your_data)
sfit <- survfit(fm, newdata = your_data)
summary(sfit, times = 230)
$\endgroup$

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.