Tutorials › Introduction to Statistics › Planning Sample Size for a Desired Margin of Error

Confidence Intervals for Proportions · Tutorial 566 of 996

Planning Sample Size for a Desired Margin of Error

Use the anticipated proportion, chosen confidence level, and desired margin of error to plan a sample size for a proportion interval.

Intermediate 10 min read

What You'll Learn

  • Derive the approximate sample-size formula from the margin of error for a one-proportion z interval
  • Identify the inputs needed: confidence level, target margin of error, and anticipated population proportion
  • Calculate a planned sample size and choose an integer that meets the target
  • Check whether the anticipated success and failure counts support the normal approximation
  • Explain why the planned precision depends on whether the anticipated proportion is close to the population proportion

Why Plan a Sample Size?

Before collecting data, a researcher often needs to decide how many people or items to sample. A sample that is too small may produce a proportion interval too wide to be useful. A larger sample generally gives a narrower interval, but collecting more observations costs time and resources. Sample-size planning connects a desired level of precision to a practical sampling target.

For a binary outcome, such as whether a respondent supports a proposal, the parameter of interest is the population proportion \(p\). A sample proportion \(\hat{p}\) estimates it. The margin of error describes the interval’s half-width. This tutorial derives a planning formula for the approximate margin of error of a one-proportion z interval, using an anticipated value for \(p\).

The Planning Model and Its Assumptions

For a chosen confidence level, let \(z^*\) be the corresponding positive standard normal critical value. For example, the commonly used values are about 1.645 for 90% confidence, 1.96 for 95%, and 2.576 for 99%. The interval’s approximate margin of error depends on the standard error of \(\hat{p}\), which in the z interval is estimated using the sample proportion. For planning before data are collected, we substitute an anticipated proportion, written here as \(p_0\).

Definition: For a target margin of error \(m\), confidence critical value \(z^*\), and anticipated population proportion \(p_0\), the approximate planned sample size for a one-proportion z interval is
$$ n=\frac{(z^*)^2p_0(1-p_0)}{m^2}. $$
The result is a planning value: it is based on the anticipated proportion and the normal approximation, not a guarantee that the interval from the eventual data will have exactly that margin of error.

This formula is appropriate when the outcome is binary, the sampling plan produces a representative random sample, and observations are independent or close enough to independent for the standard error formula to apply. For sampling without replacement, a common check is that the population is at least 10 times the planned sample size. The normal approximation also needs enough anticipated successes and failures: check that \(np_0\) and \(n(1-p_0)\) are each at least 10. These conditions support the approximation; they do not correct a biased sample.

The anticipated proportion \(p_0\) must be between 0 and 1. It should be a defensible planning value based on relevant information available before the main sample is collected. A planned sample size can be sensitive to this input: if the actual population proportion differs substantially from \(p_0\), the actual interval’s standard error and margin of error may differ from the planned values.

Why the Formula Has This Form

The one-proportion z interval has the form sample proportion plus or minus a critical value times an estimated standard error. For planning, substitute \(p_0\) for the proportion in that standard error. The resulting approximate margin of error is \(z^*\sqrt{p_0(1-p_0)/n}\). To meet a target margin \(m\), set this expression equal to \(m\) and solve for the sample size.

1
Set the planned margin equal to the target.
\(m=z^*\sqrt{p_0(1-p_0)/n}\).
2
Square both sides.
Because the quantities are nonnegative, squaring gives \(m^2=(z^*)^2p_0(1-p_0)/n\).
3
Rearrange for \(n\).
Multiplying by \(n\) and dividing by \(m^2\) gives \(n=(z^*)^2p_0(1-p_0)/m^2\).

The target \(m\) is a half-width, not the total width of the interval. If a report requires an interval no wider than 8 percentage points, the corresponding target margin of error is 4 percentage points, or \(m=0.04\) when proportions are represented on a 0-to-1 scale.

Applying the Formula

Worked Example: Planning a 95% Interval for Support

Suppose a hypothetical survey team expects 40% of eligible residents to support a proposal. It wants an approximate 95% confidence interval with a margin of error no larger than 4 percentage points. What sample size should it plan?

The outcome is binary (supports or does not support), and the planning inputs are \(p_0=0.40\), \(m=0.04\), and \(z^*=1.96\). The plan also assumes a representative random sample and sufficiently independent observations. Using the formula,

$$ n=\frac{(1.96)^2(0.40)(1-0.40)}{(0.04)^2} =\frac{3.8416(0.24)}{0.0016} =\frac{0.921984}{0.0016} =576.24. $$

A sample cannot contain a fraction of a person, so the team plans for at least 577 completed responses rather than rounding down. At this planned size, the anticipated success and failure counts are \(577(0.40)=230.8\) and \(577(0.60)=346.2\), both well above 10. The normal-approximation count condition is therefore satisfied under the planning value. The team should still design the survey to obtain a representative sample and address possible nonresponse.

Under these assumptions and the anticipated proportion, 577 is the planned sample size for an approximate 95% margin of error of 4 percentage points. This is not a claim that every resulting interval will have exactly that margin: the observed \(\hat{p}\) may differ from 0.40.

Worked Example: A Different Confidence Level and Target

A hypothetical organization expects 12% of its members to use a particular service. It wants a 90% interval with a margin of error of 3 percentage points. Find the planned sample size.

Here \(p_0=0.12\), \(m=0.03\), and the 90% critical value is \(z^*=1.645\). Assuming a representative random sample and independent observations, substitute these values:

$$ n=\frac{(1.645)^2(0.12)(0.88)}{(0.03)^2} =\frac{2.706025(0.1056)}{0.0009} =\frac{0.28575624}{0.0009} \approx317.51. $$

The planned sample size is at least 318 members. The anticipated counts are \(318(0.12)=38.16\) service users and \(318(0.88)=279.84\) nonusers, each at least 10. Thus the success-failure check is met for this planning value. The result is an approximate plan for 90% confidence and a 3-percentage-point margin, conditional on the stated assumptions and anticipation.

Worked Example: Planning for a Higher Confidence Level

In a hypothetical poll, the planning proportion is 0.65. The poll designers want a 99% confidence interval with a margin of error of 2.5 percentage points. How large a sample should they plan?

Use \(p_0=0.65\), \(m=0.025\), and \(z^*=2.576\). Assume the poll can obtain a representative random sample with independent observations.

$$ n=\frac{(2.576)^2(0.65)(0.35)}{(0.025)^2} =\frac{6.635776(0.2275)}{0.000625} =\frac{1.50963904}{0.000625} \approx2415.42. $$

The planned sample size is at least 2,416 respondents. At that size, the anticipated counts are \(2416(0.65)=1570.4\) and \(2416(0.35)=845.6\), both comfortably above 10. Under the model and anticipated proportion, the plan targets an approximate margin of error of 2.5 percentage points at 99% confidence. A higher confidence level uses a larger \(z^*\), which increases the required sample size when the other inputs stay fixed.

How the Inputs Affect Sample Size

The formula makes the trade-offs explicit. Holding \(p_0\) and the confidence level fixed, the required sample size is proportional to \(1/m^2\). For example, halving the target margin multiplies the required sample size by four, since \(1/(m/2)^2=4/m^2\). Greater precision can therefore require a substantial increase in data collection.

For a fixed anticipated proportion and target margin, a higher confidence level requires a larger critical value \(z^*\), and the formula squares that value. Thus increasing the confidence level also increases the required sample size. These relationships are useful during study planning: if the calculated sample is not feasible, the researcher must reconsider the desired precision, confidence level, resources, or design rather than treating the formula as a way to remove the trade-off.

The product \(p_0(1-p_0)\) represents the anticipated variability of the binary outcome. A planning value near 0 or 1 implies less anticipated variability than a value near the middle of the scale. The formula therefore uses the anticipated proportion directly; it does not say that a sample of the calculated size will have the target precision for every possible population proportion.

Common Mistake

Common mistake: A researcher calculates \(n=240.2\) and rounds to 240, reasoning that 240 is close enough. But the target condition is \(n\geq 240.2\); using 240 falls below the value required by the calculation. Since sample size is a count, use an integer at least as large as the result. Another mistake is to report the target as “4%” without clarifying the scale: for a proportion interval, \(m=0.04\) means 4 percentage points, not a 4% relative change in the anticipated proportion.

A further limitation is interpreting the plan as a guarantee. The calculation uses \(p_0\) to anticipate the standard error, while the interval calculated from the eventual sample uses the observed data. If the actual proportion differs from the planning value, the realized margin of error can differ as well. The sample-size result is a transparent design target under stated assumptions, not a promise about every possible sample.

Check Your Understanding

Use the formula and reasoning in this tutorial to answer the following questions.

  1. In the planning formula, what does \(m\) represent, and how is it different from the full width of an interval?
  2. A planner uses \(p_0=0.30\), a 95% confidence level, and \(m=0.05\). Write the expression that would be evaluated to obtain the planned sample size.
  3. Why does halving the target margin of error, with all other inputs fixed, require four times the sample size according to the formula?
  4. For a planned sample of 500 and anticipated proportion \(p_0=0.08\), calculate the anticipated success and failure counts. Does each reach 10?
  5. Why should a planned sample size not be described as guaranteeing that the eventual interval will have exactly the target margin of error?