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

p value calculated by ggsurvplot using Gehan-Breslow test(log.rank.weights = "n") is wrong #453

Closed
stroke1989 opened this issue Mar 6, 2020 · 6 comments

Comments

@stroke1989
Copy link

when I use ggsurvplot to plot a K-M curve and make statistic test, I set log.rank.weights = "n" (Gehan-Breslow test, not default "log rank test"), however, the p value is same to that calculated by log rank test method, and the plot still showed words "log-rank". I use survdiff and surv_pvalue to recalculate p value (both use Gehan-Breslow test), the p-value calculated by survdiff is same to that calculate by surv_pvalue, and same to p value calculated by SPSS K-M(Breslow method. that is to say p value(survdiff- breslow method) = p value( surv_pvalue - breslow method) = p value(SPSS k-m breslow) ≠ p value (ggsurvplot, log.rank.weights ="n", also breslow method). I don't know why.

code in following

library(survival)
library(survminer)
View(lung)
attach(lung)
fit <- survfit(Surv(time, status) ~ sex, data= lung)
ggsurvplot(fit, data = lung, ggtheme= theme_bw(), risk.table = T, pval = TRUE, pval.method = TRUE, surv.median.line = "hv", tables.height = 0.2, xlim = c(0, 110),
log.rank.weights= "n" )
survdiff(Surv(time, status) ~ sex, rho = 1)
surv_pvalue(fit, method = "Gehan-Breslow")

@stroke1989 stroke1989 reopened this Mar 6, 2020
@jgarces02
Copy link

Any new about this?? Thanks

@stroke1989
Copy link
Author

Any new about this?? Thanks

I don't know what you mean?

@jgarces02
Copy link

No, it's for @kassambara... if he's already solved this problem you commented (or have you found another solution?). Sorry the confusion!

@stroke1989
Copy link
Author

No, it's for @kassambara... if he's already solved this problem you commented (or have you found another solution?). Sorry the confusion!

did you also found this problem when you use ggsurvplot package? I assumed that just I meet this problem

@Estefy-987
Copy link

I had the same problem. It's like surv_pvalue is not updated, but if you write the full name "gehan-breslow" it works.

surv_pvalue(fit_SG_tto, method = "1")
variable pval method pval.txt
1 TB 0.002100802 Log-rank p = 0.0021
surv_pvalue(fit_SG_tto, method = "log-rank")
variable pval method pval.txt
1 TB 0.002100802 Log-rank p = 0.0021
surv_pvalue(fit_SG_tto, method = "n")
variable pval method pval.txt
1 TB 0.002100802 Log-rank p = 0.0021
surv_pvalue(fit_SG_tto, method = "gehan-breslow")
variable pval method pval.txt
1 TB 0.0018 Gehan-Breslow p = 0.0018

However in ggsurvplot if you write gehan-breslow" doesn't work

Error in (function (fit, data = NULL, fun = NULL, color = NULL, palette = NULL, :
log.rank.weights %in% c("survdiff", "1", "n", "sqrtN", "S1", .... is not TRUE

kassambara added a commit that referenced this issue Dec 20, 2020
@kassambara
Copy link
Owner

fixed now, thanks

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

4 participants