使用 survminer (ggsurvplot) 将 Kaplan-Meier 图 y 轴更改为失败概率而不是生存概率?
Change Kaplan-Meier plot y-axis to failure probability instead of survival probability using survminer (ggsurvplot)?
我正在使用 survminer 包中的 ggsurvplot 创建 Kaplan-Meier 图,显示精神疾病家族史与精神疾病发作之间的关系。这是我使用的代码:
km_fhr <- ggsurvplot(fit = survfit(Surv(fu_time, smidg) ~ fhr, data = df),
legend.labs = c("Control", "Family high-risk"),
legend.title = "",
censor.shape = 124,
censor.size = 2.5,
palette = c("#00ABE7", "#FFA69E")) +
labs(x = "Follow-up time (years)", y = "Probability of no SMI diagnosis")
Kaplan-Meier 曲线如下所示:
在我看来,在 y 轴上绘制患病风险(失败率)比不患病概率(存活率)更直观。我假设有一种简单的方法可以做到这一点,但我无法在 survminer 文档中找到描述。
提前致谢!
对累积事件使用参数 fun = event
。可重现的例子:
library(survminer)
ggsurvplot(
survfit(
Surv(time, status) ~ sex + rx + adhere,
data = colon
),
fun = "event"
)
来自 ggsurvplot
的帮助:
fun: an arbitrary function defining a transformation of the survival curve. Often used transformations can be specified with a character argument: "event" plots cumulative events (f(y) = 1-y), "cumhaz" plots the cumulative hazard function (f(y) = -log(y)), and "pct" for survival probability in percentage.
我正在使用 survminer 包中的 ggsurvplot 创建 Kaplan-Meier 图,显示精神疾病家族史与精神疾病发作之间的关系。这是我使用的代码:
km_fhr <- ggsurvplot(fit = survfit(Surv(fu_time, smidg) ~ fhr, data = df),
legend.labs = c("Control", "Family high-risk"),
legend.title = "",
censor.shape = 124,
censor.size = 2.5,
palette = c("#00ABE7", "#FFA69E")) +
labs(x = "Follow-up time (years)", y = "Probability of no SMI diagnosis")
Kaplan-Meier 曲线如下所示:
在我看来,在 y 轴上绘制患病风险(失败率)比不患病概率(存活率)更直观。我假设有一种简单的方法可以做到这一点,但我无法在 survminer 文档中找到描述。
提前致谢!
对累积事件使用参数 fun = event
。可重现的例子:
library(survminer)
ggsurvplot(
survfit(
Surv(time, status) ~ sex + rx + adhere,
data = colon
),
fun = "event"
)
来自 ggsurvplot
的帮助:
fun: an arbitrary function defining a transformation of the survival curve. Often used transformations can be specified with a character argument: "event" plots cumulative events (f(y) = 1-y), "cumhaz" plots the cumulative hazard function (f(y) = -log(y)), and "pct" for survival probability in percentage.