Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-123

Conditional Power

Problem

Return the conditional power 1 - Phi((z_crit - z_interim/sqrt(t)) / sqrt(1-t)) under the current trend, given the interim z statistic and information fraction t. Return 0.0 when t is not strictly between 0 and 1.

Hint

It projects the interim drift to the final analysis.

Test cases

case 1
in: [2,0.5,1.96]
expected: 0.8903030572815851
case 2
in: [1,0.5,1.96]
expected: 0.2200990951703165
case 3
in: [3,0.25,1.96]
expected: 0.9999984568410762
case 4
in: [0,0.5,1.96]
expected: 0.0027868622675860655
case 5
in: [2,1,1.96]
expected: 0
Starter codePython
import math
def conditional_power(z_interim, information_fraction, z_crit):
    # Your code here
    pass

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