Opens in a new tab

Home / Resources / Sample Size & Power

How to Calculate Sample Size for a Research Study

To calculate sample size, first decide whether your study aims to detect a meaningful effect or estimate a quantity with adequate precision. Then define the outcome, design, relevant variability or event rate, type I error, desired power or confidence-interval width, and expected missing data. There is no single formula for every research study (Lakens, 2022; Chow et al., 2017).

Sample Size & Power
INPUTS NEEDEDEffect, SD, α, power
FORMULA FAMILYNormal approximation
TYPICAL RESULT99 per group (example)
SOFTWAREG*Power, R, Stata
REPORT TOProtocol, grant, ethics

Why sample size matters

A small sample may produce estimates too uncertain to answer a research question. Collecting more observations than necessary may consume resources or expose additional participants to burdens without enough scientific benefit. The useful goal is not the largest sample: it is a sample capable of meeting the stated research objective (Lakens, 2022).

A sample-size calculation is performed before collecting outcome data. It describes assumptions under which a proposed design is expected to work. It cannot guarantee a statistically significant result, and a large sample cannot rescue biased sampling, inappropriate measurement, or confounding.

First decide what the sample is supposed to achieve

Decision flow from research aim to the sample size method that fits it.
Research aim Planning approach Typical inputs
Compare two group means Power analysis for a difference Mean difference, standard deviation, alpha, power, allocation
Compare two proportions Power analysis for binary outcomes Anticipated proportions, alpha, power, allocation
Estimate a survey proportion Precision-based sample size Expected proportion, confidence level, margin of error, sampling design
Develop a prediction model Model-specific sample-size criteria Candidate parameters, outcome frequency, anticipated model fit
Compare survival outcomes Event-based power analysis Hazard ratio, allocation, events, follow-up and censoring
Estimate a parameter precisely Confidence-interval planning Target interval width and expected variability

These categories correspond to distinct methods described in Chow et al. (2017), Cochran (1977), Riley et al. (2020), and Lakens (2022). Do not use the survey formula for a clinical trial or the two-group t-test formula for SEM.

How to calculate sample size: six inputs to defend

  1. Primary outcome and estimand. Is the target a difference in mean scores, risk difference, regression coefficient, hazard ratio, or population proportion? Define the comparison and time point.
  2. Smallest important effect. Select a difference worth detecting, preferably from clinical or substantive reasoning and prior literature; do not automatically use the largest effect in an earlier paper (Lakens, 2022).
  3. Variability or baseline risk. For a continuous outcome, justify the standard deviation; for a binary outcome, justify baseline and comparison proportions. These values should come from relevant studies or defensible design assumptions.
  4. Significance level and sidedness. A common design uses two-sided alpha = .05, but this is a study assumption, not a compulsory universal standard (Chow et al., 2017).
  5. Power or precision. Power is the probability of rejecting the specified null hypothesis when the assumed effect is true. Often investigators consider 80% or 90%; alternatively, specify a target confidence-interval width (Lakens, 2022).
  6. Allocation, dependence and incomplete data. Unequal groups, repeated assessments, clustering, censoring and dropout can materially change the calculation.

A simple formula for a two-group example

For two independent, equally sized groups with a continuous outcome and a common standard deviation, a commonly used normal-approximation formula is:

FORMULA

n per group ≈ 2 σ² (z₁₋α/₂ + z₁₋β)² / δ²

Here, σ is the assumed common standard deviation, δ is the mean difference of interest, α is the two-sided type I error rate, and 1 − β is the desired power. The two z values are standard-normal quantiles (Machin et al., 2009; Chow et al., 2017).

WORKED EXAMPLE (HYPOTHETICAL VALUES)

Suppose a study compares two independent groups on a symptom score. Assume δ = 6 score units and σ = 15 units. Choose two-sided α = .05 and power = 80%. The corresponding z quantiles are approximately 1.960 and 0.842.

FORMULA

n ≈ 2 × 15² × (1.960 + 0.842)² / 6² = 98.11

Rounding up gives 99 analyzable participants per group (198 in total) using this approximation. The final value should be checked using the exact or software-based calculation for the planned statistical test, particularly in small samples. For a projected 20% loss of analyzable data, the simple planning adjustment is ceil(99 / 0.80) = 124 recruits per group; this assumes losses can be reasonably represented by that fraction and are not otherwise biasing (Chow et al., 2017).

Example in R

The same hypothetical calculation can be run in R. The normal approximation reproduces the 99 per group above. The t-based function returns about 99.1 before rounding, so the requirement for the planned two-sample t-test is 100 per group, which is why the final value should come from the planned test.

R

# Hypothetical inputs: replace with your own justified values
delta <- 6        # smallest mean difference of interest
sigma <- 15       # assumed common standard deviation
alpha <- 0.05     # two-sided type I error rate
target_power <- 0.80

# Normal approximation, as in the formula above
z <- qnorm(1 - alpha / 2) + qnorm(target_power)
n_normal <- 2 * sigma^2 * z^2 / delta^2
ceiling(n_normal)                   # per group, rounded up

# t-based calculation for the planned two-sample t-test
power.t.test(delta = delta, sd = sigma, sig.level = alpha,
             power = target_power, type = "two.sample",
             alternative = "two.sided")

# Recruitment target if 20% of outcomes will not be analyzable
ceiling(ceiling(n_normal) / 0.80)

Power-based versus precision-based planning

Power-based planning asks whether the planned study has a specified probability of identifying a particular effect under a specified hypothesis test. Precision-based planning instead selects n to achieve a targeted interval width around an estimate. A descriptive survey seeking a population prevalence may be better framed through precision, while an efficacy trial with a prespecified superiority hypothesis often uses power. A single project may need to check both targets (Lakens, 2022).

For example, in a simple random sample estimating a proportion, a familiar approximate formula is n₀ = z²p(1 − p)/e², where e is the desired margin of error. That result assumes probability sampling, a normal approximation and no design effect; it does not automatically apply to opt-in online surveys (Cochran, 1977).

What can make your calculation misleading?

A convenient effect size masquerading as evidence. Explain why the effect is important and plausible.
Confusing participants with observations. Ten repeated records per patient do not mean ten independent patients.
Ignoring clusters. Patients within the same clinic may resemble one another; cluster trials need design-specific calculations (Eldridge et al., 2006).
Using a generic ’10 events per variable’ rule for prediction. Model development depends on candidate parameters, outcome frequency and anticipated performance (Riley et al., 2020).
Relying on observed post-study power. This does not substitute for the original design rationale (Hoenig & Heisey, 2001).
Treating the target n as a guarantee. Non-response, missing outcome data, poor measurement and assumption errors can change the study’s actual information.

How to report a sample-size calculation

REPORTING TEMPLATE

The sample size was planned for the primary outcome of [name and time point]. Assuming [effect or precision target] based on [source], [standard deviation/baseline risk], a [two-sided/one-sided] α of [value], and [power or confidence level], the required analyzable sample was [n] using [method/software/version]. After allowing for [anticipated attrition], the recruitment target was [N]. [Design-specific adjustments] were incorporated as follows: [details].

The calculation should be reproducible from these inputs. Report the actual recruited and analyzed samples separately; do not silently replace the planned assumptions with post-study values.

Frequently asked questions

There is no universal answer. One hundred may provide adequate precision for one aim and inadequate information for another. The outcome, desired effect, variance, design and inferential goal determine the answer (Lakens, 2022).

No. It is a commonly considered convention, not a universal requirement. Select the target based on the cost of missing an effect, study context, available evidence and feasibility (Lakens, 2022; Chow et al., 2017).

You can describe the precision achieved or the effects your sample was sensitive to, but post hoc calculations do not reconstruct a genuine prospective justification (Hoenig & Heisey, 2001).

Choose a formula or simulation that matches your planned outcome, design, hypothesis or precision objective and analysis. For complex designs, seek a method-specific calculation rather than a generic calculator.

Research Planning & Study DesignNeed the sample size confirmed before the protocol goes out? A statistician checks the inputs and the calculation against your design and documents the justification.

Request an Assessment

Research Planning & Study Design

Research Planning & Study Design at OnlineSPSS is carried out by in-house PhD-level statisticians. A statistically trained Research Coordinator reviews your request, and the analytical work, deliverables, timeline and fixed project fee are confirmed before work begins. The research question, interpretation and conclusions remain with you.

References

  1. Chow, S.-C., Shao, J., Wang, H., & Lokhnygina, Y. (2017). Sample size calculations in clinical research (3rd ed.). CRC Press. https://doi.org/10.1201/9781315183084
  2. Cochran, W. G. (1977). Sampling techniques (3rd ed.). Wiley.
  3. Eldridge, S. M., Ashby, D., & Kerry, S. (2006). Sample size for cluster randomized trials: Effect of coefficient of variation of cluster size and analysis method. International Journal of Epidemiology, 35(5), 1292–1300. https://doi.org/10.1093/ije/dyl129
  4. Hoenig, J. M., & Heisey, D. M. (2001). The abuse of power: The pervasive fallacy of power calculations for data analysis. The American Statistician, 55(1), 19–24. https://doi.org/10.1198/000313001300339897
  5. Lakens, D. (2022). Sample size justification. Collabra: Psychology, 8(1), Article 33267. https://doi.org/10.1525/collabra.33267
  6. Machin, D., Campbell, M. J., Tan, S.-B., & Tan, S.-H. (2009). Sample size tables for clinical studies (3rd ed.). Wiley-Blackwell. https://doi.org/10.1002/9781444300710
  7. Riley, R. D., Ensor, J., Snell, K. I. E., Harrell, F. E., Jr., Martin, G. P., Reitsma, J. B., Moons, K. G. M., Collins, G. S., & van Smeden, M. (2020). Calculating the sample size required for developing a clinical prediction model. BMJ, 368, m441. https://doi.org/10.1136/bmj.m441

Last reviewed November 2026 by the OnlineSPSS Statistical Team. Worked examples use hypothetical values and are not client data.

NEXT STEP

Need this done for
your study?

Share your research in about a minute and receive a complimentary assessment the same day: scope, timeline and one fixed fee.

No Commitment Required

Strictly Confidential

Fixed Project Fee

In-House PhD-Level Statisticians

Same-Day Response

Serving Researchers Since 2014