Sample size & power

Plan two equal independent mean-comparison groups from Cohen’s d, target power and significance level.

About this tool

Plan a comparison of two independent means with equal group sizes and a common population standard deviation. Cohen’s d is the absolute expected mean difference divided by that standard deviation. Inputs for target power and significance α are percentages. An effect of zero cannot increase power above the false-positive level.

This is a normal (z) approximation, not exact t-test power. It assumes the supplied population effect/standard deviation and independent comparable observations. Estimated variance, small groups, paired observations, unequal allocation, proportions or clustered samples need another design-specific model. Select a one-sided alternative only with a direction fixed before observing data; d is assumed in that direction.

For n analysable observations per group, δ=d√(n/2). With critical z=Φ⁻¹(1−α/sides), power is Φ(δ−z) for one-sided and Φ(δ−z)+Φ(−δ−z) for two-sided. The smallest positive integer n attaining the target in this model is found numerically; both two-sided tails are included. The achieved power can be checked after rounding.

Total analysed is 2n. A dropout reserve f recruits ceil(n/(1−f)) separately per group. It reflects expected retention, not a guarantee that enough observations will remain, and does not change the analysable sample requirement.

All computation stays in the browser. Normal tails use a central series and a continued fraction in the tail, quantiles use bisection. Extremely small probabilities or effects can exceed floating-point/safe-integer limits; errors retain inputs instead of showing Infinity or zero. Raw assumptions, including unfinished inputs, persist through navigation/reload. Valid edits recalculate directly; results are not stored.

statsmodels: two-group normal power · NIST: error-function continued fractions