我已经制作了一些 Kaplan-Meier 图,我一直在努力让风险表的数量出现。它目前如下所示:
使用 summary(survfit 函数) 这是 n.risk 和 n.events 的摘要
我的代码如下所示:
library(survival)
KMoverall = survfit(Surv(ds$followuptimemonths, ds$Death=="Y") ~ 1, data=ds)
ggsurvplot(KMoverall, xlim = c(0,46), break.x.by = 12, xlab= "Months", ylab = "OS Probability" , surv.scale = "percent" , legend = "none", conf.int = FALSE, pval = FALSE, surv.median.line = NULL , risk.table = TRUE, cumevents = FALSE, cumcensor = FALSE, table.height = 0.1, size = 1, linetype = "strata")
我做错了什么?
dput(ds) 相关列
followuptimemonths = structure(c(24.6901403820232, 27.944899233981,
10.7176907650327, 4.47118387743696, 14.0382023210705, 32.9421047440576,
31.9558141828583, 31.5941743104185, 21.3696288259855, 29.2599533155801,
10.6848144129927, 12.6902718874314, 19.4299240556268, 20.3175855607062,
10.6519380609528, 37.8406811980143, 18.3778807903475, 22.060032218825,
27.8133938258211, 31.0681526777789, 9.17250221915376, 18.4765098464674,
13.5450570404708, 44.2844461978499, 23.0463227800243, 34.3886642338166,
31.9886905348982, 42.1146069632114, 37.2817832133346, 35.0461912746162,
35.3749547950159, 23.4079626524641, 34.0927770654568, 20.2847092086662,
5.81911431107604, 28.1421573462209, 17.9176118617878, 16.0436597955091,
22.5860538514646, 21.6655159943453, 20.547720024986, 12.1642502547917,
11.5067232139922, 11.3423414537923, 10.6519380609528), units = "days", class = "difftime")
death <- structure(c(1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L,
1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L,
1L, 1L, 2L, 1L, 2L, 2L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L
), .Label = c("N", "Y"), class = "factor")
ds <- data.frame(followuptimemonths, death)
知识管理总结
time n.risk n.event survival std.err lower 95% CI upper 95% CI
4.47 45 1 0.978 0.0220 0.936 1.000
5.82 44 1 0.956 0.0307 0.897 1.000
10.68 40 1 0.932 0.0381 0.860 1.000
10.72 39 1 0.908 0.0440 0.826 0.998
11.34 38 1 0.884 0.0489 0.793 0.985
16.04 32 1 0.856 0.0546 0.756 0.970
17.92 31 1 0.829 0.0594 0.720 0.954
18.38 30 1 0.801 0.0635 0.686 0.936
19.43 28 1 0.772 0.0674 0.651 0.917
20.28 27 1 0.744 0.0707 0.617 0.896
23.41 19 1 0.705 0.0771 0.569 0.873
27.94 16 1 0.661 0.0839 0.515 0.847
31.99 10 1 0.595 0.0981 0.430 0.822
34.39 7 1 0.510 0.1151 0.327 0.794