benjaminiHochbergCorrection

Adjusts p-values using the Benjamini-Hochberg procedure for false discovery rate control.

Unlike Bonferroni and Holm, which control the family-wise error rate (probability of any false positive), Benjamini-Hochberg controls the false discovery rate (FDR) — the expected proportion of false positives among all rejected hypotheses. This makes it substantially more powerful when many tests are performed, at the cost of allowing a controlled fraction of false discoveries.

The procedure sorts p-values from largest to smallest and multiplies each by the ratio of total tests to rank, enforcing monotonicity so that a p-value at a lower rank is never larger than one at a higher rank.

Adjusted p-values are clamped to a maximum of 1.0. NaN p-values pass through unchanged, but they still count towards the total number of tests.

Example:

val pValues = doubleArrayOf(0.01, 0.04, 0.03, 0.005)
benjaminiHochbergCorrection(pValues) // [0.02, 0.04, 0.04, 0.02]

Return

a new array of adjusted p-values in the same order as the input.

Parameters

pValues

the raw p-values to adjust. Each value must be in 0, 1 or NaN.

See also

for family-wise error rate control.

for a step-down FWER method.