我的目标是在同一个图上用正向似然法绘制两个Cox回归模型。 我尝试过survminer女巫很棒,但是它使用了生存包中的coxph。因此,它无法实现前向似然方法。 谢谢
我使用的代码:
library("survminer")
require("survival")
res.cox1 <- coxph(Surv(time, status) ~ age + ph.karno + sex, data = lung)
lung$statusRecurrence <- rbinom(228,1,.3)
lung$TimeRecurrence <- sample(60:850,228,replace = T)
res.cox2 <- coxph(Surv(TimeRecurrence, statusRecurrence) ~ age + ph.karno + sex, data = lung)
res.cox1.fit = survfit(res.cox1, data = lung)
res.cox2.fit = survfit(res.cox2, data = lung)
fit <- list(Survival = res.cox1.fit, Recurrence = res.cox2.fit)
ggsurvplot(fit, data = lung, combine = TRUE,
ggtheme = theme_minimal(), risk.table = TRUE, conf.int = TRUE, palette = "jco",
tables.theme = theme_cleantable(),
ylab = "Probability (%)", surv.scale = "percent", legend.title = "", legend = "right")