【问题标题】:How to code piecewise survival models in R (e.g. Kaplan-Meier curve with an extrapolated tail)如何在 R 中编写分段生存模型(例如带有外推尾部的 Kaplan-Meier 曲线)
【发布时间】:2020-02-15 10:24:51
【问题描述】:

我想问一下如何在R中创建分段生存模型(例如带有外推尾部的Kaplan-Meier曲线(无论分布如何),参见附图作为示例?

例如,在下面的示例中,当时间为 200 时,如何创建一条适合指数分布的曲线(这样我就可以得到与附图中相似的曲线)?

library(survival)
library(flexsurv)
library(dplyr)

data <- survival::lung %>% filter(time < 300)

formula <- Surv(data$time, data$status) ~1

model <- flexsurvreg(formula = formula, dist = "exp", na.action = na.exclude)

plot(model, main = "plot",
     col.obs = "black",
     col = "blue")

【问题讨论】:

    标签: r survival-analysis


    【解决方案1】:

    该模型具有“flexsurvreg”类,因此plot.flexsurvreg 的帮助页面应该为您提供答案,以及接受... 参数的plot.survfit 函数。因此,要获得与您展示的情节相似的情节,可以从以下开始:

    plot(model, main = "plot",
         col.obs = "black",
         col = "blue", 
         ci=FALSE,
         conf.int=FALSE,
         las=2,  # axis tick labels always perpendicular to axes
         xlab="Time (months)",
         ylab="Percentage alive")
    

    我希望您不想要丑陋的 x 轴中断或 y 轴刻度标签的 3 个有效数字。顺便说一句,y 轴标签应该真的是 Proportion alive。

    【讨论】:

      猜你喜欢
      • 2020-11-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-25
      • 1970-01-01
      • 2015-12-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多