Knowledge Base / Sample Size and Power Analysis Study Design 7 min read

Sample Size and Power Analysis

Comprehensive reference guide for sample size calculations and power analysis.

Sample Size and Power Analysis: Comprehensive Reference Guide

This comprehensive guide covers power analysis fundamentals, sample size calculations for various study designs, effect size determination, and practical considerations for planning statistical studies with detailed mathematical formulations and interpretation guidelines.

Overview

Sample size and power analysis are crucial components of study design that determine the ability to detect meaningful effects and ensure adequate statistical power. Proper planning prevents underpowered studies and resource waste while maintaining scientific rigor.

Power Analysis Fundamentals

1. Statistical Errors

Type I Error (α):

Type II Error (β):

Statistical Power (1-β):

2. Effect Size

Definition: Standardized measure of the magnitude of difference or association.

Cohen's Conventions:

Cohen's d (standardized mean difference): d=μ1μ2σd = \frac{\mu_1 - \mu_2}{\sigma}

Correlation coefficient (r): r=covarianceσxσyr = \frac{\text{covariance}}{\sigma_x \sigma_y}

Cohen's f (ANOVA effect size): f=η21η2f = \sqrt{\frac{\eta^2}{1-\eta^2}}

3. Factors Affecting Power

  1. Effect size: Larger effects easier to detect
  2. Sample size: Larger samples increase power
  3. Significance level (α): Lower α decreases power
  4. Variability: Lower variability increases power
  5. Study design: More efficient designs increase power

Sample Size Calculations for Different Study Designs

1. One-Sample Tests

One-Sample t-test (mean): n=(zα/2+zβ)2σ2(μ1μ0)2n = \frac{(z_{\alpha/2} + z_\beta)^2 \sigma^2}{(\mu_1 - \mu_0)^2}

One-Sample z-test (proportion): n=(zα/2+zβ)2p0(1p0)(p1p0)2n = \frac{(z_{\alpha/2} + z_\beta)^2 p_0(1-p_0)}{(p_1 - p_0)^2}

Where:

2. Two-Sample Tests

Independent samples t-test (equal variances): n=2(zα/2+zβ)2σ2(μ1μ2)2n = \frac{2(z_{\alpha/2} + z_\beta)^2 \sigma^2}{(\mu_1 - \mu_2)^2}

Independent samples t-test (unequal variances): n1=(zα/2+zβ)2(σ12+σ22/k)(μ1μ2)2n_1 = \frac{(z_{\alpha/2} + z_\beta)^2(\sigma_1^2 + \sigma_2^2/k)}{(\mu_1 - \mu_2)^2}

Where k = n2/n1n_2/n_1 (allocation ratio)

Two-sample z-test (proportions): n=(zα/22pˉ(1pˉ)+zβp1(1p1)+p2(1p2))2(p1p2)2n = \frac{(z_{\alpha/2}\sqrt{2\bar{p}(1-\bar{p})} + z_\beta\sqrt{p_1(1-p_1) + p_2(1-p_2)})^2}{(p_1 - p_2)^2}

Where pˉ=(p1+p2)/2\bar{p} = (p_1 + p_2)/2

Paired t-test: n=(zα/2+zβ)2σd2μd2n = \frac{(z_{\alpha/2} + z_\beta)^2 \sigma_d^2}{\mu_d^2}

Where:

3. ANOVA Designs

One-way ANOVA: n=(Fα,k1,+Fβ,k1,)2f2n = \frac{(F_{\alpha,k-1,\infty} + F_{\beta,k-1,\infty})^2}{f^2}

Simplified formula: n=(zα/2+zβ)2f2+1n = \frac{(z_{\alpha/2} + z_\beta)^2}{f^2} + 1

Two-way ANOVA: n=(zα/2+zβ)2f2×dfeffect+cn = \frac{(z_{\alpha/2} + z_\beta)^2}{f^2 \times df_{effect}} + c

Where:

Repeated Measures ANOVA: n=(zα/2+zβ)2(1+(k1)ρ)k×f2n = \frac{(z_{\alpha/2} + z_\beta)^2(1 + (k-1)\rho)}{k \times f^2}

Where:

4. Factorial Designs

2×2 Factorial Design: n=4(zα/2+zβ)2σ2(main effect)2n = \frac{4(z_{\alpha/2} + z_\beta)^2 \sigma^2}{(\text{main effect})^2}

For interaction effect: n=4(zα/2+zβ)2σ2(interaction effect)2n = \frac{4(z_{\alpha/2} + z_\beta)^2 \sigma^2}{(\text{interaction effect})^2}

General factorial design: n=(zα/2+zβ)2σ2×design factor(effect size)2n = \frac{(z_{\alpha/2} + z_\beta)^2 \sigma^2 \times \text{design factor}}{(\text{effect size})^2}

Correlation and Regression Studies

1. Correlation Analysis

Sample size for correlation: n=(zα/2+zβ)2(12ln(1+r1r))2+3n = \frac{(z_{\alpha/2} + z_\beta)^2}{(\frac{1}{2}\ln(\frac{1+r}{1-r}))^2} + 3

Fisher's z-transformation: zr=12ln(1+r1r)z_r = \frac{1}{2}\ln\left(\frac{1+r}{1-r}\right)

Power for given sample size: Power=Φ(zrn3zα/21)Power = \Phi\left(\frac{|z_r|\sqrt{n-3} - z_{\alpha/2}}{1}\right)

2. Linear Regression

Simple linear regression: n=(zα/2+zβ)2f2+u+1n = \frac{(z_{\alpha/2} + z_\beta)^2}{f^2} + u + 1

Where:

Multiple regression: n=(zα/2+zβ)2(1R2)R2+u+1n = \frac{(z_{\alpha/2} + z_\beta)^2(1-R^2)}{R^2} + u + 1

Logistic regression: n=(zα/2+zβ)2p(1p)(ln(OR))2n = \frac{(z_{\alpha/2} + z_\beta)^2}{p(1-p)(\ln(OR))^2}

Where:

Non-Parametric Test Sample Sizes

1. Mann-Whitney U Test

Asymptotic relative efficiency (ARE) = 0.955: nnonparametric=nparametric0.955n_{nonparametric} = \frac{n_{parametric}}{0.955}

Direct formula: n=(zα/2+zβ)212(Φ1(P(X>Y))0.5)2n = \frac{(z_{\alpha/2} + z_\beta)^2}{12(\Phi^{-1}(P(X > Y)) - 0.5)^2}

2. Wilcoxon Signed-Rank Test

ARE = 0.955 relative to paired t-test: nWilcoxon=nttest0.955n_{Wilcoxon} = \frac{n_{t-test}}{0.955}

3. Kruskal-Wallis Test

ARE = 0.864 relative to one-way ANOVA: nKW=nANOVA0.864n_{KW} = \frac{n_{ANOVA}}{0.864}

Survival Analysis Sample Size Calculations

1. Log-Rank Test

Formula: n=(zα/2+zβ)2p1p2(ln(HR))2n = \frac{(z_{\alpha/2} + z_\beta)^2}{p_1 p_2 (\ln(HR))^2}

Where:

With censoring: n=(zα/2+zβ)2p1p2(ln(HR))2×Peventn = \frac{(z_{\alpha/2} + z_\beta)^2}{p_1 p_2 (\ln(HR))^2 \times P_{event}}

Where PeventP_{event} = probability of observing event

2. Cox Proportional Hazards

Number of events needed: E=(zα/2+zβ)2(ln(HR))2E = \frac{(z_{\alpha/2} + z_\beta)^2}{(\ln(HR))^2}

Total sample size: n=EPeventn = \frac{E}{P_{event}}

3. Exponential Survival

Equal allocation: n=2(zα/2+zβ)2(λ1+λ2)2(λ1λ2)2Tn = \frac{2(z_{\alpha/2} + z_\beta)^2(\lambda_1 + \lambda_2)^2}{(\lambda_1 - \lambda_2)^2 T}

Where:

Cluster Randomized Trials and Multilevel Studies

1. Cluster Randomized Trials

Design effect: DE=1+(m1)ρDE = 1 + (m-1)\rho

Where:

Adjusted sample size: ncluster=nindividual×DEn_{cluster} = n_{individual} \times DE

Number of clusters: c=nclustermc = \frac{n_{cluster}}{m}

2. Multilevel Models

Two-level design: nlevel2=(zα/2+zβ)2σtotal2(effect size)2×(1ρ)n_{level2} = \frac{(z_{\alpha/2} + z_\beta)^2 \sigma^2_{total}}{(\text{effect size})^2 \times (1-\rho)}

Three-level design: n=(zα/2+zβ)2(effect size)2×variance inflation factorn = \frac{(z_{\alpha/2} + z_\beta)^2}{(\text{effect size})^2} \times \text{variance inflation factor}

3. Stepped Wedge Designs

Sample size adjustment: nSW=nparallel×3(1ρ)2Tρn_{SW} = n_{parallel} \times \frac{3(1-\rho)}{2T\rho}

Where:

Post-Hoc Power Analysis Considerations

1. Observed Power

Problems with observed power:

Formula: Observed Power=Φ(tobservedtα/21)\text{Observed Power} = \Phi\left(\frac{|t_{observed}| - t_{\alpha/2}}{\sqrt{1}}\right)

2. Confidence Intervals

Preferred approach:

Relationship to power: CI=estimate±tα/2×SECI = \text{estimate} \pm t_{\alpha/2} \times SE

3. Effect Size Estimation

Retrospective effect size: d=xˉ1xˉ2spooledd = \frac{\bar{x}_1 - \bar{x}_2}{s_{pooled}}

Confidence interval for effect size: CId=d±tα/2×SEdCI_d = d \pm t_{\alpha/2} \times SE_d

Software Recommendations and Practical Guidelines

1. Software Options

Specialized Software:

General Statistical Software:

2. Practical Considerations

Planning Phase:

  1. Define primary endpoint clearly
  2. Specify effect size of interest
  3. Consider feasibility constraints
  4. Plan for attrition/dropout
  5. Consider multiple comparisons

Effect Size Determination:

Sample Size Inflation:

3. Reporting Guidelines

Essential Elements:

Example: "Sample size was calculated for a two-sided t-test comparing mean scores between groups. Assuming a medium effect size (Cohen's d = 0.5), α = 0.05, and power = 0.80, a total sample size of 128 participants (64 per group) was required. Accounting for 20% attrition, we aimed to recruit 160 participants."

4. Common Mistakes

Avoid These Errors:

This comprehensive guide provides the foundation for understanding and conducting proper sample size and power analysis for various study designs and statistical tests.