Sample Size Calculators (A-priori)

These calculators answer the core design-stage question: "How many participants do I need?" Each takes your target effect, significance level (alpha), and desired power (1 - beta), and returns the required sample size.

Common conventions: alpha defaults to two-sided 0.05; power defaults to 80%; sample sizes are always rounded up (ceil). Each calculator reports the standardised effect size with interpretation label, plain-language recommendation, and manuscript Methods Section.


Paired Means

For paired/repeated designs (same subjects measured twice, e.g. before vs after).

Inputs: mean difference, SD of difference (or of measurements), correlation between paired measurements (default 0.5), power, alpha.

Formula:

Cohen's d = |mean difference| / SD
n = ceil( (z_alpha + z_beta)^2 * 2 * (1 - correlation) / d^2 )

Higher correlation reduces required sample size -- the paired design gains efficiency from within-subject correlation.

Effect-size interpretation (Cohen's d): Very small < 0.2; Small 0.2-0.5; Medium 0.5-0.8; Large >= 0.8.


Independent Means

For comparing means of two independent groups (most common two-arm design).

Inputs: expected mean difference, SD of group 1, SD of group 2, allocation ratio (group 2 / group 1), power, alpha.

Formula (equal allocation):

pooled SD = sqrt((SD1^2 + SD2^2) / 2)
Cohen's d = |mean difference| / pooled SD
n1 = n2 = ceil( (z_alpha + z_beta)^2 * (SD1^2 + SD2^2) / (mean difference)^2 )

Formula (unequal allocation, ratio = r):

n1 = ceil( (z_alpha + z_beta)^2 * (SD1^2 + SD2^2/r) / (mean difference)^2 )
n2 = ceil( n1 * r )

If total exceeds 1,000, warns size may be impractically large. If d < 0.5, notes small effect requires large sample.


Independent Proportions

For comparing two independent proportions (event rates).

Inputs: proportion 1, proportion 2 (or effect size h directly), allocation ratio, power, alpha.

Effect size -- Cohen's h (arcsine-transformed):

h = 2*arcsin(sqrt(p1)) - 2*arcsin(sqrt(p2))

Formula (from proportions, with pooling):

p_bar = (p1 + r*p2) / (1 + r)
n1 = ceil( [z_alpha*sqrt(p_bar*(1-p_bar)*(1+1/r)) + z_beta*sqrt(p1*(1-p1) + p2*(1-p2)/r)]^2 / (p1-p2)^2 )
n2 = ceil( n1 * r )

The pooled-variance form gives more precise results than the h-based form by accounting for actual arm variances.


Correlation Coefficient

For studies estimating or testing a single Pearson correlation against zero.

Inputs: expected correlation r, power, alpha.

Formula (Fisher z-transformation):

z_r = arctanh(|r|) = 0.5 * ln((1+r)/(1-r))
n = ceil( ((z_alpha + z_beta) / z_r)^2 + 3 )

The +3 is the standard correction for the Fisher z-transformation.


Two Correlation Coefficients

For comparing two independent correlations (e.g. correlation in group A vs group B).

Inputs: correlation 1, correlation 2, power, alpha.

Formula: Both correlations Fisher-z transformed, sample size based on z-difference.

Difference interpretation (z-difference scale): Very small < 0.2; Small 0.2-0.5; Medium 0.5-0.8; Large >= 0.8.


Odds Ratio

For case-control designs where the target effect is an odds ratio.

Inputs: baseline odds/proportion, target odds ratio, allocation ratio, power, alpha.

Method: Second-group odds derived via odds2 = odds1 * OR. Sample size computed on log-odds scale, converted to per-group sizes.

Effect-size interpretation (|ln(OR)|):

| |ln(OR)| | Label | |---|---| | < ln(1.5) | Small effect | | ln(1.5) - ln(3) | Medium effect | | ln(3) - ln(5) | Large effect | | >= ln(5) | Very large effect |


Relative Risk

For cohort designs where the target effect is a relative risk.

Inputs: baseline proportion (unexposed risk), target RR, allocation ratio, power, alpha.

Method: Exposed-group proportion = p1 * RR. Sample size computed on log-RR scale, converted to per-group sizes.

Effect-size interpretation (|ln(RR)|):

| |ln(RR)| | Label | |---|---| | < ln(1.5) | Small effect | | ln(1.5) - ln(3) | Medium effect | | ln(3) - ln(5) | Large effect | | >= ln(5) | Very large effect |


Common output

Every calculator produces:

Output Contents
Sample size Per-group sizes and total (rounded up)
Effect size Standardised effect with interpretation label
Power statement Plain-language summary
Recommendation Practical guidance, warnings for large sizes
Limitations Assumptions (normality, equal variances, etc.)
Power curve Interactive chart showing power vs sample size
Methods Section Manuscript-ready paragraph with citations

These formulas use the normal-approximation framework standard in applied power analysis. They assume the stated effect is the true effect and that data meet the test's distributional assumptions.