01 / 20

Confidence Intervals for
Differences

Learn to compute and interpret confidence intervals for the difference in means and proportions between two populations.

Biostatistics

Why Compare Two Groups?

In biostatistics we rarely study a single population in isolation. We want to know: Is the new drug better than the placebo? Do males and females differ in blood pressure? These questions ask about the difference between two population parameters.

Key Terminology

Point Estimate
A single number from the sample: \(\bar{x}_1 - \bar{x}_2\) or \(\hat{p}_1 - \hat{p}_2\).
Standard Error
Measures the variability of the point estimate across repeated samples.
Critical Value
\(z^*\) or \(t^*\): determined by the confidence level (e.g., 1.96 for 95%).

Anatomy of a Confidence Interval

Margin of Error Point Estimate Lower Bound Upper Bound If 0 is inside this interval, the difference may be zero. 0

CI for Difference in Means

When both populations are approximately normal (or \(n\) is large):

\(\bar{x}_1 - \bar{x}_2\)
Difference of sample means: the point estimate.
\(t^*\)
Critical value from the \(t\)-distribution (use Welch's df).
\(\text{SE}\)
\(\sqrt{s_1^2/n_1 + s_2^2/n_2}\) : the standard error of the difference.

CI for Difference in Proportions

When both samples are large enough for the normal approximation:

\(\hat{p}_1 - \hat{p}_2\)
Difference of sample proportions.
\(z^*\)
Critical value from the standard normal (e.g., 1.96 for 95%).
\(\text{SE}\)
\(\sqrt{\frac{\hat{p}_1(1-\hat{p}_1)}{n_1} + \frac{\hat{p}_2(1-\hat{p}_2)}{n_2}}\)

Means vs. Proportions: Key Differences

Difference in Means Difference in Proportions
Parameter \(\mu_1 - \mu_2\) \(p_1 - p_2\)
Estimator \(\bar{x}_1 - \bar{x}_2\) \(\hat{p}_1 - \hat{p}_2\)
Distribution \(t\)-distribution Standard normal \(z\)
SE formula \(\sqrt{s_1^2/n_1 + s_2^2/n_2}\) \(\sqrt{\frac{\hat{p}_1(1-\hat{p}_1)}{n_1} + \frac{\hat{p}_2(1-\hat{p}_2)}{n_2}}\)
Data type Quantitative (continuous) Categorical (binary)

Checking Conditions

1
Independence: Samples are independent of each other, and within each sample observations are independent (random sampling or random assignment).
2
Normality (means): Each population is approximately normal, or each sample size \(n_i \geq 30\) (Central Limit Theorem).
3
Success/Failure (proportions): Each sample must have at least 10 successes and 10 failures: \(n_i\hat{p}_i \geq 10\) and \(n_i(1-\hat{p}_i) \geq 10\).
4
10% Rule: Each sample is less than 10% of its population (for sampling without replacement).

Step-by-Step Procedure

1
Identify the parameter: Are you comparing means (\(\mu_1 - \mu_2\)) or proportions (\(p_1 - p_2\))?
2
Check conditions: Independence, normality (or success/failure), and the 10% rule.
3
Compute the point estimate: \(\bar{x}_1 - \bar{x}_2\) or \(\hat{p}_1 - \hat{p}_2\).
4
Find the standard error: Plug sample statistics into the appropriate SE formula.
5
Find the critical value: Use \(z^*\) (proportions) or \(t^*\) (means) for the desired confidence level.
6
Build the interval: Point estimate \(\pm\) (critical value \(\times\) SE). Interpret in context.

Example 1: Difference in Means

A clinical trial compares systolic blood pressure in two groups. Drug group: \(n_1 = 40\), \(\bar{x}_1 = 126\), \(s_1 = 14\). Placebo group: \(n_2 = 35\), \(\bar{x}_2 = 134\), \(s_2 = 16\). Find a 95% CI for \(\mu_1 - \mu_2\).

Visualizing Example 1

-15 -10 -5 0 5 Zero (no difference) -8.00 -14.99 -1.01 Entire CI is below zero: drug lowers SBP

Example 2: Difference in Proportions

A vaccine study: Vaccine group: 320 out of 4000 got sick (\(\hat{p}_1 = 0.08\)). Control group: 560 out of 4000 got sick (\(\hat{p}_2 = 0.14\)). Find a 95% CI for \(p_1 - p_2\).

Example 3: When the CI Contains Zero

Two study techniques are compared on exam scores. Group A: \(n_1 = 25\), \(\bar{x}_1 = 78\), \(s_1 = 10\). Group B: \(n_2 = 25\), \(\bar{x}_2 = 75\), \(s_2 = 12\). Find a 95% CI for \(\mu_A - \mu_B\).

Interpreting the Interval

CI excludes 0
Evidence of a real difference between groups. The sign tells you which group is larger.
CI includes 0
No significant difference detected. The true difference could plausibly be zero.

Common Mistakes

✕ Wrong SE Formula
For a CI of the difference in proportions, using the pooled SE. The CI formula requires the unpooled SE, calculated with \(\hat{p}_1\) and \(\hat{p}_2\) separately. Pooled SE is for hypothesis tests.
✕ Using \(z^*\) for Means
When population \(\sigma\) is unknown, always use the \(t\)-distribution for a CI on means, not \(z\).
✕ Ignoring Conditions
Failing to verify independence, normality, or the success/failure condition before computing the CI.

Question 1 of 5

The general form of any confidence interval is:

Question 2 of 5

When constructing a CI for the difference in proportions, which critical value do you use?

Question 3 of 5

A 95% CI for \(\mu_1 - \mu_2\) is \((-4.2,\;1.8)\). What can we conclude?

Question 4 of 5

Given: \(\hat{p}_1 = 0.35\), \(n_1 = 200\), \(\hat{p}_2 = 0.28\), \(n_2 = 250\). What is the standard error for \(\hat{p}_1 - \hat{p}_2\)?

Question 5 of 5

Which condition must be checked for a CI for the difference in proportions but not for a CI for the difference in means?