Skip to content
DeepForgeby svx
All problems
MediumML Fundamentalsml-192

Holm-Bonferroni Step

Problem

Count rejections with the Holm-Bonferroni step-down procedure. Sort p-values ascending; reject while p_(i) <= alpha / (m - i) for 0-based i, stopping at the first failure.

Empty input returns 0.

Hint

Holm is uniformly more powerful than plain Bonferroni because thresholds loosen as you reject.

Test cases

case 1
in: [[0.001,0.01,0.04],0.05]
expected: 3
case 2
in: [[0.02,0.03,0.04],0.05]
expected: 0
case 3
in: [[0.01,0.5],0.05]
expected: 1
case 4
in: [[],0.05]
expected: 0
Starter codePython
def holm_count(p_values, alpha):
    # Your code here
    pass

4 test cases · run your code against them in the editor