bonferroniCorrection
Adjusts p-values using the Bonferroni correction for multiple comparisons.
The Bonferroni correction controls the family-wise error rate (FWER) by multiplying each p-value by the total number of tests. This is the simplest and most conservative correction — it guarantees that the probability of any false positive across all tests stays below the significance level, but may miss true effects when many tests are performed.
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 used as the multiplier.
Example:
val pValues = doubleArrayOf(0.01, 0.04, 0.03, 0.005)
bonferroniCorrection(pValues) // [0.04, 0.16, 0.12, 0.02]Return
a new array of adjusted p-values in the same order as the input.
Parameters
the raw p-values to adjust. Each value must be in 0, 1 or NaN.
See also
for a less conservative step-down alternative.
for false discovery rate control.