holmBonferroniCorrection

Adjusts p-values using the Holm-Bonferroni step-down correction for multiple comparisons.

The Holm-Bonferroni method controls the family-wise error rate (FWER) like Bonferroni but is uniformly more powerful. It sorts p-values from smallest to largest and multiplies each by a decreasing factor (number of remaining tests), enforcing monotonicity so that a p-value at a higher rank is never smaller than one at a lower rank.

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

Example:

val pValues = doubleArrayOf(0.01, 0.04, 0.03, 0.005)
holmBonferroniCorrection(pValues) // [0.03, 0.06, 0.06, 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 a simpler but more conservative alternative.

for false discovery rate control.