Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-122

Sequential Alpha Spending

Problem

Return the O'Brien-Fleming alpha spending 2*(1 - Phi(z_crit / sqrt(t))) at information fraction t, where z_crit is the fixed-sample critical value. Return 0.0 when t is not in (0, 1].

Hint

Very little alpha is spent early when the boundary is conservative.

Test cases

case 1
in: [1.96,0.5]
expected: 0.005573724535172131
case 2
in: [1.96,1]
expected: 0.049995790296440745
case 3
in: [2.576,0.25]
expected: 2.577230360234495e-7
case 4
in: [1.96,0]
expected: 0
case 5
in: [1.645,0.5]
expected: 0.019998217783908867
Starter codePython
import math
def alpha_spending(z_crit, information_fraction):
    # Your code here
    pass

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