Skip to content

How to stop Kaplan-Meier curve at a time point

1 message · Terry Therneau

#
Here is the simplest answer that I know.

    outcome6 <- ifelse(Survival_days > 2190, 0, Outcome)
    survfit(Surv(Survival_days, outcome6) ~ Gender)

This assumes that the variable Outcome is coded as 0/1.  If it were instead FALSE/TRUE 
then change the 0 to "FALSE" in the first line.
The logrank test adds a term to the computation at each death time, so changing all the 
deaths after time 2160 to "censored" effectively ignores any information after that point. 
  There is no need to modify the time variable.

David W's suggestion to add "subset = (Survival_days <= 2190) was incorrect, effectively 
removing all of the most successful outcomes from the study.  It will thus lead to an 
underestimate of tooth survival.  (This was a surprise - David usually bats 1000 on 
survival questions, and I greatly appreciate his input to this list.)

Terry Therneau
(author of the package)
On 11/21/2013 05:00 AM, r-help-request at r-project.org wrote: