-
Notifications
You must be signed in to change notification settings - Fork 164
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
post-hoc analysis for Logrank-test: Multiple comparisons of survival curves #97
Comments
What if we have
which groups will you merge then :) ? |
A very good question!! I don't really have a definitive answer. In a such difficult case, an additional external information about the groups might be required in order to help the analyst to decide which groups to merge. I think that the primary goal of the pairwise comparison should be only descriptive, investigating where the difference is, when the global test is significant. If the analyst wants to merge some groups, then the adjusted p-values might help in some cases: For example, if: Then: |
Sounds reasonable :) |
New function
library(survival)
library(survminer)
# Survival curves with global p-value
data(myeloma)
fit <- survfit(Surv(time, event) ~ molecular_group, data = myeloma)
ggsurvplot(fit, legend.labs = levels(myeloma$molecular_group),
pval = TRUE)
# Pairwise survdiff
res <- pairwise_survdiff(Surv(time, event) ~ molecular_group,
data = myeloma)
res Pairwise comparisons using Log-Rank test data: myeloma and molecular_group Cyclin D-1 Cyclin D-2 Hyperdiploid Low bone disease MAF MMSET Cyclin D-2 0.723 - - - - - Hyperdiploid 0.328 0.103 - - - - Low bone disease 0.644 0.447 0.723 - - - MAF 0.943 0.723 0.103 0.523 - - MMSET 0.103 0.038 0.527 0.485 0.038 - Proliferation 0.723 0.988 0.103 0.485 0.644 0.062 P value adjustment method: BH
# Symbolic number coding
symnum(res$p.value, cutpoints = c(0, 0.0001, 0.001, 0.01, 0.05, 0.1, 1),
symbols = c("****", "***", "**", "*", "+", " "),
abbr.colnames = FALSE, na = "") Cyclin D-1 Cyclin D-2 Hyperdiploid Low bone disease MAF MMSET Cyclin D-2 Hyperdiploid Low bone disease MAF MMSET * * Proliferation + attr(,"legend") [1] 0 ‘****’ 1e-04 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘+’ 0.1 ‘ ’ 1 \t ## NA: ‘’ |
Outstanding! I am working locally on extending: |
Ok, that would be great! Have a nice weekend:-)! |
I think that we can close this issue |
Hi! First I´m sorry for my bad English Error in get(method, envir = home) : Although I got that mistake, I run the function and I get the following error: Error in paste(deparse(substitute(data)), "and", .collapse(group_var, : Could you help me please? Thanks! |
Hi, This error is not reproducible on my computer. Suggestion:
If it still fails, then send to me the output of Thanks |
I re-start my R session and Re-install the developmental version of survminer from github but I get the same error the output of devtools::session_info().
Packages -------------------------------------------------------------------------------------------------------------------- Thanks! |
This is strange! This kind of issues has been reported many times on stackoverflow (see this, this or this forum) and in all the cases, re-starting R fixes the issue. Have you try to remove the old survminer before re-installation? If the answer is no, then try this:
And, please let-me know if it works. |
Hi! |
I have no idea what might cause this issue. |
I think the problem is the function ".collapse", which you use in: |
As the error you obtained is not reproducible on my computer, please, let me know if the following code works on your system? library("survminer")
library(survival)
data(mgus)
res.cox <- coxph(Surv(futime, death) ~ mspike + log(mspike) + I(mspike^2) +
age + I(log(age)^2) + I(sqrt(age)), data = mgus)
ggcoxfunctional(res.cox, data = mgus, point.col = "blue", point.alpha = 0.5) |
Yes, the code has worked perfectly |
.collapse() function pasted in the pairwise_survdiff.R file Please, re-install survminer from github and let me know, if pairwise_survdiff() works. Thanks |
I re-install survminer from github and I get the same issue with my dataset and with dataset "mymeloma" (http://www.sthda.com/english/wiki/survminer-0-3-0). I've tried using with the two dataset the function pairwise_survdiff() so maybe it's my data problem. I run the function .collapse (.collapse pasted in pairwise_survdiff.R #97) and I get other issue There is definitely a problem in my data!!!!! I don´t understand because the error say there is only 1 group if I have 7 factor different but I will found about it |
I finally got it!!!!! I was able to use the function pairwise_survdiff() The ultim problem I have solved it. I tell you where my mistake was. In my initial dataset, my predictor variable has 9 levels but I´m working with 7 levels of a subdataset because the other two levels haven´t got values. So I have defined the 7 levels that have value and pairwise_survdiff() works!!!!! I hope you understand what I've explained |
I'm happy that it works. Thank you for your feedback, I appreciate it and it will help me to improve pairwise_survdiff() to handle such situation. This means that I should include the function droplevels() to drop unused levels. |
droplevels() added now, thanks |
I first wanted to say you prepared and delivered a fantastic post on the use of log-rank tests to identify differences in survivorship over time between groups. My quick question builds off of @MarcinKosinski in regards to merging data to provide more generalized groups and thus interpretations of the data. I agree it is logical to merge factor levels that are not considered to be statistically different. However, how does that change when you have three or more factor levels. The Zhan et al. (2006) article you refer to, for instance, appears to have visually analyzed the data with the KM estimator of survival and created two risk groups. As such, they could theoretically divide levels into whatever groups they deem necessary, such as placing MF with the low risk group. Any critiques or suggestions to merging three or more factor levels like in the Zhan article? Thank you |
Hello and thank you for this interesting thread, I find it very nice to take interest in subgroups, I tried the pairewise_survdiff() function for one of my dataset. I do not manage to understand how my global pvalue can be <0.05 and none of the pairewise_survdiff() pvalues are below this same threshold. Also I've been struggling to code the pairewise_survdiff() into a loop to iterate on every covariates.
Thank you for your answers. Raphaël |
Hi, You're writing in closed issue. Please, kindly open a new issue and provide a reproducible example with a demo data set so that we can work on it, thanks |
I am trying to run pairwise_survdiff() in a loop where I use |
In my opinion is cased because there is x[, k] in the formula
specification. Its not the way you use R formulas. Error isn't survminer
related but the formula specification related. One need to paste names as
strings and convert them to formula with as.formula to perform something
like that in a loop over variables.
Cheers
czw., 15 lis 2018, 05:41: Akshata Udyavar <notifications@github.com>
napisał(a):
… I am trying to run pairwise_survdiff() in a loop where I use
res <- pairwise_survdiff(Surv(x$"PFI.Time"/365,x$"PFI") ~ x[,k],data=x)
It says "Error in [.data.frame(data, , group_var, drop = FALSE) :
undefined columns selected". I tried it multiple ways with get(k) as well,
but still same error.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#97 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGdazp8THSQhjbnhekzJW0h5emOLJO6hks5uvPB5gaJpZM4LOOUt>
.
|
Hello |
@kassambara is there a way to create adjusted survival curves using ggadjustedcurve command for a variable which has more than two levels from cox proportional hazard analysis. |
I am trying to create that for a variable which has five levels and it is giving me some weird error message. @kassambara |
@SoumyaRo can you start separate issue?
wt., 22 sty 2019, 21:58: SoumyaRo <notifications@github.com> napisał(a):
… I am trying to create that for a variable which has five levels and it is
giving me some weird error message. @kassambara
<https://github.com/kassambara>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#97 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGdaznh-nu1lL6GqukjZr3x3fM96Yt27ks5vF3uLgaJpZM4LOOUt>
.
|
Hi! Do you know of a way to perform pairwise comparisons on interval-censored curves? So far I used the Bonferroni method (as suggested by Graphpad people) which has been criticized as too conservative. |
@kassambara |
In this paper - the molecular classification of multiple myeloma, the authors classify multiple myeloma patients into 7 groups based on gene expression profiling. The survival curves of these 7 groups are shown in the figure here-after (Panel A). In panel B, groups with similar survival curves have ben merged into high and low risk groups.
In a such situation, one would like to perform a pairewise comparison between groups in order to decide the groups to be merged. Groups might be merged, if the long-rank test fails to be significant.
The function
survdiff()
[in survival package] returns a global p-value whether to reject or not the null hypothesis. It returns a pooled p-value even when we have a strata including multiple groups (more than 2). With this, you know that a difference exists between groups, but you don't know where. You can't know until you test each combination.The survival package does not provide any function to perform pairwise comparison between groups.
An implementation of an easy-to-use function -
pairewise_survdiff()
orpairewise_logrank()
- might be useful for multiple log-rank tests between pairs of groups . This function should return an adjusted p-value for multiple testing correction.The text was updated successfully, but these errors were encountered: