2017-04-21 103 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])