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

Confidence Intervals for Means · Tutorial 594 of 996

Planning Sample Size for a Target Margin of Error

Calculate a preliminary sample size for a one-mean interval, then check whether its \(t\)-based margin of error meets the target.

Intermediate 10 min read

What You'll Learn

  • Distinguish a target margin of error from the full interval width.
  • Use a planning estimate of spread and a chosen confidence level to find a preliminary sample size.
  • Explain why the \(t\) critical value depends on the sample size being planned.
  • Check candidate sample sizes by calculating their \(t\)-based margins of error.
  • Recognize how uncertainty in the planning estimate affects the achieved interval width.

Why Plan a Sample Size?

A confidence interval is more informative when its margin of error is small enough for the question at hand. But collecting observations takes time and resources, so it is useful to estimate the required sample size before collecting data. For a one-mean interval, the main planning inputs are the desired confidence level, a target margin of error, and a plausible estimate of the population’s spread.

The calculation is a planning tool, not a promise that the eventual interval will have exactly the target width. The actual interval uses the sample standard deviation, which will not generally equal the planning estimate. In addition, the critical value for a one-sample \(t\) interval depends on the sample size. These features make the calculation preliminary: it identifies a reasonable candidate, which must then be checked using the \(t\) critical value corresponding to that candidate.

The Planning Formula

Definition: The margin of error \(E\) is the distance from the center of a two-sided confidence interval to either endpoint; the full interval width is \(2E\). For a one-mean \(t\) interval with sample size \(n\), sample standard deviation \(s\), and confidence level \(C=1-\alpha\), the margin of error is \(t^*s/\sqrt{n}\), where \(t^*\) is the \(1-\alpha/2\) quantile of the \(t\) distribution with \(n-1\) degrees of freedom.

Before data are collected, \(s\) is not yet available. Instead, planning uses a value \(s_{\text{plan}}\), an estimate of the spread based on relevant prior information or subject-matter knowledge. The target \(E\) and chosen confidence level are set in the measurement’s units. For example, if the mean is measured in milligrams per liter, then both \(s_{\text{plan}}\) and \(E\) are in milligrams per liter.

A convenient starting calculation uses the standard normal critical value \(z^*\) for the chosen confidence level:

$$ n_0=\left(\frac{z^*s_{\text{plan}}}{E}\right)^2 $$

This gives a preliminary sample size. The formula comes from solving the approximate margin-of-error expression \(E\approx z^*s_{\text{plan}}/\sqrt{n}\) for \(n\). Since a sample size is a whole number, the calculation is rounded up to the next integer so the approximate target is not missed merely by rounding down.

For a one-sample \(t\) interval, the candidate size should also be checked against

$$ E_{\text{plan}}(n)=t^*_{1-\alpha/2,\ n-1}\frac{s_{\text{plan}}}{\sqrt{n}}. $$

Here the subscript \(n-1\) is essential: changing the proposed \(n\) changes the degrees of freedom and therefore the \(t\) critical value. A candidate meets the planning target when \(E_{\text{plan}}(n)\le E\). If not, increase the candidate and check again.

Why the Normal Approximation Is a Starting Point

The preliminary formula is easy to calculate because \(z^*\) depends on the confidence level but not on \(n\). The exact \(t\)-based planning condition is instead an inequality involving \(n\) on both sides: \(t^*_{1-\alpha/2,\ n-1}s_{\text{plan}}/\sqrt{n}\le E\). There is generally no simple algebraic rearrangement that directly gives the exact integer sample size, because the critical value itself changes with \(n\).

The \(t\) critical value is typically larger than the corresponding \(z\) critical value at finite degrees of freedom. As the degrees of freedom increase, the \(t\) critical value approaches the normal critical value. Thus the preliminary calculation is often close, especially for larger samples, but it does not replace checking the candidate. The following derivation explains the starting formula.

Derivation: If the critical value and spread were fixed, a margin of error \(E\) would satisfy \(E=k s_{\text{plan}}/\sqrt{n}\), where \(k\) is the chosen multiplier. Multiplying both sides by \(\sqrt{n}\) and dividing by \(E\) gives \(\sqrt{n}=k s_{\text{plan}}/E\). Squaring both sides gives \(n=(k s_{\text{plan}}/E)^2\). Taking \(k=z^*\) gives the preliminary formula; taking \(k=t^*_{1-\alpha/2,\ n-1}\) leaves \(n\) inside the critical value, so the result must be checked iteratively.

Worked Sample-Size Calculations

Worked Example: A 95% Interval With a Three-Unit Target

Suppose a future random sample will measure a continuous outcome in units. Prior information suggests using \(s_{\text{plan}}=12\) units. The goal is a 95% confidence interval with margin of error no greater than \(E=3\) units. Find a preliminary size and check it using the \(t\) critical value.

For 95% confidence, \(z^*\approx1.960\). The preliminary calculation is

$$ n_0=\left(\frac{1.960(12)}{3}\right)^2 =\left(7.840\right)^2 =61.4656. $$

Rounding up gives \(n=62\) as the preliminary candidate. Now check nearby integer sizes with the \(t\) critical value. For \(n=63\), the degrees of freedom are \(62\), and \(t^*_{0.975,62}\approx1.9990\). Its planned margin is

$$ E_{\text{plan}}(63) =\frac{1.9990(12)}{\sqrt{63}} =\frac{23.988}{7.9373} \approx3.022\text{ units}. $$

That exceeds the 3-unit target. For \(n=64\), \(df=63\) and \(t^*_{0.975,63}\approx1.9983\), so

$$ E_{\text{plan}}(64) =\frac{1.9983(12)}{\sqrt{64}} =\frac{23.9796}{8} \approx2.997\text{ units}. $$

This candidate meets the target. Since the planned margin decreases as \(n\) increases—the denominator grows and the \(t\) critical value does not increase—failure at \(n=63\) also rules out every smaller size. Thus \(n=64\) is the smallest size meeting this planned \(t\)-based target, given the stated planning spread and confidence level.

Worked Example: A 90% Interval for a Concentration

Imagine planning to estimate a mean concentration in milligrams per liter. Use a planning spread of \(8\) mg/L, a target margin of error of \(2\) mg/L, and 90% confidence. Find the preliminary size, then check the candidate using a \(t\) critical value.

For 90% confidence, \(z^*\approx1.645\). Therefore,

$$ n_0=\left(\frac{1.645(8)}{2}\right)^2 =\left(6.580\right)^2 =43.2964. $$

The preliminary size rounded up is \(44\). Checking with \(t\) values shows why that is not yet a sufficient conclusion. At \(n=45\), \(df=44\) and \(t^*_{0.95,44}\approx1.6802\). The planned margin is

$$ E_{\text{plan}}(45) =\frac{1.6802(8)}{\sqrt{45}} =\frac{13.4416}{6.7082} \approx2.004\text{ mg/L}. $$

This is slightly above the target. At \(n=46\), \(df=45\) and \(t^*_{0.95,45}\approx1.6794\), giving

$$ E_{\text{plan}}(46) =\frac{1.6794(8)}{\sqrt{46}} =\frac{13.4352}{6.7823} \approx1.981\text{ mg/L}. $$

The 46-observation plan meets the target. Because the margin decreases as the candidate size increases, the failure at \(n=45\) shows that no smaller size can meet it. In this example the normal-based calculation gave a useful starting point, but the \(t\)-based check changed the planned size.

Worked Example: A Higher Confidence Level

Suppose a measurement is recorded in hours. A planner uses \(s_{\text{plan}}=5.5\) hours and wants a 99% interval with margin of error no greater than \(1.5\) hours. First calculate a normal-based preliminary size, then verify a candidate with the \(t\) distribution.

For 99% confidence, \(z^*\approx2.576\). The preliminary calculation is

$$ n_0=\left(\frac{2.576(5.5)}{1.5}\right)^2 =\left(9.4453\right)^2 \approx89.21. $$

Rounding up gives a preliminary candidate of \(90\). At \(n=90\), \(df=89\), and \(t^*_{0.995,89}\approx2.632\). The planned margin is

$$ E_{\text{plan}}(90) =\frac{2.632(5.5)}{\sqrt{90}} =\frac{14.476}{9.4868} \approx1.525\text{ hours}. $$

Because this is greater than \(1.5\) hours, \(n=90\) does not meet the target under the \(t\)-based check. To check a larger plan, use \(n=100\), for which \(df=99\) and \(t^*_{0.995,99}\approx2.626\):

$$ E_{\text{plan}}(100) =\frac{2.626(5.5)}{\sqrt{100}} =\frac{14.443}{10} \approx1.444\text{ hours}. $$

A plan of 100 observations meets the target. The calculation does not establish that 100 is the smallest size that would work; it establishes that this checked candidate satisfies the planning requirement. If finding the smallest qualifying size is important, continue checking integer candidates until the margin meets the target, then check the preceding size.

Conditions and Interpretation of the Plan

The sample-size calculation concerns precision, but it does not make an unsuitable sampling design suitable. The eventual one-mean \(t\) interval still relies on the usual conditions for inference about a mean: the data should come from an appropriate random sample or random process, observations should be independent (with the 10% condition when sampling without replacement from a finite population), and the population distribution should be reasonably compatible with the \(t\) procedure. For small samples, substantial skewness or outliers can make the procedure fragile; with larger samples, moderate departures from normality are generally less concerning.

Before collecting data, the distribution cannot be checked from the future sample. Planning therefore depends on what is reasonably known about the measurement and population. A selected \(s_{\text{plan}}\) is an assumption about likely spread, not a known fact. If the actual sample standard deviation is larger than this planning value, the realized interval may be wider than planned. If it is smaller, the interval may be narrower.

The confidence level also affects the planned size. Holding \(E\) and \(s_{\text{plan}}\) fixed, higher confidence requires a larger critical value and generally a larger sample. Similarly, a smaller target margin requires a larger sample: in the preliminary formula, halving \(E\) multiplies the calculated size by four. This follows because \(E\) appears squared in the denominator after solving for \(n\).

Common Mistake: Treating the Preliminary Result as Exact

A frequent error is to calculate \(n_0\), round up, and report that integer as guaranteed to achieve the desired margin for a \(t\) interval. That reasoning treats the normal critical value as if it were the exact \(t\) critical value and overlooks that the latter depends on \(n-1\). The correction is to use the normal-based result only as a starting candidate, calculate the planned margin with the corresponding \(t\) critical value, and increase \(n\) if the target is missed.

Another important distinction is between margin of error and interval width. A target \(E=2\) units means a desired full width of \(2E=4\) units, not 2 units. State the target as a margin of error and keep its units consistent with the spread estimate.

Key takeaway: For a one-mean interval, begin with \(n_0=(z^*s_{\text{plan}}/E)^2\), round the candidate upward, and check \(t^*_{1-\alpha/2,\ n-1}s_{\text{plan}}/\sqrt{n}\le E\). The resulting plan is conditional on the chosen spread estimate and does not guarantee the realized interval’s width.

Check Your Understanding

Try these questions before reviewing the worked calculations.

  1. A planner wants a 95% interval with margin of error 4 units and uses a planning spread of 10 units. Write the normal-based preliminary sample-size formula with these values. What does the target \(E=4\) imply about the desired full interval width?
  2. Why must a candidate sample size be checked using a \(t\) critical value with \(n-1\) degrees of freedom?
  3. A planned margin is 1.96 mg/L when the target is 2 mg/L. Does the candidate meet the stated precision target? Explain.
  4. If the planning spread doubles while the target margin and confidence level stay fixed, how does the preliminary sample size change? Use the formula to justify your answer.
  5. Give one reason the realized interval might be wider than the planned interval, even when the planned sample size is followed.