Biostatistics • Sampling & Estimation

CI for a Proportion — Compute CI for a proportion (z-interval)

Quantify uncertainty around a sample proportion using the normal approximation to the binomial distribution.

A scatter plot connecting biological data with a DNA strand and health signal.
Inside this lesson 10 sections 5 questions 9 figures

SECTION 1

Historical Context & Motivation

The problem of estimating population proportions from limited samples has occupied statisticians for centuries. When an epidemiologist reports that 12% of patients in a clinical trial experienced a side effect, the natural follow-up question is: how close is that 12% to the true, unknown population proportion? The confidence interval for a proportion provides a principled answer by constructing a range of plausible values for the population parameter, anchored in the mathematics of the normal approximation to the binomial distribution. This tool is indispensable in biostatistics, where decisions about drug efficacy, disease prevalence, and public health policy rest on proportions derived from finite samples.

1733 • De Moivre's Normal Approximation

Abraham de Moivre demonstrated that the binomial distribution could be approximated by the normal curve for large sample sizes, laying the mathematical foundation for z-based inference on counts and proportions.

1812 • Laplace's Central Limit Theorem

Pierre-Simon Laplace formalized the Central Limit Theorem, proving that the sampling distribution of a sum (and hence a proportion) converges to normality as the sample size grows—regardless of the underlying distribution.

1934 • Clopper–Pearson Exact Interval

C.J. Clopper and E.S. Pearson published the exact confidence interval for a binomial proportion, highlighting the limitations of the normal approximation for small samples and motivating criteria for when the Wald z-interval is appropriate.

1998 • Agresti–Coull Adjusted Interval

Alan Agresti and Brent Coull proposed the "add two successes and two failures" adjustment, offering a simple correction that dramatically improves coverage probability compared to the standard Wald interval for moderate sample sizes.

Despite the availability of exact and adjusted methods, the Wald z-interval remains the most widely taught and applied confidence interval for proportions in introductory and intermediate biostatistics courses. Understanding its derivation, assumptions, and limitations equips you to both use it correctly and recognize when more sophisticated alternatives are warranted.

SECTION 2

Core Principles & Definitions

Before computing a confidence interval for a proportion, it is essential to understand the statistical machinery that makes the construction valid. The interval rests on several interconnected ideas: the notion of a population proportion as a fixed but unknown parameter, the behavior of the sample proportion as a random variable, the Central Limit Theorem's guarantee of approximate normality, and the interpretation of the confidence level itself.

1

Population Proportion (p)

The true fraction of individuals in the entire population possessing a characteristic of interest. This is a fixed parameter—unknown but not random. For example, the true prevalence of hypertension among all adults in a country.
2

Sample Proportion (p̂)

Computed as p̂ = X / n, where X is the number of successes and n is the sample size. Because different samples yield different values of p̂, it is a random variable with its own sampling distribution.
3

Standard Error (SE)

The standard deviation of the sampling distribution of p̂, estimated as SE = √[p̂(1 − p̂) / n]. It quantifies sampling variability and shrinks as n increases.
4

Critical Value (z*)

The number of standard errors needed to capture the central (1 − α) × 100% of the standard normal distribution. For a 95% CI, z* = 1.96. This multiplier sets the width of the interval.
5

Confidence Level (1 − α)

If we repeated the sampling and CI construction process many times, (1 − α) × 100% of the intervals would contain the true p. It describes the long-run reliability of the procedure, not the probability that a single interval contains p.
✦

KEY TAKEAWAY

Think of a confidence interval as a fishing net cast into a lake. The true proportion p is a specific fish whose exact location you cannot see. A 95% confidence interval means that if you cast 100 nets using the same method, about 95 of them would contain the fish. The net's width (margin of error) depends on how variable your casts are (standard error) and how much of the lake you choose to cover (confidence level). Wider nets catch the fish more often but provide less precise information about where it actually is.

SECTION 3

Visual Explanation — The Sampling Distribution & the Interval

The confidence interval for a proportion derives its validity from the fact that the sampling distribution of p̂ is approximately normal when the sample size is sufficiently large. The diagram below illustrates how the standard normal distribution and the critical value z* combine to define the interval boundaries. The shaded central region represents the proportion of the distribution captured by the confidence level, and the tails represent the probability α that is split equally on both sides.

Sampling Distribution of p̂ (Normal Approximation)p̂p̂ − z*·SEp̂ + z*·SE95% of area(1 − α)α/2α/2Confidence Interval Width = 2 × z* × SE
The bell curve represents the sampling distribution of p̂ under the normal approximation. The shaded central region captures 95% of the distribution's area, bounded by the critical values at p̂ ± z* × SE. The red tail regions each contain α/2 = 2.5% of the area, representing the probability of excluding the true proportion. The purple bracket below shows the resulting confidence interval width.

Notice that the confidence interval is symmetric about p̂. This symmetry follows directly from the normal approximation, which assumes the sampling distribution of p̂ is a symmetric bell curve. In practice, the true binomial distribution of p̂ is slightly skewed when p is far from 0.5 or when n is small, which is one reason the z-interval's coverage can deviate from the nominal level in those settings. The visual also underscores why increasing the sample size narrows the interval: a larger n shrinks SE, which compresses the bell curve horizontally, bringing the critical-value boundaries closer to the center.

SECTION 4

Mathematical Framework

The construction of the z-interval for a proportion begins with the sampling distribution of the sample proportion. Let X ~ Binomial(n, p), where X counts the number of successes in n independent Bernoulli trials each with success probability p. The sample proportion is p̂ = X / n. By the Central Limit Theorem, for large n, the standardized statistic Z = (p̂ − p) / √[p(1 − p) / n] is approximately standard normal. Because the true p is unknown, we substitute p̂ in the standard error, yielding the Wald confidence interval.

SAMPLE PROPORTION

p^=X/np̂ = X / n

where X = number of successes (events of interest), and n = total sample size.

ESTIMATED STANDARD ERROR

SE(p^)=√[p^(1−p^)/n]SE(p̂) = √[ p̂(1 − p̂) / n ]

This replaces the true standard deviation √[p(1 − p)/n] with its sample-based estimate, which is necessary because p is unknown. The substitution is justified when n is large enough that the CLT holds.

WALD CONFIDENCE INTERVAL

p^±z∗×√[p^(1−p^)/n]p̂ ± z* × √[ p̂(1 − p̂) / n ]

Equivalently: ( p̂ − z* × SE , p̂ + z* × SE ). Here z* is the critical value from the standard normal distribution corresponding to the desired confidence level. Common values: z* = 1.645 (90%), z* = 1.960 (95%), z* = 2.576 (99%).

MARGIN OF ERROR

E=z∗×√[p^(1−p^)/n]E = z* × √[ p̂(1 − p̂) / n ]

The margin of error E is the half-width of the confidence interval. The full interval is p̂ ± E. The margin of error decreases with √n, so quadrupling the sample size halves the margin of error.

⚠

Validity Conditions

The normal approximation underlying the z-interval requires that both np̂ ≥ 10 and n(1 − p̂) ≥ 10. Some texts use a threshold of 5 instead of 10. Additionally, the observations must be independent, which is typically satisfied when sampling with replacement or when the sample is less than 10% of the population (the 10% condition).

SECTION 5

Factors Affecting Interval Width

Three primary factors govern the width of the confidence interval for a proportion: the sample size, the sample proportion, and the confidence level. Understanding how each factor influences the interval is critical for study design, particularly in biostatistical applications where sample size determination is often the first step in protocol development. The diagram below visualizes these relationships.

How Key Factors Affect CI WidthEffect of Sample Size (n)Sample Size (n)CI Widthn=50n=200n=1000Effect of p̂ on SEp̂SE0.00.51.0Comparison of CI Widths at Different Confidence Levels (n = 200, p̂ = 0.30)90% CI(0.247, 0.353)95% CI(0.236, 0.364)99% CI(0.217, 0.383)p̂ = 0.30
Top left: CI width decreases as n increases (curve flattens), showing diminishing returns. Top right: SE is maximized when p̂ = 0.5 and minimized near 0 or 1—the parabolic shape of p̂(1 − p̂). Bottom: three confidence intervals for the same data at 90%, 95%, and 99% levels, illustrating the precision–confidence tradeoff.
FactorChangeEffect on CI Width
Sample size (n)Increase nNarrower CI — width ∝ 1/√n
Sample proportion (p̂)p̂ moves toward 0.5Wider CI — SE is maximized at p̂ = 0.5
Confidence level (1 − α)Increase from 95% to 99%Wider CI — z* increases from 1.96 to 2.576

Summary of factors affecting CI width

SECTION 6

Worked Example — Prevalence of Antibiotic Resistance

A hospital infection control team cultures 400 bacterial isolates from clinical specimens and finds that 92 of them are resistant to a first-line antibiotic. Construct a 95% confidence interval for the true proportion of antibiotic-resistant isolates in the hospital's patient population.

95% CI for Antibiotic Resistance Prevalence

  1. 1

    Step 1 — Identify Given Values

    Number of successes (resistant isolates): X = 92. Sample size: n = 400. Desired confidence level: 95%, so α = 0.05 and z* = 1.960.
    X = 92, n = 400, z* = 1.960
  2. 2

    Step 2 — Compute the Sample Proportion

    p̂ = X / n = 92 / 400 = 0.230. This is our point estimate of the true resistance proportion.
    p̂ = 0.230
  3. 3

    Step 3 — Verify Normal Approximation Conditions

    Check: np̂ = 400 × 0.230 = 92 ≥ 10 ✓. Check: n(1 − p̂) = 400 × 0.770 = 308 ≥ 10 ✓. Both conditions are comfortably satisfied, so the z-interval is appropriate.
    Conditions met: np̂ = 92, n(1−p̂) = 308
  4. 4

    Step 4 — Calculate the Standard Error

    SE = √[p̂(1 − p̂) / n] = √[0.230 × 0.770 / 400] = √[0.1771 / 400] = √0.00044275 = 0.02104.
    SE ≈ 0.02104
  5. 5

    Step 5 — Compute the Margin of Error

    E = z* × SE = 1.960 × 0.02104 = 0.04124.
    E ≈ 0.0412
  6. 6

    Step 6 — Construct the Confidence Interval

    Lower bound: p̂ − E = 0.230 − 0.0412 = 0.1888. Upper bound: p̂ + E = 0.230 + 0.0412 = 0.2712. Therefore, the 95% CI is (0.189, 0.271).
    95% CI: (0.189, 0.271)
  7. 7

    Step 7 — Interpret the Result

    We are 95% confident that the true proportion of antibiotic-resistant isolates in this hospital's population lies between 18.9% and 27.1%. If the hospital's resistance threshold for changing empiric therapy protocols is 25%, this interval suggests the true rate could plausibly be above or below that threshold, indicating further monitoring or a larger study may be needed.

SECTION 7

Strengths, Limitations & Common Pitfalls

StrengthsLimitations
Computationally simple — requires only p̂, n, and z*.Coverage probability can fall well below the nominal level when n is small or p is near 0 or 1.
Widely understood and reported in biomedical literature, facilitating communication.Symmetric construction can produce bounds below 0 or above 1, which are meaningless for proportions.
Directly connects to hypothesis testing: the CI excludes p₀ if and only if the z-test rejects H₀: p = p₀.Relies on the plug-in estimate of SE; when p̂ ≈ 0 or p̂ ≈ 1, SE is severely underestimated.
Easily extended to two-proportion comparisons and stratified analyses.Assumes independent observations — violated in clustered designs (e.g., patients nested within hospitals).

Strengths and limitations of the Wald z-interval for a proportion

⚠

Common Pitfall — Misinterpreting Confidence

A frequent error is stating "there is a 95% probability that the true proportion lies within this interval." In frequentist statistics, the true proportion is a fixed constant — it either is or is not in the interval. The 95% refers to the long-run success rate of the procedure: if you repeated the study infinitely many times, 95% of the resulting intervals would capture the true p.
✦

KEY TAKEAWAY

The Wald z-interval is like a quick field measurement with a tape measure: fast, good enough for most routine applications when the object isn't too small or oddly shaped, but you'd switch to a precision caliper (exact or adjusted methods) when accuracy at the extremes matters. In biostatistics, the extremes correspond to rare diseases or nearly universal exposures—precisely the situations where the Wald interval's performance degrades.

SECTION 8

Connection to Advanced Methods

The Wald z-interval is the starting point in a family of confidence intervals for proportions, each offering different tradeoffs between simplicity and coverage accuracy. Understanding these alternatives contextualizes the z-interval and prepares you for more nuanced statistical practice in clinical research, epidemiology, and regulatory biostatistics.

MethodKey IdeaWhen to Prefer
Wald (z-interval)Normal approximation with plug-in SE: p̂ ± z*√[p̂(1−p̂)/n]Large n, p̂ not extreme; quick calculations and pedagogical settings.
Wilson score intervalInverts the score test rather than the Wald test; better coverage for small n.Moderate samples (n = 20–100); p near 0 or 1; recommended by many modern guidelines.
Agresti–CoullAdds z²/2 pseudo-successes and pseudo-failures before applying the Wald formula: p̃ = (X + 2)/(n + 4) for 95% CI.Simple adjustment that nearly matches Wilson coverage; practical compromise.
Clopper–Pearson (exact)Based directly on the binomial distribution; guarantees at least (1−α) coverage.Small samples; regulatory submissions (FDA guidance); conservative inference.
Bayesian credible intervalUses a Beta prior on p and computes the posterior interval after observing data.When prior information is available; adaptive clinical trials; probabilistic interpretation is desired.

Comparison of confidence interval methods for a binomial proportion

In practice, influential papers by Agresti and Coull (1998) and Brown, Cai, and DasGupta (2001) demonstrated through simulation that the Wald interval can have actual coverage probabilities oscillating significantly below the nominal 95% level, even for moderately large samples. This has led to recommendations in many biostatistics textbooks to prefer the Wilson score interval or the Agresti–Coull adjusted interval as default choices. Nonetheless, the Wald interval remains essential to master because it is the conceptual foundation on which these refinements are built, it appears in most published research, and its derivation directly illustrates the general logic of confidence interval construction via pivotal quantities.

SECTION 9

Practice Problems

Question 1: CONCEPTUAL

A researcher computes a 95% confidence interval for the proportion of patients who respond to a new therapy and obtains (0.42, 0.58). She states: "There is a 95% probability that the true response rate is between 42% and 58%." Explain why this statement is technically incorrect under the frequentist framework, and provide a correct interpretation.
Show answer
Under frequentist inference, the true population proportion p is a fixed (but unknown) constant—it does not have a probability distribution. After the interval is computed, p either lies within (0.42, 0.58) or it does not; there is no randomness left. The correct interpretation is: "We are 95% confident that the true response rate lies between 42% and 58%," meaning that if we were to repeat the study many times and construct a CI each time, approximately 95% of those intervals would contain the true p. The confidence level describes the reliability of the procedure, not the probability of any single interval.

Question 2: BASIC CALCULATION

In a survey of 250 adults, 75 reported receiving a flu vaccine in the past year. Compute the 95% confidence interval for the true vaccination proportion. Use z* = 1.960.
Show answer
First, compute p̂ = 75/250 = 0.300. Verify conditions: np̂ = 75 ≥ 10 and n(1−p̂) = 175 ≥ 10, so the z-interval is valid. Calculate SE = √[0.300 × 0.700 / 250] = √[0.21/250] = √0.00084 ≈ 0.02898. The margin of error is E = 1.960 × 0.02898 ≈ 0.0568. The 95% CI is (0.300 − 0.057, 0.300 + 0.057) = (0.243, 0.357). We are 95% confident that the true vaccination proportion lies between 24.3% and 35.7%.

Question 3: INTERMEDIATE

A public health department wants to estimate the prevalence of diabetes in a county to within ±3 percentage points with 99% confidence. Using a planning value of p* = 0.10 (based on national estimates), determine the minimum sample size required.
Show answer
The sample size formula derived from the margin of error equation is n = (z*/E)² × p*(1 − p*). For 99% confidence, z* = 2.576. The desired margin of error is E = 0.03. Substituting: n = (2.576/0.03)² × 0.10 × 0.90 = (85.867)² × 0.09 = 7373.1 × 0.09 ≈ 663.6. Rounding up to ensure the margin of error does not exceed 3%, the minimum sample size is n = 664. Note that using the conservative planning value p* = 0.5 instead would yield n = (85.867)² × 0.25 ≈ 1844, which is nearly three times larger—illustrating why a reasonable estimate of p can substantially reduce the required sample size.

Question 4: APPLIED

A Phase III clinical trial enrolls 600 patients, randomized equally to drug (n₁ = 300) and placebo (n₂ = 300). In the drug arm, 198 patients achieve clinical remission; in the placebo arm, 132 do. Compute a 95% CI for each arm's remission proportion separately. Then, without performing a formal two-proportion test, use the two intervals to make a preliminary assessment of whether the drug appears effective.
Show answer
Drug arm: p̂₁ = 198/300 = 0.660. SE₁ = √[0.660 × 0.340 / 300] = √[0.2244/300] = √0.000748 ≈ 0.02735. E₁ = 1.960 × 0.02735 ≈ 0.0536. 95% CI₁: (0.606, 0.714). Placebo arm: p̂₂ = 132/300 = 0.440. SE₂ = √[0.440 × 0.560 / 300] = √[0.2464/300] = √0.000821 ≈ 0.02866. E₂ = 1.960 × 0.02866 ≈ 0.0562. 95% CI₂: (0.384, 0.496). The two intervals do not overlap—the lower bound of the drug arm's CI (0.606) exceeds the upper bound of the placebo arm's CI (0.496). While non-overlapping individual CIs is a conservative (sufficient but not necessary) criterion for significance, it strongly suggests a statistically significant difference. The 22-percentage-point gap in point estimates appears clinically meaningful as well. A formal two-proportion z-test or a CI for the difference in proportions would provide a more precise inference.

Question 5: CRITICAL THINKING

A colleague reports a 95% Wald CI of (−0.02, 0.08) for the proportion of adverse events in a small pilot study with n = 30 and X = 1. Identify at least two methodological problems with this interval and recommend a more appropriate method. Explain your reasoning.
Show answer
Two major problems are evident. First, the lower bound is negative (−0.02), which is impossible for a proportion—a proportion must lie in [0, 1]. This pathology arises because the Wald interval's symmetric construction around p̂ can extend beyond the parameter space, especially when p̂ is near 0 or 1. Second, the normal approximation conditions are not satisfied: np̂ = 30 × (1/30) = 1, which is far below the threshold of 10. With only one observed event, the sampling distribution of p̂ is severely right-skewed and poorly approximated by a symmetric normal curve. A more appropriate method would be the Clopper–Pearson exact interval, which is based directly on the binomial distribution and guarantees at least 95% coverage regardless of sample size. Alternatively, the Wilson score interval would also perform far better here, yielding an asymmetric interval that respects the [0, 1] boundary. Both methods would produce an interval shifted to the right relative to the Wald interval, reflecting the skewness inherent in estimating a very small proportion from a tiny sample.

SUMMARY

Lesson Summary

Summary

The confidence interval for a proportion (z-interval) uses the normal approximation to the binomial distribution to construct a range of plausible values for the unknown population proportion p. The formula p̂ ± z* × √[p̂(1 − p̂) / n] combines the sample proportion p̂ as a point estimate, the standard error to quantify sampling variability, and the critical value z* to set the desired confidence level. The validity of this interval depends on satisfying the conditions np̂ ≥ 10 and n(1 − p̂) ≥ 10 and on the independence of observations.

The margin of error E = z* × SE is the half-width of the interval and decreases proportionally to 1/√n, meaning that quadrupling the sample size halves the margin of error. The interval is widest when p̂ = 0.5 and narrows as p̂ approaches 0 or 1. While the Wald z-interval is computationally simple and widely used, its coverage probability can deviate from the nominal level for small samples or extreme proportions. In such cases, the Wilson score interval, Agresti–Coull adjustment, or Clopper–Pearson exact interval provide superior alternatives.

Varsity Tutors • Biostatistics • CI for a Proportion — Compute CI for a proportion (z-interval)