pingouin.fdr

pingouin.fdr(pvals, alpha=0.05, method='fdr_bh')[source]

P-values FDR correction with Benjamini/Hochberg and Benjamini/Yekutieli procedure.

This covers Benjamini/Hochberg for independent or positively correlated and Benjamini/Yekutieli for general or negatively correlated tests.

Parameters
pvalsarray_like

Array of p-values of the individual tests.

alphafloat

Error rate (= alpha level).

methodstr

FDR correction methods

'fdr_bh' : Benjamini/Hochberg for independent / posit correlated tests
'fdr_by' : Benjamini/Yekutieli for negatively correlated tests
Returns
rejectarray, bool

True if a hypothesis is rejected, False if not

pval_correctedarray

P-values adjusted for multiple hypothesis testing using the BH or BY correction.

See also

bonf

Bonferroni correction

holm

Holm-Bonferroni correction

Notes

From Wikipedia:

The Benjamini–Hochberg procedure (BH step-up procedure) controls the false discovery rate (FDR) at level \(\alpha\). It works as follows:

1. For a given \(\alpha\), find the largest \(k\) such that \(P_{(k)}\leq \frac {k}{m}\alpha.\)

2. Reject the null hypothesis (i.e., declare discoveries) for all \(H_{(i)}\) for \(i = 1, \ldots, k\).

The BH procedure is valid when the m tests are independent, and also in various scenarios of dependence, but is not universally valid.

The Benjamini–Yekutieli procedure (BY) controls the FDR under arbitrary dependence assumptions. This refinement modifies the threshold and finds the largest \(k\) such that:

\[P_{(k)} \leq \frac{k}{m \cdot c(m)} \alpha\]

References

  • Benjamini, Y., and Hochberg, Y. (1995). Controlling the false discovery rate: a practical and powerful approach to multiple testing. Journal of the Royal Statistical Society Series B, 57, 289–300.

  • Benjamini, Y., and Yekutieli, D. (2001). The control of the false discovery rate in multiple testing under dependency. Annals of Statistics, 29, 1165–1188.

  • https://en.wikipedia.org/wiki/False_discovery_rate

Examples

FDR correction of an array of p-values

>>> from pingouin import fdr
>>> pvals = [.50, .003, .32, .054, .0003]
>>> reject, pvals_corr = fdr(pvals, alpha=.05)
>>> print(reject, pvals_corr)
[False  True False False  True] [0.5    0.0075 0.4    0.09   0.0015]