David R.
David R.

Reputation: 864

Kaplan-Maier curve censoring events not displaying when a ties between censor and event time

We noticed a difference between how R (survival package) and SAS (or survminer) display KM curves censoring events. When an event occur at the same time as a censoring one the + mark is not displayed in the graph. The survminer::ggsurvplot function display the censoring event correctly like SAS.

Am I missing something here? How do I get plot.survfit to display all the censoring 'events'?

library(survival)
library(survminer)

df <- data.frame(time=c(4,6,8,11,15,15,17,18,19), 
                 cens=c(0,0,1, 0, 1, 0, 1, 0, 1)) 

mod <- survfit(Surv(time, !cens) ~ 1, data=df) 

# plotting with the survival package does not show a mark at time = 15 
plot(mod, mark=1, mark.time = TRUE, conf.int = FALSE)

survival plot

# plotting with survminer or SAS display the mark at time 15.
ggsurvplot(mod, data = df, conf.int = FALSE)

survminer plot

Upvotes: 1

Views: 1537

Answers (1)

David R.
David R.

Reputation: 864

found the solution.

plot(mod, mark=1, conf.int = FALSE, mark.time=mod$time[mod$n.censor > 0]) 

Upvotes: 2

Related Questions