Skip to content
DeepForgeby svx
All problems
HardStatisticsst-374

Holm Step Adjusted P Value

Problem

The Holm-adjusted p-value at rank i of the sorted p-values is the running maximum max_{j <= i} (m - j + 1) * p_(j), capped at 1.

Given the sorted p-values (ascending) and the rank i (1-based), return the adjusted value.

Hint

Enforce monotonicity with a running maximum.

Test cases

case 1
in: [[0.001,0.01,0.02,0.5],2]
expected: 0.03
case 2
in: [[0.001,0.01,0.02,0.5],4]
expected: 0.5
case 3
in: [[0.01,0.04,0.6],2]
expected: 0.08
Starter codePython
def holm_step_adjusted_p_value(sorted_pvalues, rank):
    # Your code here
    pass

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