COLLEGE STATISTICS • ESTIMATION AND CONFIDENCE INTERVALS

Sample Size Selection — Selecting Sample Size for a Desired Margin of Error

Learn to determine the minimum sample size needed to achieve a specified level of precision in your estimates.

Historical Context & Motivation

Before researchers could send surveys to thousands of respondents or run clinical trials with hundreds of patients, they faced a fundamental question: how many observations are enough? Collecting too few observations produces estimates so imprecise that they are practically useless, while collecting too many wastes time, money, and ethical capital—particularly in medical research where each additional subject bears real risk. The formal mathematics of sample size determination grew out of the broader development of inferential statistics during the late nineteenth and early twentieth centuries, as statisticians sought to place survey results and experimental findings on rigorous probabilistic footing.

The story begins with the formalization of the normal distribution and its role in describing sampling variability. Once the concept of a confidence interval was articulated—providing a range of plausible values for a population parameter—it became natural to ask how to control the width of that interval. The half-width of the confidence interval, commonly called the margin of error, depends on sample size, variability, and the chosen confidence level. Algebraically rearranging the margin-of-error formula to solve for n yields a planning tool that researchers in every empirical discipline rely on today.

1733
De Moivre's Normal Approximation
Abraham de Moivre derived the normal curve as an approximation to the binomial distribution, laying the groundwork for understanding how sample proportions distribute around a true proportion.
1908
Gosset's t-Distribution
William Sealy Gosset, publishing as 'Student,' introduced the t-distribution to handle inference with small samples, highlighting how sample size affects the precision and reliability of estimates.
1934
Neyman's Confidence Intervals
Jerzy Neyman formalized the frequentist confidence interval framework, providing the mathematical structure from which sample size formulas for a desired margin of error are directly derived.
1960s
Sample Size Planning in Clinical Trials
Regulatory agencies began requiring pre-study sample size justifications for pharmaceutical trials, institutionalizing the practice of selecting n for a target precision or power.
2000s
Software & Online Calculators
Widespread access to statistical software (G*Power, R, online margin-of-error calculators) made sample size planning routine for students, pollsters, and practitioners across every field.

The central question this lesson addresses is deceptively simple: given a desired margin of error E and a chosen confidence level, what is the minimum sample size n required? Answering it demands understanding the interplay among confidence, variability, and precision—concepts that sit at the heart of statistical estimation.

Core Principles & Definitions

Before diving into formulas, it is essential to understand the four quantities that interact whenever we plan a study for a desired level of precision. Each one can be thought of as a lever: adjusting any single lever changes the sample size requirement. Mastering these relationships gives you genuine control over the design of surveys, experiments, and observational studies.

1

Margin of Error (E)

The maximum acceptable distance between the sample estimate and the true population parameter. A smaller margin of error demands a larger sample. In polling, a ±3% margin is common.
2

Confidence Level (1 − α)

The probability that the confidence interval actually captures the true parameter. Common choices are 90%, 95%, and 99%. Higher confidence requires a larger critical value z* and thus a larger n.
3

Population Variability (σ or p̂)

Greater variability in the population means more data are needed to pin down the parameter. For means, this is captured by σ (or its estimate s); for proportions, by p̂(1 − p̂).
4

Sample Size (n)

The number of independent observations to collect. It is the quantity we solve for. Because n appears under a square root in the margin-of-error formula, halving E requires roughly quadrupling n.

Two additional principles deserve emphasis. First, sample size formulas assume simple random sampling; if you use stratified, cluster, or systematic designs, adjustment factors (design effects) apply. Second, we typically round the computed n up to the next whole number because collecting a fraction of an observation is impossible, and rounding down would exceed the target margin of error.

KEY TAKEAWAY
Think of precision like the zoom on a camera. The margin of error is the resolution you want—sharp enough to read a license plate, or just clear enough to identify the car? The confidence level is how sure you want to be that the picture isn't blurry. More zoom (smaller E) and higher certainty (higher confidence) both require more light—that is, a larger sample size. Population variability is the ambient noise: the more noise, the more light you need to get a clear image.

Visualizing the Margin-of-Error Relationship

The diagram below illustrates the anatomy of a confidence interval and shows exactly where the margin of error sits. Understanding this geometry makes the algebra of sample size selection feel intuitive rather than arbitrary.

The shaded region represents the confidence interval, bounded by x̄ − E and x̄ + E. The margin of error E is the half-width of this interval. The bell curve represents the sampling distribution of x̄, whose spread depends on σ and n.

Notice the critical insight encoded in the diagram: the margin of error E equals z* × (σ / √n). Because n sits under a square root, the relationship between sample size and precision is not linear. Doubling the sample size does not halve the margin of error; it reduces it by a factor of √2 ≈ 1.414. To truly halve E, you must quadruple n. This square-root law is one of the most important practical facts in statistics—it explains why polling firms do not simply double their samples when they want twice the precision, and why diminishing returns set in as sample sizes grow large.

Mathematical Framework

We derive the sample size formulas by starting from the margin-of-error expression and solving for n. Two cases arise depending on whether the parameter of interest is a population mean or a population proportion.

Case 1: Estimating a Population Mean (μ)

When estimating a population mean with known (or well-estimated) standard deviation σ, the margin of error at confidence level (1 − α) is:

MARGIN OF ERROR FOR A MEAN
E = z* · (σ / √n)
where E = margin of error, z* = critical value from the standard normal distribution (e.g., 1.96 for 95% confidence), σ = population standard deviation, and n = sample size.

To find the sample size needed for a specified margin of error, solve for n by squaring both sides after isolating √n:

SAMPLE SIZE FOR A MEAN
n = (z* · σ / E)²
Always round up to the next integer. The formula requires σ to be known or estimated from prior data, a pilot study, or the range rule (σ ≈ range / 4).

Case 2: Estimating a Population Proportion (p)

When estimating a population proportion, the standard error involves p̂(1 − p̂) rather than σ. The margin of error is:

MARGIN OF ERROR FOR A PROPORTION
E = z* · √(p̂(1 − p̂) / n)
where is an estimated or planning value for the population proportion.

Solving for n:

SAMPLE SIZE FOR A PROPORTION
n = p̂(1 − p̂) · (z* / E)²
If no prior estimate of p is available, use p̂ = 0.5. This maximizes p̂(1 − p̂) = 0.25, producing the most conservative (largest) sample size.
💡 Why p̂ = 0.5 Is Conservative
The product p̂(1 − p̂) is maximized when p̂ = 0.5, yielding 0.25. For any other proportion—say 0.3 × 0.7 = 0.21 or 0.1 × 0.9 = 0.09—the product is smaller, meaning fewer subjects are needed. Using 0.5 guarantees the sample is large enough regardless of the true proportion.

The Trade-Off Triangle: Confidence, Precision, and Cost

In practice, selecting a sample size is not purely a mathematical exercise; it involves balancing competing priorities. A researcher might want 99% confidence with a ±1% margin of error, but the resulting sample size could be financially or logistically infeasible. The diagram below maps out how the three key inputs—confidence level, margin of error, and variability—jointly determine n, and how adjusting each one creates trade-offs.

Each curve plots the required sample size n = (z* · σ / E)² for σ = 15 at three confidence levels. Note the steep rise as E decreases below 2, illustrating the diminishing-returns relationship driven by the square root.

The graph reveals several practical insights. First, the curves are hyperbolic: required sample size explodes as the margin of error shrinks toward zero. Second, the vertical distance between the curves shows the cost of increasing confidence. Moving from 95% to 99% confidence at E = 2 increases n by roughly 70%. Third, for large margins of error (say E ≥ 5), all three curves converge, meaning the confidence level matters less when you are willing to accept coarse precision.

Required sample sizes for estimating a mean with σ = 15 at various confidence levels and margins of error.
Confidence Levelz* Valuen for E = 2, σ = 15n for E = 3, σ = 15
90%1.64515368
95%1.96021797
99%2.576374166

Worked Examples

Example 1: Sample Size for a Mean

A university dining services director wants to estimate the average amount students spend per week on meals. From a previous survey, the standard deviation is estimated at σ = $12. She wants 95% confidence with a margin of error of no more than $2. How many students should she survey?

Determining n for a Population Mean
1
Step 1 — Identify the Given ValuesConfidence level = 95%, so z* = 1.960. Population standard deviation σ = 12. Desired margin of error E = 2.
2
Step 2 — Write the Sample Size Formulan = (z* × σ / E)²
3
Step 3 — Substitute Valuesn = (1.960 × 12 / 2)² = (1.960 × 6)² = (11.76)²
4
Step 4 — Computen = 138.2976
5
Step 5 — Round UpSince we cannot survey a fraction of a student, round up to the next whole number.
n = 139 students

Example 2: Sample Size for a Proportion

A political pollster wants to estimate the proportion of registered voters who favor a ballot measure. No prior estimate of p is available. The pollster requires 95% confidence and a margin of error of ±3 percentage points (E = 0.03). What sample size is needed?

Determining n for a Population Proportion
1
Step 1 — Identify the Given ValuesConfidence level = 95%, so z* = 1.960. No prior estimate, so use the conservative p̂ = 0.5. Desired margin of error E = 0.03.
2
Step 2 — Write the Sample Size Formulan = p̂(1 − p̂) × (z* / E)²
3
Step 3 — Substitute Valuesn = 0.5 × 0.5 × (1.960 / 0.03)² = 0.25 × (65.333…)²
4
Step 4 — Computen = 0.25 × 4268.44 = 1067.11
5
Step 5 — Round UpRound up to ensure the margin of error is not exceeded.
n = 1,068 voters

Practical Considerations & Limitations

The sample size formulas derived above are elegant but rest on assumptions that rarely hold perfectly in practice. Understanding these limitations prevents the naïve application of formulas and leads to more robust study designs.

Key practical considerations when selecting a sample size.
ConsiderationImpact on Sample SizePractical Advice
Unknown σIf σ is underestimated, the actual margin of error will exceed E. If overestimated, you collect more data than needed.Use pilot studies, published data, or the range rule (σ ≈ range / 4) for a rough estimate. Err on the high side.
Non-response biasNon-responders may differ systematically from responders, introducing bias that no sample size can fix.Inflate the planned n to account for anticipated non-response rate. If 30% non-response is expected, plan n / 0.70.
Finite populationWhen n is a substantial fraction of the population N, the standard formula overestimates the required sample size.Apply the finite population correction: n_adj = n₀ / (1 + (n₀ − 1) / N), where n₀ is the uncorrected size.
Complex sampling designsCluster sampling inflates variance; stratified sampling may reduce it. The simple formula does not account for these.Multiply n by the design effect (DEFF), often estimated from prior studies or set conservatively at 1.5–2.0 for cluster designs.
Budget and feasibilityThe mathematically ideal n may exceed available resources, forcing compromises on E or confidence level.Calculate n for multiple E values and confidence levels; present decision-makers with a cost–precision table.
KEY TAKEAWAY
The sample size formula gives you a minimum theoretical floor, not a final answer. Real-world study design requires layering practical adjustments—for non-response, design effects, and budget constraints—on top of that mathematical foundation. Think of the formula as the engine specification for a car: it tells you the required horsepower, but you still need to account for road conditions, fuel availability, and passenger load before you set out.

Connection to Power Analysis & Advanced Methods

Selecting sample size for a desired margin of error is one side of a coin; the other side is power analysis, which determines the sample size needed to detect a specified effect with a given probability when performing a hypothesis test. Although the two approaches answer different questions—precision of estimation versus detection of an effect—they share the same underlying mechanics: both depend on z* (or t*), variability, and the researcher's tolerance for error. Many advanced courses and real-world grant applications require both calculations, ensuring that a study is adequately sized for both estimation and inference.

Comparison of the margin-of-error sample size approach with power analysis.
FeatureMargin-of-Error ApproachPower Analysis Approach
GoalAchieve a confidence interval of desired widthDetect a specified effect size with probability 1 − β
Key inputsE, z*, σ (or p̂)Effect size, α, β, σ
Error controlledMargin of error (precision)Type II error (failing to detect a real effect)
Typical useSurveys, polling, descriptive studiesExperiments, clinical trials, A/B tests
Formula complexityClosed-form, straightforward algebraMay require iterative or software-based computation

Beyond power analysis, advanced methods extend the basic framework in several directions. Bayesian sample size determination replaces the frequentist margin of error with criteria based on posterior distributions, such as requiring the 95% credible interval to be narrower than a specified width. Sequential analysis allows researchers to analyze data as it arrives and stop sampling once sufficient precision is reached, potentially reducing the total sample size. Adaptive designs in clinical trials re-estimate variability at interim stages and adjust n accordingly. Each of these approaches builds on the foundational logic you have learned in this lesson—namely, that precision, confidence, variability, and sample size are inextricably linked.

Practice Problems

PROBLEM 1CONCEPTUAL
Explain, without performing any calculations, why quadrupling the sample size only halves the margin of error. What mathematical property of the sample size formula is responsible for this diminishing-returns behavior?
PROBLEM 2BASIC CALCULATION
A researcher wants to estimate the mean commute time in a city. From prior data, σ = 8 minutes. She requires 95% confidence and a margin of error of no more than 1.5 minutes. What is the minimum sample size?
PROBLEM 3INTERMEDIATE
A market research firm estimates that about 40% of consumers prefer Brand A. They want a 99% confidence interval with a margin of error of ±4 percentage points. (a) Compute the required sample size using p̂ = 0.40. (b) How much larger would n be if they used the conservative p̂ = 0.50?
PROBLEM 4APPLIED
A hospital administrator wants to estimate the average length of stay for knee-replacement patients. Past records suggest σ ≈ 2.4 days. She wants 95% confidence with E = 0.5 days. However, only N = 300 patients undergo the procedure each year. (a) Compute the unadjusted sample size n₀. (b) Apply the finite population correction to find the adjusted sample size.
PROBLEM 5CRITICAL THINKING
A survey designer must choose between two designs. Design A uses 95% confidence and E = 3 percentage points with no prior estimate of p. Design B uses 90% confidence and E = 2 percentage points with a prior estimate of p̂ = 0.70. (a) Compute n for each design. (b) Discuss which design you would recommend if the survey budget can support at most 1,200 respondents, and explain the trade-offs involved.

Lesson Summary

Selecting the right sample size is a fundamental step in study design that balances precision, confidence, and practical constraints. For estimating a population mean, the formula n = (z* × σ / E)² determines the minimum number of observations needed to achieve a margin of error of E at a given confidence level. For a population proportion, the formula becomes n = p̂(1 − p̂) × (z* / E)², with the conservative choice p̂ = 0.5 guaranteeing the sample is large enough regardless of the true proportion.

Key insights include the square-root relationship between n and E—halving the margin of error requires quadrupling the sample—and the importance of practical adjustments for non-response, finite populations, and complex sampling designs. The margin-of-error approach complements power analysis, which addresses sample size for hypothesis testing. Together, these tools ensure that empirical studies are neither wastefully large nor dangerously underpowered, and that the resulting estimates carry the precision researchers and decision-makers require.

Varsity Tutors • College Statistics • Sample Size Selection — Selecting Sample Size for a Desired Margin of Error