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

Slightly different p-values using p.adjust.method in wilcox_test or running p.adjust afterwards #187

Open
lucygarner opened this issue Apr 6, 2023 · 0 comments

Comments

@lucygarner
Copy link

lucygarner commented Apr 6, 2023

Hi @kassambara,

I am getting slightly different p-values if I p.adjust.method within wilcox_test or run p.adjust afterwards and I am just trying to understand why.

data(iris)
iris$Petal.Width <- factor(iris$Petal.Width)

wilcox_p <- iris %>% 
    group_by(Species) %>% 
    wilcox_test(Sepal.Length ~ Petal.Width, p.adjust.method = "BH")

image

The first 15 rows correspond to the setosa species, so I run:

p.adjust(wilcox_p$p[1:15], method = "BH")

The first three p-values are 0.9313636, 0.9313636, 0.1950000. This compares with 0.931, 0.931, 0.192 from wilcox_test. Any thoughts on why this is?

As far as I understand, multiple testing correction is only done within a group e.g. for comparisons made within a species in this example. Would you not also want to correct for the fact that you are testing multiple species?

So do you recommend:

wilcox_p <- iris %>% 
    group_by(Species) %>% 
    wilcox_test(Sepal.Length ~ Petal.Width) %>% 
    adjust_pvalue(p.col = "p", method = "BH")

Best wishes,
Lucy

@lucygarner lucygarner changed the title Slightly different p-values if I run p.adjust separately Slightly different p-values using p.adjust.method in wilcox_test or running p.adjust afterwards Apr 6, 2023
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

1 participant