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

Frequently Asked Questions

What is an acceptable power level?

80% (0.80) is the conventional minimum. Many researchers aim for 90% power. Lower power means a higher risk of failing to detect a real effect (Type II error).

What is the relationship between alpha, power, and sample size?

They are interconnected: fixing any two determines the third (given the effect size). Decreasing alpha or increasing power both require larger sample sizes.

What if the effect size is unknown?

Use pilot study estimates, published benchmarks (small=0.2, medium=0.5, large=0.8), or determine the minimum clinically important difference and convert it to d by dividing by the expected SD.

Ready to run the numbers?

Open Power Analysis Calculator