Tutorials › Introduction to Statistics › Calculating an Interval from Counts

Confidence Intervals for Proportions · Tutorial 558 of 996

Calculating an Interval from Counts

Use a success count and sample size to calculate and check each part of a two-sided one-proportion z interval.

Intermediate 10 min read

What You'll Learn

  • Calculate the sample proportion from a success count and sample size.
  • Find the estimated standard error for a sample proportion.
  • Select a critical value for a stated confidence level.
  • Calculate the margin of error and both interval endpoints.
  • Check the sampling, independence, and success-failure conditions before reporting an interval.

From Counts to an Interval

A poll or study often reports two basic numbers: how many observations had a particular outcome and how many observations were collected altogether. From these counts, we can estimate the population proportion with the outcome and calculate a confidence interval for it. The calculation has four parts: the sample proportion, its estimated standard error, the margin of error, and the two endpoints.

For example, if 84 of 120 randomly selected people report a particular response, the observed proportion is \(84/120\). That proportion is an estimate, not a guarantee that the same fraction holds in the whole population. The interval calculation adds and subtracts an allowance for sampling variability, using a critical value determined by the chosen confidence level.

Definition: If \(x\) of \(n\) observations are successes, the sample proportion is \(\hat{p}=x/n\). The two-sided one-proportion z interval for the population proportion \(p\) is $$ \hat{p}\ \pm\ z^* \sqrt{\frac{\hat{p}(1-\hat{p})}{n}}, $$ where \(z^*\) is the positive standard-normal critical value for the selected confidence level. The square-root term is the estimated standard error, and \(z^*\) times that standard error is the margin of error.

Here, “success” simply means the outcome being counted, not necessarily a favorable outcome. For a binary variable, each observation either has the outcome of interest or does not. The count \(x\) is the number with that outcome, and \(n-x\) is the number without it. Both counts are needed to check whether the normal approximation used by this interval is reasonable.

Model and Conditions

The calculation estimates a single population proportion from binary observations. Its usual model assumes that the observations come from a random sample or a suitable random process, and that the outcomes are independent with the same probability \(p\) of success. With independent observations, the count \(X\) has a binomial model with parameters \(n\) and \(p\), and \(\hat{p}=X/n\). When sampling without replacement from a finite population, a common practical check for approximate independence is that the sample size is no more than 10% of the population size.

The z interval also relies on a normal approximation for the sampling distribution of \(\hat{p}\). For this interval, check the success-failure condition using the observed counts: \(x\geq 10\) and \(n-x\geq 10\). If either count is too small, the normal approximation behind this interval may be unreliable; do not treat a calculated pair of endpoints as automatically suitable just because the arithmetic can be done.

These checks do not change the arithmetic once the method is appropriate. They help decide whether the method is defensible in the first place. In each example below, the sampling design and both counts are checked before calculating the interval.

Why the Formula Has This Form

The interval uses the approximate sampling behavior of a sample proportion. When the normal approximation is appropriate, the difference between \(\hat{p}\) and \(p\), divided by its standard error, is approximately standard normal. In practice \(p\) is unknown, so the standard error is estimated by substituting \(\hat{p}\) for \(p\). For the chosen confidence level, the standard-normal middle area is between \(-z^*\) and \(z^*\). Applying that bound and rearranging for \(p\) gives the interval.

$$ -z^* \leq \frac{\hat{p}-p}{\sqrt{\hat{p}(1-\hat{p})/n}} \leq z^* \quad\Longrightarrow\quad \hat{p}-z^*\sqrt{\frac{\hat{p}(1-\hat{p})}{n}} \leq p \leq \hat{p}+z^*\sqrt{\frac{\hat{p}(1-\hat{p})}{n}}. $$

Thus the endpoints are the estimate minus and plus the margin of error. The interval is centered at \(\hat{p}\), and its total width is twice the margin of error. This tutorial uses the ordinary one-proportion z interval; the formula does not guarantee sensible results in every setting, which is why checking its conditions matters.

Calculation Procedure

Use the same sequence whether the counts come from a survey, a clinical sample, or another setting. Keep extra digits through intermediate calculations, then round the reported values consistently. If a critical value is rounded from a table, regard the resulting endpoints as approximate to that precision.

1
Identify the counts and check the design.
Name the success outcome, record \(x\) and \(n\), and verify that the observations arise from an appropriate random sample or process. Consider dependence, including the 10% check when sampling without replacement.
2
Check success and failure counts.
Calculate \(x\) and \(n-x\). For the usual z interval, check that both are at least 10.
3
Calculate the estimate and standard error.
Find \(\hat{p}=x/n\), then \(SE=\sqrt{\hat{p}(1-\hat{p})/n}\).
4
Find the margin of error and endpoints.
Use the critical value for the requested confidence level: \(ME=z^*SE\). Report \(\hat{p}-ME\) and \(\hat{p}+ME\).

Worked Calculations

Worked Example: A 95% Interval From 84 Successes

Hypothetical data. A poll randomly selects 120 people from a population of 2,000, and 84 select a specified response. Calculate a 95% z interval for the population proportion who would select that response.

Check conditions. Assume the selection is genuinely random. The sample is \(120/2000=0.06\), or 6% of the population, which is below 10%. The success count is 84 and the failure count is \(120-84=36\); both are at least 10. The conditions for using the usual interval are met under these assumptions.

Estimate. The observed proportion selecting the response is

$$ \hat{p}=\frac{x}{n}=\frac{84}{120}=0.7000. $$

Standard error. Substitute the estimate and sample size into the estimated standard error formula:

$$ SE=\sqrt{\frac{\hat{p}(1-\hat{p})}{n}} =\sqrt{\frac{0.7000(0.3000)}{120}} =\sqrt{0.001750} \approx 0.04183. $$

For a 95% interval, use \(z^*=1.96\). The margin of error, calculated using the unrounded standard error, is

$$ ME=1.96\sqrt{0.001750}\approx 0.08199. $$

Endpoints. Subtract and add this margin of error to the estimate:

$$ 0.7000-0.08199=0.6180, \qquad 0.7000+0.08199=0.7820. $$

The resulting 95% interval is approximately \((0.6180,\,0.7820)\), or 61.80% to 78.20%. It estimates the population proportion selecting the response. The endpoints are proportions; multiplying by 100 expresses them as percentages.

Worked Example: A 90% Interval From 143 Successes

Hypothetical data. In a random sample of 200 patients selected from a registry of 5,000, 143 report a specified symptom during a defined period. Calculate a 90% interval for the population proportion reporting the symptom.

Check conditions. Assume the registry sample is random. The sampling fraction is \(200/5000=0.04\), below 10%. There are 143 successes and \(200-143=57\) failures, so both counts are at least 10.

Estimate and standard error.

$$ \hat{p}=\frac{143}{200}=0.7150, \qquad SE=\sqrt{\frac{0.7150(1-0.7150)}{200}} =\sqrt{\frac{0.203775}{200}} =\sqrt{0.001018875} \approx 0.03192. $$

For a 90% interval, use \(z^*=1.645\). Keeping the unrounded standard error for the multiplication,

$$ ME=1.645\sqrt{0.001018875}\approx 0.05251. $$

The endpoints are

$$ 0.7150-0.05251=0.6625, \qquad 0.7150+0.05251=0.7675. $$

The calculated 90% interval is approximately \((0.6625,\,0.7675)\), or 66.25% to 76.75%. The sample proportion remains the center; compared with a higher confidence level for this same data, a lower critical value produces a smaller margin of error.

Worked Example: A 99% Interval From 23 Successes

Hypothetical data. A random sample of 50 households is selected without replacement from a population of 700 households. Twenty-three households meet a stated criterion. Calculate a 99% z interval for the population proportion meeting it.

Check conditions. Assume the sample is random. The sampling fraction is \(50/700\approx 0.0714\), below 10%. There are 23 successes and \(50-23=27\) failures, both at least 10.

Estimate and standard error.

$$ \hat{p}=\frac{23}{50}=0.4600, \qquad SE=\sqrt{\frac{0.4600(0.5400)}{50}} =\sqrt{\frac{0.2484}{50}} =\sqrt{0.004968} \approx 0.07048. $$

For a 99% interval, use \(z^*=2.576\). Calculate the margin of error from the unrounded standard error:

$$ ME=2.576\sqrt{0.004968}\approx 0.1816. $$

The endpoints are

$$ 0.4600-0.1816=0.2784, \qquad 0.4600+0.1816=0.6416. $$

The 99% interval is approximately \((0.2784,\,0.6416)\), or 27.84% to 64.16%. It is wider than an interval calculated from the same estimate and standard error at a lower confidence level because the 99% critical value is larger.

Reading the Calculation and Avoiding Errors

The components answer different questions. The estimate \(\hat{p}\) is the observed fraction of successes. The estimated standard error describes the approximate sampling variability of that estimate under the model. The margin of error is the standard error multiplied by the critical value; it is not the standard error itself. The endpoints are formed by subtracting and adding the margin of error, not by multiplying the estimate by it.

A common mistake is to use the population proportion \(p\) in the standard error formula even though \(p\) is precisely what the interval is estimating. For this interval, use the observed estimate \(\hat{p}\) in \(\sqrt{\hat{p}(1-\hat{p})/n}\). Another mistake is to confuse the number of failures with the proportion of failures: the count is \(n-x\), while the proportion is \(1-\hat{p}\). Both appear in the condition checks and calculation, respectively.

Rounding too early can also make the displayed arithmetic inconsistent. For example, if a standard error is shown rounded to five decimal places, multiplying that displayed rounded value may give a slightly different last digit for the margin of error than calculating from the full expression. Keep full precision internally, show the formula with unrounded inputs where needed, and round the final estimate, margin of error, and endpoints consistently. The 90% and 99% examples use the unrounded square-root expressions in their margin-of-error calculations for this reason.

Finally, a correct calculation does not repair a poor design or failed conditions. If the sample is not representative, observations are dependent in an unaccounted-for way, or the success-failure condition fails, the usual z interval may not be reliable. State the outcome and population in context when reporting the numerical interval, and do not report more precision than the data and critical value support.

Key takeaway: Given \(x\) successes among \(n\) observations, calculate \(\hat{p}=x/n\), check the sampling design and both success-failure counts, then find \(SE=\sqrt{\hat{p}(1-\hat{p})/n}\), \(ME=z^*SE\), and the endpoints \(\hat{p}\pm ME\).

Check Your Understanding

For each calculation, show the estimate, standard error, margin of error, and endpoints. Check the conditions before deciding whether the usual z interval is appropriate.

  1. A random sample of 150 people from a population of 3,000 includes 96 successes. What is the sample proportion, and do the stated counts and sampling fraction meet the checks used here?
  2. For the sample in Question 1, set up the estimated standard error formula. What values belong in place of \(\hat{p}\) and \(n\)?
  3. A hypothetical random sample of 80 units has 8 successes. Which condition for the usual z interval fails, and why does that matter?
  4. If the estimate and sample size stay fixed but the confidence level increases, what happens to the critical value and margin of error?
  5. Explain why the failure count is \(n-x\), while the standard error formula uses \(1-\hat{p}\).