Skip to content
DeepForgeby svx
All problems
HardML Fundamentalsml-348

O'Brien-Fleming Alpha Spending

Problem

Compute the O'Brien-Fleming alpha spending function at information fraction t: 2 * (1 - Phi(z / sqrt(t))), where Phi is the standard normal CDF and z is its inverse at 1 - alpha/2 (found by bisection). Return 0.0 for t <= 0 and alpha for t >= 1.

Hint

The spending function releases very little alpha early and approaches the full alpha at the final look.

Test cases

case 1
in: [0.05,0.25]
expected: 0.00008857543832130332
case 2
in: [0.05,0.5]
expected: 0.005574596680784527
case 3
in: [0.01,0.5]
expected: 0.00026971695663147166
case 4
in: [0.05,0]
expected: 0
case 5
in: [0.05,1]
expected: 0.05
Starter codePython
import math

def obf_alpha_spending(alpha, info_fraction):
    # Your code here
    pass

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