Power Analysis Calculator Formula

Understand the math behind the power analysis calculator. Each variable explained with a worked example.

Formulas Used

Sample Size per Group

n_per_group = pow((z_alpha + z_beta) / d, 2)

Total Sample Size (2 groups)

total_n = 2 * pow((z_alpha + z_beta) / d, 2)

Target Power (%)

power_pct = 80

Variables

VariableDescriptionDefault
dEffect Size (Cohen's d)0.5
alphaSignificance Level (alpha)0.05
z_alphaZ for alpha/2 (e.g., 1.96)1.96
z_betaZ for power (e.g., 0.842 for 80%)0.842

How It Works

How to Perform a Power Analysis

Formula

n per group = ((z_alpha/2 + z_beta) / d)^2

Power is the probability of correctly rejecting a false null hypothesis (detecting a real effect). This formula estimates the sample size needed per group for a two-sample test. Higher power, smaller effect sizes, and lower alpha all require larger samples.

Worked Example

Detect a medium effect (d = 0.5) with 80% power at alpha = 0.05.

d = 0.5alpha = 0.05z_alpha = 1.96z_beta = 0.842
  1. 01n = ((1.96 + 0.842) / 0.5)^2
  2. 02= (2.802 / 0.5)^2
  3. 03= 5.604^2
  4. 04= 31.4
  5. 05Round up: 32 per group, 64 total

Ready to run the numbers?

Open Power Analysis Calculator