为了解决您的问题,我首先将您的数据重组为我习惯的生存数据。这是每个事件/审查员一行。然后我拟合生存模型并绘制 KM。
dt <- as.data.frame(matrix(c(3,57
,4,35
,4,85
,4,90
,5,55
,6,65
,6,89
,6,72
,9,97
,9,89
,9,98
,10,99
,10,92
,13,99
,14,50
,15,97
,18,60
,21,70
,25,76
,28,77
,40,82
,48,86),ncol=2,byrow = TRUE))
colnames(dt) <- c("time","response")
#translate percentage of responders at each time to number of responders if we start with a population of 10000
dt$individuals <- round(10000*sapply((1:nrow(dt)),function(x){prod(dt[1:x,"response"]/100)}))
s <- data.frame(time = with(dt,rep(time, individuals))
,event = 1)
library(survival)
sobj <- Surv(s$time, s$event)
fit <- survfit(sobj ~ 1)
plot(fit, fun="event")