Skip to content
DeepForgeby svx
All problems
HardStatisticsst-376

Required Sample Size Per Group

Problem

For a two-sided test the required sample size per group is ceil(((z_alpha + z_beta) / delta)^2), where delta is the standardized effect size.

Given z_alpha, z_beta, and delta > 0, return the integer sample size.

Hint

Scale by the effect size and round up.

Test cases

case 1
in: [1.96,0.84,0.5]
expected: 32
case 2
in: [1.645,0.84,0.2]
expected: 155
case 3
in: [2.576,1.28,0.8]
expected: 24
Starter codePython
def required_sample_size_per_group(z_alpha, z_beta, delta):
    # Your code here
    pass

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