Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ggadjustedcurves function and median survival #227

Closed
kassambara opened this issue Jun 12, 2017 · 10 comments
Closed

ggadjustedcurves function and median survival #227

kassambara opened this issue Jun 12, 2017 · 10 comments

Comments

@kassambara
Copy link
Owner

(e-mail from a user)

First off, thank you for such a great survival package in survminer! It has been by far one of the most used packages on my part during my master’s. I recently was introduced to adjusted survival curves and was even more excited to see this function implemented in survminer. However, is there a way to extract say median survival or survival at any timpoint for a particular group of interest?

Thanks and keep up the great work

Sameer

@pbiecek
Copy link
Contributor

pbiecek commented Jun 20, 2017

Will try to do this in similar way as it is implemented in ggsurv

btw: I noticed that people are referring to this function as ggadjustedcurves, even if it's name is ggcoxadjustedcurves.
@kassambara what do you think about changing it's name to ggadjustedcurves and leave ggcoxadjustedcurves() as deprecated?

@kassambara
Copy link
Owner Author

ggadjustedcurves() is shorter than ggcoxadjustedcurves() and seems to be more intuitive to type, for the end users. so, let's change the name to ggadjustedcurves().

@kijohnson
Copy link

Hi, I am using the ggadjustedcurves function for a class I teach and I want to clarify that this plots adjusted survival curves using the mean(s) of the adjustment covariate(s). I would also like to use the median but I am not sure if this has been implemented or not.

@pbiecek
Copy link
Contributor

pbiecek commented Mar 27, 2018

Thanks,
please note that there are 4 methods implemented in this function (the method parameter) as in https://www.rdocumentation.org/packages/survminer/versions/0.4.1/topics/ggadjustedcurves
The default is method = "conditional" which is a weighted average with weights selected in order to balance subpopulations (if they are not balanced, kind of like in the Inverse probability weighting).

@dvdkruijssen
Copy link

@pbiecek @kassambara Thank you very much for this great package! Has there already been a method developed to extract the median survival from the ggadjustedcurves function? Or is there another way that I can trace/calculate the median survival for the adjusted curves? I can only show these curves in my paper if I can report the median survival. It would be great if you can help me!

pbiecek added a commit to pbiecek/survminer that referenced this issue Sep 1, 2019
@pbiecek
Copy link
Contributor

pbiecek commented Sep 1, 2019

@dvdkruijssen you can try the version in #423
the surv_adjustedcurves function returns a data frame with survival curves.
You can use this data frame to extract median survival time or other statistics.

kassambara added a commit that referenced this issue Sep 1, 2019
@dvdkruijssen
Copy link

@pbiecek @kassambara Thank you very much for your help!

@Marsus1972
Copy link

Thanks for a great package!
However, when i try to calculate median overall survival (OS) in the surv_adjustedcurves() package the OS list got curtailed after 333 (of 513) patients, see below. How can I get the entire list? How do you calculate the median OS from that list when you dont know which patients are sensored? Can you calculate 2-year OS? Many thanks in advance, Marcus. Below are my codes:

adjCox <- coxph(Surv(OSm, Dod) ~ TumTyp+Age607080+CA199o200d+OpY5+TumStorlPcm+Diffd+TumSubTypi+N8, data = df)
fitTT <- ggadjustedcurves(adjCox, data = df, variable = "TumTyp", title = "Tumor type, adjusted",
subtitle = "- conditional method", method = "conditional",
legend.title = "Strata", legend.labs = c("inv-IPMN", "PDAC"), legend = c(0.85, 0.9), font.legend = list(size = 14),
xlab= "Time after surgery (months)", xlim = c(3, 60), xticks.by = 12, ylab= "Probability of overall survival",
font.main = c(24, "bold", "darkblue"), font.submain = c(16, "italic", "darkblue"), font.x = 14, font.y = 14, font.tickslab = 12,
palette = rev(PmI_2colr))

curve <- surv_adjustedcurves(adjCox, data = df, method = "conditional", variable = "TumTyp")

curve
time variable surv
1 0.0000000 Inv-IPMN 1.0000000
2 0.0000000 Inv-IPMN 0.9967752
3 0.5256674 Inv-IPMN 0.9935610
:
329 19.4168378 PDAC 0.5494825
330 19.5154004 PDAC 0.5433890
331 19.6468173 PDAC 0.5403567
332 19.9096509 PDAC 0.5373506
333 20.0410678 PDAC 0.5343147
[ reached 'max' / getOption("max.print") -- omitted 73 rows ]

@pbiecek
Copy link
Contributor

pbiecek commented Apr 11, 2021

@Marsus1972
Can you paste a reproducible example?

Please note that the 'curve' data frame has more rows, but they are not shown on the screen (the print function shows the first 333 rows). The frame has more rows and you can preview them e.g. with View() function.

The second thing is that the rows of this frame correspond to event times and not to patients.
So even if you have 500 patients but some have the same observation time this frame will have less rows.

@Marsus1972
Copy link

Marsus1972 commented Apr 12, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants