Add at risk table and 95% confidence intervals to adjusted survival curves using survminer package in r

孤人 提交于 2020-12-15 04:37:45

问题


I want to add at-risk table and 95% confidence intervals to adjusted survival curves. Something like survival curves below (Link). I saw some relevant code here but it doesn't mention what I need.

Another question, would it be correct if I used the obtained weight variable (from iptw package) in the adjustment (as I have a column named weight in my actual dataset.

Here is my code:

library(survival);library(survminer)
data(lung);names(lung)
#fit <- coxph( Surv(time, status==2) ~ ph.karno + strata(sex), data = lung )
lung$sex <- ifelse(lung$sex == 1,  "Male", "Female")
fit <- coxph(Surv(time, status) ~  ph.ecog + age +strata(sex),  data = lung)

ggadjustedcurves(fit,
                 variable = "sex", 
                 data = lung,
                 method = "average",
                 palette = c("#E69F00", "#56B4E9"),
                 size = 1.3,
                 legend = "right",
                 legend.title = expression(bold("Legend title")),
                 xlab = "Time",font.legend = 12) + theme(legend.text.align = 0.5)

来源:https://stackoverflow.com/questions/65153421/add-at-risk-table-and-95-confidence-intervals-to-adjusted-survival-curves-using

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!