1

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

  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

enter image description here

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. 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" )

enter image description here

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

This only give one curve.

enter image description here

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.

enter image description here

The figure I want is similar to this example:

enter image description here

"after adjustment for age, sex, race, diseases suspected to influence B27 testing and mortality". They adjusted for quite a few covariants and have an adjusted survival plot for B27+ and B27- (mine is treated vs non-treated).

Any help will be appreciated!!!

MatejMecka
  • 1,448
  • 2
  • 24
  • 37
tianbu
  • 11
  • 1
  • How do you want to adjust? (i.e. what kind and how much of an effect do you attribute to gender?) If this is unclear, try showing the data for your whole sample including male and female, or separately and differantiate the effects. – Jannik Buhr Aug 11 '18 at 16:55
  • I want to show the treatment effect on mortality by adjusting the gender affect. I can do it by cox model but I can't produce a survival plot showing just treat vs non-treat with adjustment of gender. – tianbu Aug 15 '18 at 01:19

1 Answers1

0

I would suggest taking a look at the 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.

Denzo
  • 240
  • 1
  • 7