2017-04-21 93 views
1

我们注意到R(survival包)和SAS(或survminer)显示KM曲线审查事件之间的区别。当一个事件与审查的同时发生时,+标记未显示在图中。函数survminer::ggsurvplot与SAS一样正确显示审查事件。Kenson-Maier曲线审查事件不会显示审查事件和事件时间之间的联系

我失去了一些东西在这里?我如何获得plot.survfit来显示所有审查'事件'?

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

回答

1

找到了解决办法。

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