In R, I analyse time-to-event data to explore the effect of a biomarker on an event risk. To do this, I work with data that looks like this toy dataset:

> head(data)
   pt sex baseline_age  event  event_days death  stop_days
1   1   M         17082      0       3991     0       3991
2   2   M         25185      0       3491     1       3491
3   3   F         14856      0       3988     0       3988
4   4   F         22046      0       4004     0       4004
5   5   M         23543      1       3924     0       4012

Description of columns:

  • pt: individual's ID
  • sex: gender (M=male, F=female)
  • baseline_age: the age of the individual (in days) at the start of the study
  • event: indicates if yes (1) or no (0) we observe the event
  • event_days: age (in days) at the time of the event
  • death: 0=no, 1=yes
  • stop_days: time (in days) between baseline and death or last news

To fit the cox model separated by gender I used:

coxph(Surv(event_days, event) ~ sex, data = data) %>%
  gtsummary::tbl_regression(exp = TRUE)

The result can be visualized as following: cox_plot

My question: at the end (~6000 days after the start of the study, see graph), the survival probability is close to 0, but only ~7% of the individuals had an event. I think my model is wrong, and I suspect that this has to do with the event_days and stop_days columns being the same in my dataset when we have no news for an individual. How can I solve this problem?


1 Answer 1


What you see as a problem is actually the problem solved by this type of survival analysis. Those who drop out of a study before an event do provide information up to their last observation time. Either just omitting them from analysis or treating their last observation time as an event would bias the results.

Thus the risk of an event at any time is estimated by the ratio of the number having an event at that time to the number still at risk at that time. This process starts at the earliest times, pruning the at-risk set as individuals die or drop out, and taking prior survival probabilities into account. It moves on in that way until the last observed event. Unless there is some information included in the times that individuals drop out without an event, this gives a reliable overall estimate of survival since time = 0.

Even though only 7% of your cases were observed to have an event, all of the cases contributed to the analysis up through their last observation times. And they all will have the event of death; you just know it's at some time after you last observed them.

  • 3
    $\begingroup$ You just have to make sure that the last observation time for non-events (censoring time) is random with regard impending risk of an event. The method assumes that the censoring time distribution is independent of the event time distribution. It doesn't assume it's independent of sex. $\endgroup$ Commented Jan 11, 2022 at 18:06
  • $\begingroup$ Thank you EdM and @frank-harrell for your answers. If I have understood correctly, the model used is therefore reliable and correct as it is? $\endgroup$
    – Svalf
    Commented Jan 14, 2022 at 8:46
  • $\begingroup$ @Svalf handling of censoring is OK, provided assumptions noted by Frank Harrell about the censoring time distribution hold. You've done only the first step toward documenting model reliability. With ~300 events you probably could improve the model by including baseline age in a flexible spline and adding up to 10 or so additional outcome-associated predictors. Validating and calibrating the model requires additional steps. See Harrell's course notes, book, and software package. $\endgroup$
    – EdM
    Commented Jan 14, 2022 at 14:45

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.