You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FAQ: multipletests 'bh' benjamini-hochberg correction returns a lot of identical p-values #4408
statsmodels.sandbox.stats.multicomp.multipletests 'bh' benjamini-hochberg correction returns a lot of identical p-values, I think the snippet below is self-explanatory. To my (limited) statistical knowledge, this is not supposed to happen.
EDIT: one gets the same results using the R stats library library(stats); p.adjust(pvalues, method = "BH", n=length(pvalues)) so I suppose this behaviour is correct? I will not delete the post until someone can confirm this. If someone can explain this behaviour, that would also be nice.
import numpy as np
np.random.seed(123)
pvalues = np.random.rand(20)
pvalues
I'm pretty sure that this is correct, unit tests are against R stats and/or R package multtest
(except "The 'fdr_gbs' procedure is not verified against another package" from the docstring.)
Most of the pvalue correction that are step-up or step-down methods have an adjustment that makes pvalues monotonic, and can cause identical corrected pvalues even if raw pvalues differ, e.g.
(It's a bit more complicated, because there is an initial correction with the Bonferroni or Sidak correction at each stage. In terms of the original values it is more like a condition that the pvalues cross a straight line (ray from zero) only once.
But I don't remember the details for each type of p-value correction, and given that it doesn't look like a bug, I won't try to remember now.)
BTW:
multiple testing functions have been moved out of the sandbox to statsmodels\stats\multitest.py
multiple comparison, tukey_hsd, is still located in the sandbox, but the official access is through statsmodels\stats\multicomp.py
The multicomp code will most likely be moved out of the sandbox in the following statsmodels version, 0.10.
I added the FAQ label so we can keep the issue open.
The example looks good for illustrating this because so many pvalues are corrected to the same values.
Right, don't close.
FAQ issues are often convenient to quickly check some information.
They can be ignored when we look at the github issues in terms of a bug-tracker.
changed the title [-]statsmodels.sandbox.stats.multicomp.multipletests 'bh' benjamini-hochberg correction returns a lot of identical p-values[/-][+]FAQ: multipletests 'bh' benjamini-hochberg correction returns a lot of identical p-values[/+]on Aug 28, 2021
Activity
PDiracDelta commentedon Mar 29, 2018
Updated original post (behaviour might actually be correct and not a bug at all)
josef-pkt commentedon Mar 29, 2018
I'm pretty sure that this is correct, unit tests are against R stats and/or R package
multtest(except "The 'fdr_gbs' procedure is not verified against another package" from the docstring.)
Most of the pvalue correction that are step-up or step-down methods have an adjustment that makes pvalues monotonic, and can cause identical corrected pvalues even if raw pvalues differ, e.g.
pvals_corrected = np.minimum.accumulate(pvals_corrected_raw[::-1])[::-1](It's a bit more complicated, because there is an initial correction with the Bonferroni or Sidak correction at each stage. In terms of the original values it is more like a condition that the pvalues cross a straight line (ray from zero) only once.
But I don't remember the details for each type of p-value correction, and given that it doesn't look like a bug, I won't try to remember now.)
BTW:
multiple testing functions have been moved out of the sandbox to
statsmodels\stats\multitest.pymultiple comparison, tukey_hsd, is still located in the sandbox, but the official access is through
statsmodels\stats\multicomp.pyThe multicomp code will most likely be moved out of the sandbox in the following statsmodels version, 0.10.
josef-pkt commentedon Mar 29, 2018
I added the FAQ label so we can keep the issue open.
The example looks good for illustrating this because so many pvalues are corrected to the same values.
PDiracDelta commentedon Mar 29, 2018
Alright, thanks for the quick reply and explanation josef! :)
(I understand from your comment I should not close the issue, right?)
josef-pkt commentedon Mar 29, 2018
Right, don't close.
FAQ issues are often convenient to quickly check some information.
They can be ignored when we look at the github issues in terms of a bug-tracker.
[-]statsmodels.sandbox.stats.multicomp.multipletests 'bh' benjamini-hochberg correction returns a lot of identical p-values[/-][+]FAQ: multipletests 'bh' benjamini-hochberg correction returns a lot of identical p-values[/+]