简体   繁体   English

plot 调整性别后的生存曲线

[英]plot survival curve after adjusting for gender

I have a dataset that have samples with / without treatment and their ages at death and gender.我有一个数据集,其中包含经过/未经治疗的样本以及他们的死亡年龄和性别。 All the samples are dead.所有的样本都死了。 I want to test if the treatment affects the survival.我想测试治疗是否影响生存。

The dataset df looks like below数据集 df 如下所示

  FID gender age_at_death treatment event
1 101 female      46  Y     1
2 102 female      65  Y     1
3 103   male      73  Y     1
4 104   male      74  N     1
5 105 female      56  N     1
6 106   male      57  N     1

Below is my code to test if the treatment affects survival:下面是我测试治疗是否影响生存的代码:

library(survminer)    
surv_obj <- Surv(time=df$age_at_death, event=df$event)
fit <- survfit(surv_obj ~treatment, data=df)
ggsurvplot(fit, data = df, pval = TRUE, title = "test" )

surv plot for different treatment group不同治疗组生存 plot

在此处输入图像描述

But gender is quite an important co variant (females usually live longer than males), therefore I want to adjust for gender.但是性别是一个非常重要的协变体(女性通常比男性活得更长),因此我想针对性别进行调整。 But the below code give me 4 survival curves.但是下面的代码给了我 4 条生存曲线。 What I want is two curves (treated vs non-treat) adjusted for gender.我想要的是针对性别调整的两条曲线(治疗与未治疗)。

fit1 <- survfit(surv_obj ~treatment + gender, data=df)
ggsurvplot(fit, data = df, pval = TRUE, title = "test" )

在此处输入图像描述

fit2 <- coxph( Surv(time=df$age_at_death, event=df$event) ~ treatment, data = df )
ggadjustedcurves(fit2, data = df)

This only give one curve.这只会给出一条曲线。

在此处输入图像描述

fit3 <- coxph( Surv(time=df$age_at_death, event=df$event) ~ treatment +strata(gender), data = df )
ggadjustedcurves(fit3, data = df)

This gives twos curve, male vs female.这给出了双曲线,男性与女性。

在此处输入图像描述

The figure I want is similar to this example:我想要的图类似于这个例子:

在此处输入图像描述

"after adjustment for age, sex, race, diseases suspected to influence B27 testing and mortality". “在对年龄、性别、种族、疑似影响 B27 检测和死亡率的疾病进行调整后”。 They adjusted for quite a few covariants and have an adjusted survival plot for B27+ and B27- (mine is treated vs non-treated).他们针对相当多的协变量进行了调整,并且 B27+ 和 B27- 的调整后生存期为 plot(我的治疗与未治疗)。

Any help will be appreciated!!!任何帮助将不胜感激!!!

I would suggest taking a look at the adjustedCurves package: https://github.com/RobinDenz1/adjustedCurves我建议看看adjustedCurves package: https://github.com/RobinDenz1/adjustedCurves

It offers a variety of ways to adjust survival curves for confounders.它提供了多种方法来调整混杂因素的生存曲线。 The literature references given in the documentation of that package can also be used to get a good understanding of what exactly confounder-adjustment means in this context and how it is performed.该 package 的文档中提供的参考文献也可用于很好地理解混淆调整在这种情况下的确切含义及其执行方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM