Tutorials › AP Statistics › Finding the Sample Size for a Desired Margin of Error

One-sample t confidence intervals · Tutorial 634 of 1000

Finding the Sample Size for a Desired Margin of Error

Use the target margin of error, confidence level, and a planning value for the population standard deviation to calculate the minimum whole-number sample size.

Intermediate 9 min read

What You'll Learn

  • Rearrange the planning formula to solve for the sample size needed for a specified margin of error.
  • Select the z critical value for a two-sided confidence level.
  • Round a calculated sample size up and check that the target margin of error is met.
  • Distinguish the planning value of the population standard deviation from the sample standard deviation used after data collection.
  • Explain how confidence level, variability, and desired precision affect the required sample size.
  • Check sampling and t-procedure conditions at the planned sample size.

Planning a Sample Size Before Collecting Data

In “Margin of Error for a Mean Explained,” we saw that a one-sample t interval’s margin of error depends on a critical value and the estimated standard error. But when planning a study, the sample has not yet been collected, so its sample standard deviation \(s\) and the t critical value \(t^*\) are not yet available. A useful planning formula instead uses a chosen z critical value and a planning estimate of the population standard deviation, \(\sigma\).

The goal is to choose a sample size large enough that the planned margin of error is no greater than a desired amount. The formula gives a starting point for planning a one-sample confidence interval for a population mean. It does not guarantee that the interval calculated from the eventual sample will have exactly that margin of error: the actual sample standard deviation may differ from the planning value.

Formula: For a two-sided confidence level with z critical value \(z^*\), a planning value \(\sigma\), and desired margin of error \(ME\), calculate the required sample size using:
$$ n=\left(\frac{z^*\sigma}{ME}\right)^2 $$

Here, \(ME\) is the maximum margin of error the plan is intended to achieve, and \(z^*\) is a positive critical value for the selected confidence level. The result is generally not a whole number. Always round up to the next whole number, because a sample cannot contain a fraction of an observation and rounding down could fail to meet the target.

This equation comes from setting the planned margin of error equal to \(z^*(\sigma/\sqrt{n})\) and solving for \(n\). A larger confidence level uses a larger \(z^*\); a larger planning value of \(\sigma\) means more variability; and a smaller desired margin of error demands more precision. Each of these changes can increase the required sample size.

Important distinction: Use a planning value of \(\sigma\) in this formula, not a sample standard deviation \(s\) from data that have not yet been collected. The formula uses \(z^*\) as a planning approximation. After collecting data for a one-sample t interval, use the t procedure with the observed \(s\), the sample size, and the appropriate \(t^*\), as described in “The Form of a One-Sample t Interval.”

A Planning Workflow

Before calculating, identify the confidence level, the desired margin of error in the response variable’s units, and a reasonable planning value for \(\sigma\). That value might come from earlier comparable data or other relevant information supplied in a problem. It is an estimate for planning, not a claim that the eventual sample will have exactly that standard deviation.

1
State the goal.
Name the population mean to be estimated, the confidence level, and the desired margin of error, including its units.
2
Choose the planning inputs.
Find the two-sided z critical value for the confidence level and record the planning value of \(\sigma\).
3
Calculate and round up.
Substitute into \(n=(z^*\sigma/ME)^2\). Round the result up to the next whole number.
4
Check the plan.
Verify that the rounded-up size meets the target and consider whether the proposed sampling method and one-sample t procedure are appropriate.

Because \(z^*\) is unitless, \(\sigma/ME\) is a ratio of the same response-variable units, and the resulting \(n\) is a count with no measurement units. Do not convert the calculated sample size into the number of measurements per group unless the study design specifically calls for groups; this formula plans a sample for one population mean.

Worked Examples

Worked Example: Planning a Survey of Library Wait Times

A fictional library plans to estimate the mean wait time for visitors seeking assistance. Comparable past records suggest a planning value of \(\sigma=12\) minutes. The library wants a 95% confidence level and a margin of error no greater than 3 minutes. It plans to select a random sample from a population of more than 1,000 visits. Find the minimum sample size.

State. The parameter is \(\mu\), the true mean wait time for the population of visits being studied. The goal is a planned margin of error of at most 3 minutes at 95% confidence.

Plan. For a two-sided 95% confidence level, use \(z^*=1.96\). The planning standard deviation is 12 minutes, and the target \(ME\) is 3 minutes. The study should use a random sample. At the proposed size, check the 10% condition for sampling without replacement; also consider whether the population distribution or sample size supports a t interval after data collection.

Do. Substitute the planning values:

$$ n=\left(\frac{1.96(12)}{3}\right)^2 =\left(\frac{23.52}{3}\right)^2 =(7.84)^2 =61.4656 $$

Round up to \(n=62\) visits. Check the rounding by testing the target at 62: the planned margin of error is \(1.96(12/\sqrt{62})\), or about \(2.987\) minutes, which is no greater than 3 minutes. At 61 visits it would be \(1.96(12/\sqrt{61})\), or about \(3.011\) minutes, so 61 would not meet the target. The planned sample is less than 10% of a population larger than 1,000, since \(62<0.10(1000)=100\); the 10% condition is met.

Conclude. The library should plan to randomly sample at least 62 visits to target a margin of error no greater than 3 minutes at 95% confidence, using 12 minutes as its planning value for \(\sigma\). This is a planning result, not a guarantee that an interval based on the collected data will have a margin of error of at most 3 minutes.

Worked Example: Choosing a Sample Size for Package Weights

A fictional packing team wants to estimate the mean weight of filled packages. Based on comparable production information, the team uses \(\sigma=4.5\) grams as a planning value. It wants 90% confidence and a margin of error no greater than 1 gram. How many packages should it randomly sample from a lot of 800?

State. The parameter is \(\mu\), the true mean package weight in this lot. The target margin of error is 1 gram at 90% confidence.

Plan. Use \(z^*=1.645\) for a two-sided 90% confidence level, and use the planning value \(\sigma=4.5\) grams. The data should come from a random sample. After calculating \(n\), check the 10% condition against the lot size of 800. The shape of the data or a sufficiently large sample should also support using a one-sample t interval after collection.

Do. Calculate the unrounded requirement:

$$ n=\left(\frac{1.645(4.5)}{1}\right)^2 =(7.4025)^2 =54.79700625 $$

Rounding up gives \(n=55\) packages. At 55, the planned margin of error is \(7.4025/\sqrt{55}\), or about \(0.998\) gram, which meets the target. If the team sampled only 54 packages, the planned margin of error would be \(7.4025/\sqrt{54}\), or about \(1.007\) grams, which is too large. For the proposed size, \(55<0.10(800)=80\), so the 10% condition is met.

Conclude. The team should randomly sample at least 55 packages to target a margin of error no greater than 1 gram at 90% confidence, based on its planning value of 4.5 grams.

Worked Example: Planning for High Confidence and a Tight Margin

A fictional environmental group wants to estimate the mean time, in seconds, that a sensor takes to register a change in air quality. It uses a planning value of \(\sigma=18\) seconds and wants 99% confidence with a margin of error no greater than 4 seconds. Find the required sample size and explain why rounding down is not acceptable.

State. The parameter is \(\mu\), the true mean sensor response time for the population of sensors under study. The goal is a margin of error of at most 4 seconds at 99% confidence.

Plan. The two-sided 99% critical value is \(z^*=2.576\). Use the supplied planning value of 18 seconds and the target \(ME=4\) seconds. Suppose the group will randomly sample without replacement from a population of 2,000 sensors. After finding the sample size, check the 10% condition and consider whether the eventual data will support a t interval.

Do. Substitute and calculate:

$$ n=\left(\frac{2.576(18)}{4}\right)^2 =\left(\frac{46.368}{4}\right)^2 =(11.592)^2 =134.374464 $$

Round up to \(n=135\). With 135 sensors, the planned margin of error is \(46.368/\sqrt{135}\), or about \(3.991\) seconds. With 134 sensors, it is \(46.368/\sqrt{134}\), or about \(4.006\) seconds. Thus, rounding down would miss the requested target. The 10% condition is met because \(135<0.10(2000)=200\).

Conclude. The group should plan to randomly sample at least 135 sensors. The larger sample requirement reflects both the high confidence level and the relatively small margin of error compared with the planning variability.

What Changes the Required Sample Size?

The formula makes the trade-offs precise. The required sample size is proportional to the square of \(z^*\), the square of the planning value \(\sigma\), and the inverse square of the target margin of error. This means that changing a target can have a larger effect than its simple percentage change suggests.

  • Higher confidence: A higher confidence level has a larger \(z^*\), so the calculated sample size increases if \(\sigma\) and \(ME\) stay fixed.
  • More planning variability: A larger \(\sigma\) increases the required sample size. If \(\sigma\) doubles while other inputs stay fixed, the unrounded sample-size calculation is multiplied by \(2^2=4\).
  • Smaller margin of error: A smaller target requires more observations. If the desired margin of error is halved, the calculated sample size is multiplied by \(1/(1/2)^2=4\).

For example, if the confidence level and \(\sigma\) remain fixed, moving from a 2-unit margin of error to a 1-unit margin requires four times the unrounded sample size. The final whole-number sample sizes may not be exactly four times one another because each must be rounded up.

Common Mistakes and AP Exam Tips

  • Rounding to the nearest whole number. Round up, even if the decimal part is small. Rounding down can produce a sample too small to meet the target, as the package and sensor examples show.
  • Using \(ME\) as the full interval width. The formula uses the distance from the center to one endpoint. If a problem gives a desired full width, divide it by 2 to get the margin of error before using the formula.
  • Using \(s\) from a future sample. Before collecting data, \(s\) is not known. Use the planning value of \(\sigma\) supplied or justified for the calculation, and explain that it is an estimate for planning.
  • Using \(t^*\) in this planning formula. This formula uses \(z^*\) as a planning approximation. The actual one-sample t interval uses \(t^*\) and the observed \(s\) after data collection.
  • Choosing the wrong z critical value. For a central, two-sided confidence level, use its positive z critical value. Do not use the confidence level itself as \(z^*\).
  • Claiming the achieved margin is guaranteed. The calculation targets a margin of error based on the planned \(\sigma\). The actual margin of error can differ if the sample’s \(s\) differs from that planning value.
  • Skipping design checks. A calculated sample size does not make a biased sampling method representative. Check random sampling and, for sampling without replacement from a finite population, the 10% condition. Consider whether the eventual data will support a t procedure.

A strong written response states the confidence level, planning value of \(\sigma\), desired margin of error, substituted formula, unrounded result, and rounded-up sample size. It then connects the result to the population mean and checks relevant sampling conditions. Do not describe the result as the exact number needed to guarantee a particular realized interval width.

Key takeaway: To plan a sample size for a mean, use \(n=(z^*\sigma/ME)^2\) with a two-sided confidence-level critical value and a planning value for \(\sigma\). Round up to the next whole number, then check whether the sampling plan and eventual t procedure are appropriate.

Check Your Understanding

For each question, show the sample-size calculation and explain the rounding or planning decision.

  1. A study uses \(z^*=1.96\), a planning value of \(\sigma=10\) kilograms, and a desired margin of error of 2 kilograms. Calculate the required whole-number sample size.
  2. Why should a calculated sample size of 48.02 be rounded up rather than rounded to 48?
  3. If the desired margin of error is cut in half while confidence level and planning \(\sigma\) stay fixed, by what factor does the unrounded required sample size change?
  4. Explain why a sample-size plan using a planning value of \(\sigma\) does not guarantee that the eventual one-sample t interval will have exactly the target margin of error.
  5. A team plans to randomly sample 70 items without replacement from a lot of 600. Check the 10% condition.