Power Analysis & Sample Size Calculator
Input Parameters
Computed Results
The Power Analysis & Sample Size Calculator determines the number of observations needed to detect a statistically significant effect in an experiment. By inputting your desired statistical power, significance level, and minimum detectable effect, you can estimate the required sample size for both continuous and binomial data across various hypothesis tests.
Practical Use Cases
Power analysis is a critical step in experimental design. It ensures that a study has enough data to reliably detect a meaningful difference without wasting resources on an unnecessarily large sample. Common applications include:
- A/B Testing: Determining how many website visitors are needed to detect a specific increase in conversion rates (binomial data).
- Clinical Trials: Calculating the required number of patients to demonstrate that a new treatment is superior or non-inferior to an existing standard (continuous or binomial data).
- Quality Control: Estimating the sample size needed to verify that a manufacturing process meets specific continuous metric standards.
Formula & Explanation
The calculator uses standard statistical formulas to determine sample size based on the normal approximation. The core components involve the Z-scores for the chosen significance level (α) and statistical power (1 - β), the expected variance, and the effect size (Δ).
Continuous Data
For a two-sample superiority test with continuous data, the sample size for the control group (n₁) is calculated as:
Where:
- Z_α: The critical Z-value for the significance level (two-sided for superiority).
- Z_β: The critical Z-value for the desired power.
- σ: The standard deviation.
- k: The sampling ratio (Treatment / Control).
- Δ: The minimum detectable effect (MDE).
The treatment group sample size (n₂) is then n₁ × k.
Binomial Data
For binomial data (proportions), the calculator uses an arcsine transformation to calculate the standardized effect size (Cohen's h) and estimates variance based on the baseline proportion (p₁) and the expected proportion with the effect (p₂ = p₁ + MDE).
Hypothesis Types
- Superiority: Tests if there is a difference (two-sided α). Δ = MDE.
- Non-inferiority: Tests if a treatment is not worse by more than a specified margin (one-sided α). Δ = MDE + Margin.
- Equivalence: Tests if a treatment is within a specific margin (one-sided α). Δ = |Margin| - MDE.
Verified Scenario Walkthroughs
Below are examples of how different inputs affect the required sample size.
One-sample continuous superiority test
Comparing a single sample against a known baseline of 50, with a standard deviation of 10 and an MDE of 2. Using a 0.05 significance level and 0.80 power:
- Total Required Sample Size: 197
- Standardized Effect Size: 0.2
- Estimated Standard Error: 0.7125
Two-sample binomial conversion lift
Testing a conversion rate increase from a 10% baseline (0.1) by an MDE of 2% (0.02), with a 1:1 sampling ratio. Using a stricter 0.01 significance level and 0.90 power:
- Total Required Sample Size: 14,554 (7,277 per group)
- Standardized Effect Size: 0.064
- Estimated Standard Error: 0.0052
Non-inferiority continuous clinical trial
Testing if a new treatment is non-inferior to a baseline of 200 (standard deviation 25), with an MDE of 5 and a margin of 10. The sampling ratio is 2 (twice as many in the treatment group). Using a 0.025 significance level and 0.95 power:
- Total Required Sample Size: 165 (Control: 55, Treatment: 110)
- Standardized Effect Size: 0.6
- Estimated Standard Error: 4.1286
Equivalence binomial strict threshold
Testing equivalence around a 50% baseline (0.5) with an MDE of 5% (0.05) and a margin of 10% (0.1). The sampling ratio is 0.5 (half as many in the treatment group). Using a 0.001 significance level and 0.99 power:
- Total Required Sample Size: 13,116 (Control: 8,744, Treatment: 4,372)
- Standardized Effect Size: 0.1002
- Estimated Standard Error: 0.0092
How to Use the Calculator
- Select Experiment Type: Choose between a one-sample test (comparing to a known reference) or a two-sample test (comparing two independent groups).
- Select Data Metric Type: Choose "Continuous" for means (e.g., revenue, time) or "Binomial" for proportions/rates (e.g., conversion rate).
- Select Hypothesis Type: Choose Superiority, Non-inferiority, or Equivalence based on your testing goals.
- Set Statistical Parameters: Select your desired Significance Level (α) and Statistical Power (1 - β).
- Enter Baseline and Variance: Input the baseline value (mean or proportion). For continuous data, enter the expected standard deviation.
- Define the Effect: Enter the Minimum Detectable Effect (MDE) and, if applicable, the Margin (δ).
- Set Sampling Ratio: Specify the ratio of the treatment group size to the control group size.
Inputs & Outputs
| Input / Output | Description |
|---|---|
| Experiment Type | Whether comparing a single sample to a reference or two independent samples. |
| Data Metric Type | Continuous (means) or Binomial (proportions). |
| Hypothesis Type | Superiority, Non-inferiority, or Equivalence. |
| Significance Level (α) | The probability of a false positive (Type I error). |
| Statistical Power (1 - β) | The probability of detecting a true effect (avoiding a Type II error). |
| Baseline Value | The expected mean or proportion for the control group. |
| Standard Deviation (σ) | The expected variance for continuous data. |
| Minimum Detectable Effect (MDE) | The absolute difference you want the study to be able to detect. |
| Margin (δ) | The acceptable boundary for Non-inferiority or Equivalence tests. |
| Sampling Ratio | The ratio of treatment sample size to control sample size. |
| Total Required Sample Size (N) | The estimated total number of observations needed across all groups. |
| Sample Size - Control/Treatment | The estimated number of observations needed for each specific group. |
| Standardized Effect Size | Cohen's d (continuous) or Cohen's h (binomial) representing the magnitude of the effect. |
| Estimated Standard Error | The estimated standard error of the difference or mean based on the calculated sample size. |
Frequently Asked Questions
What is the difference between continuous and binomial data in power analysis?
Continuous data represents measurable quantities that can take any value within a range (like height, time, or revenue), requiring a standard deviation to estimate variance. Binomial data represents binary outcomes (like success/failure or click/no-click) expressed as proportions, where the variance is determined directly by the baseline proportion.
How does increasing statistical power affect sample size?
Increasing statistical power (e.g., from 0.80 to 0.90) increases the required sample size. A higher power means you want a greater probability of detecting a true effect, which requires more data to achieve that level of certainty.
Why does a smaller Minimum Detectable Effect (MDE) require a larger sample size?
A smaller MDE represents a more subtle difference between groups. Detecting a small difference reliably against the background noise (variance) of the data requires a larger sample size to achieve statistical significance.