I have developed a cox regression model to find out the parameters.

    fit_cox_Price_plan_device <-  coxph(Surv(df_life_4$Line.Tenure.In.Days,df_life_4$Churn.Flag==0)~df_life_4$Subscriber.Activity.Price.Plan.Code+df_life_4$Months.on.Price.Plan+df_life_4$Device+df_life_4$Months.on.Device + df_life_4$Total.MOU + df_life_4$Total.Active.Subscribers + df_life_4$GPS.Flag+df_life_4$WIFI.Flag + df_life_4$Multimedia.Flag + df_life_4$Price.Plan.Change.Flag)
    pred_fit_cox_Price_plan_device<- survfit(fit_cox_Price_plan_device)

Now the result I obtain from this summary is like this:

time   n.risk  n.event  survival  lower 95%CI  upper 95% CI
1      165805   7316      0.963         0.962        0.964
30     149249   6109      0.929         0.928        0.930

And so on. My question is can anyone write an R code here that estimates the survival probability of each individual on the 500th day given that they already survived for more than 400 days?

Please help me out with that solution. Since I am stuck.

I have already tried this:

 df_life_4<- df_life_4[1:173258,]#Here 53.12277 is the approximation of the baseline hazard integrated upto time t but I know this is wrong
 write.csv(individual_prob_on450,file = "individual_probability_on_450_day.csv")

1 Answer 1


You can do this by dividing the survival probability at 500 days with the survival probability at 400 days or better by doing a landmark type of analysis in which you only consider the patients at risk at 400 days. Check these examples with the lung dataset from the survival package:


# Cox model in the whole dataset
fm <- coxph(Surv(time, status) ~ age + ph.karno, data = lung)

# Survival probabilities at 400 and 500 days
sfit <- summary(survfit(fm), times = c(400, 500))
sfit$surv[2] / sfit$surv[1]

# landamark approach; consider only the patients at risk at
# 400 days, fit the Cox model to them, and predict at 500 days
lung2 <- lung[lung$time >= 400, ] 
gm <- coxph(Surv(time, status) ~ age + ph.karno, data = lung2)
summary(survfit(gm), times = 500)
  • $\begingroup$ But can the individual probability on a certain time = t not be obtained? $\endgroup$
    – Nothing
    Sep 28, 2018 at 8:25
  • $\begingroup$ I'm not sure what you mean... $\endgroup$ Sep 28, 2018 at 8:26
  • $\begingroup$ Person1 :probability of survival on 500th day given he has already lived for 400 days .The same for Person 2 and so on... $\endgroup$
    – Nothing
    Sep 28, 2018 at 8:27
  • $\begingroup$ More specifically for(each person):Calculate P(t=500|t>400) End loop. $\endgroup$
    – Nothing
    Sep 28, 2018 at 8:29
  • $\begingroup$ If you want to calculate these probabilities for specific persons, you can use the newdata argument of the survfit() function to provide their covariate information. $\endgroup$ Sep 28, 2018 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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