Access this content offline
Omniguides
Skip to the reading

4.4 Intervals and Tests for Two Proportions

Section Overview

  • Gallery 4.4.1 - 1 & 2 sided tests for 2 Prop.
  • Example 4.4.1
  • Gallery 4.4.2 - 2 Samp. z-test on Calc
  • Interactive 4.4.1 - Example 4.4.1
  • Gallery 4.4.3 - 2 Samp. z-interval on Calc
  • Pop Quiz 4.4.1

Using The Difference Between Two Sample Proportions

After discovering that we can perform statistical inference on the sample proportion p^\hat p, it should probably be no surprise that we can also perform statistical inference on the difference between two sample proportions p^1−p^2\hat p_1-\hat p_2.

There are three conditions that must be met before inference procedures can be carried out on the difference between two sample proportions. They are very similar to the conditions we learned about in Chapter 4.1, but apply to two samples instead of one. We will include the conditions for the difference between two sample means to parallel the structure in that section:

  • Random – For both samples or groups, the data we use comes from a random sample or randomized experiment.
  • Normal – For the difference between two sample proportions, we want to make sure that there are at least 10 successes and 10 failures for both samples or groups, or np≥10np\ge10 and n(1−p)≥10n(1-p)\ge10. For the difference between two sample means, we know its sampling distribution will be approximately Normal if n1≥30n_1\ge30 and n2≥30n_2\ge30 as ensured by the Central Limit TheoremEditorial qualification: The captured n ≥ 30 statement is not a universal guarantee. Under the CLT’s assumptions, the accuracy of a Normal approximation depends on the population and sample size..
  • Independent – The observations within and between both samples or groups must be independent of one another. If we are sampling without replacement we want to make sure that the populations are at least 10 times as large as their respective samples, or 10n1≤N110n_1\le N_1 and 10n2≤N210n_2\le N_2.

Significance Tests for Two Proportions

When performing significance tests for the difference between two sample proportions p^1−p^2\hat p_1-\hat p_2, we use the two-sample z test to find the z-statistic:

z=p^1−p^2−(p1−p2)p^c(1−p^c)n1+p^c(1−p^c)n2,wherez=\frac{\hat p_1-\hat p_2-(p_1-p_2)}{\sqrt{\frac{\hat p_c(1-\hat p_c)}{n_1}+\frac{\hat p_c(1-\hat p_c)}{n_2}}},\quad\text{where}
p^c=pooled sample proportion\hat p_c=\text{pooled sample proportion}
p^1−p^2=difference between sample mean 1 and sample mean 2\hat p_1-\hat p_2=\text{difference between sample mean 1 and sample mean 2}
p1−p2=difference between population mean 1 and population mean 2p_1-p_2=\text{difference between population mean 1 and population mean 2}
n1=size of sample 1n_1=\text{size of sample 1}
n2=size of sample 2n_2=\text{size of sample 2}

Our null hypothesis is: H0:p1=p2H_0:p_1=p_2

We also have our three possible alternative hypotheses, where:

Ha:p1>p2orHa:p1<p2for one-sided tests,H_a:p_1>p_2\quad\text{or}\quad H_a:p_1<p_2\quad\text{for one-sided tests,}
Ha:p1≠p2for two-sided testsH_a:p_1\ne p_2\quad\text{for two-sided tests}

See Gallery 4.6.1 for a visualization of one and two-sided tests.

Source gap (S0388): Source terminology note: the two difference definitions above say “sample mean” and “population mean” in the screenshot. The following reference says Gallery 4.6.1, while the captured gallery is titled 4.4.1. These original words and numbers are retained.

Confidence Intervals for Two Proportions

The two-sample z test to calculate the z-statistic is:

(p^1−p^2)±z∗p^1(1−p^1)n1+p^2(1−p^2)n2,where(\hat p_1-\hat p_2)\pm z^*\sqrt{\frac{\hat p_1(1-\hat p_1)}{n_1}+\frac{\hat p_2(1-\hat p_2)}{n_2}},\quad\text{where}
p^1=sample proportion of sample 1\hat p_1=\text{sample proportion of sample 1}
p^2=sample proportion of sample 2\hat p_2=\text{sample proportion of sample 2}
n1=size of sample 1n_1=\text{size of sample 1}
n2=size of sample 2n_2=\text{size of sample 2}
z∗=critical value of confidence intervalz^*=\text{critical value of confidence interval}
Source gap (S0389): Source terminology note: under the confidence-interval heading, the original sentence calls this interval expression a “two-sample z test” that calculates a “z-statistic.” The sentence and expression are retained.

Captured hypotheses in frame order:

Ha:p1>p2;Ha:p1<p2;Ha:p1≠p2H_a:p_1>p_2;\qquad H_a:p_1<p_2;\qquad H_a:p_1\ne p_2

The two-sided plot marks −∣z∣-|z| and ∣z∣|z|.

Example 4.4.1

Example 4.4.1

You just got a random room upgrade at a luxury resort and are pleased to find a giant gift basket waiting for you on your bed. You open it to find that out 37 of the 55 distinct items are fruit. Then, you decide to stay at a different resort from the same chain. You are welcomed with an even larger gift basket, but this time, 57 out of the 82 distinct items are fruit. The managers at each resort assure you that the thousands of items that go into gift baskets each day are all randomly selected by a computer program.

a) Is there sufficient evidence at the α=0.05\alpha=0.05 level to suggest that the fruit ratio differs between the two resorts?

b) Construct a confidence interval consistent with the results in (a).

Recorded answer to Example 4.4.1 (a)

a) Random – It can be assumed that you didn’t pick the rooms where each of your gift baskets were found.

Normal – There are at least 10 successes (37 and 57) and at least 10 failures (18 and 25) for each sample.

Independent – We can assume that the two samples from different chains are independent from one another. We can also assume that individual items within each gift basket are independent from one another because it was mentioned that the items are randomly chosen by a computer program. Since we are sampling without replacement, there have to be at least 10(55)=55010(55)=550 gift basket items in the first resort and at least 10(82)=82010(82)=820 gift basket items in the second resort, which we can assume to be true since it is stated in the problem that thousands of items are randomly assigned to gift baskets each day.

Since we want to know if the the proportion of fruit differs between the two resorts, we use a two-sided test:

H0:p1=p2,Ha:p1≠p2H_0:p_1=p_2,\quad H_a:p_1\ne p_2

The pooled sample proportion is:

p^c=X1+X2n1+n2=37+5755+82=0.686\hat p_c=\frac{X_1+X_2}{n_1+n_2}=\frac{37+57}{55+82}=0.686

Using the formula for the two-sample z test to calculate the z-statistic, we get:

z=p^1−p^2−(p1−p2)p^c(1−p^c)n1+p^c(1−p^c)n2z=\frac{\hat p_1-\hat p_2-(p_1-p_2)}{\sqrt{\frac{\hat p_c(1-\hat p_c)}{n_1}+\frac{\hat p_c(1-\hat p_c)}{n_2}}}
z=p^1−p^2−(p1−p2)p^c(1−p^c)n1+p^c(1−p^c)n2z=\frac{\hat p_1-\hat p_2-(p_1-p_2)}{\sqrt{\frac{\hat p_c(1-\hat p_c)}{n_1}+\frac{\hat p_c(1-\hat p_c)}{n_2}}}
z=0.673−0.695−00.686(0.314)55+0.686(0.314)82=−0.272z=\frac{0.673-0.695-0}{\sqrt{\frac{0.686(0.314)}{55}+\frac{0.686(0.314)}{82}}}=-0.272

Refer to Gallery 4.4.2 for how to perform these steps on your calculator. Note that the value from the calculator (z=−0.277z=-0.277) will be slightly different than the value we derived manually (z=−0.272z=-0.272). Due to the relative ease of use of the calculator, we will use z=−0.277z=-0.277, which corresponds to a p-value of 0.782. Since the p-value is greater than the significance level (0.782>0.050.782>0.05), we fail to reject the null hypothesis; we lack the evidence to suggest that the proportions of fruit actually differs between the two resorts.

Note that even if we used the manually-derived value of z=−0.272z=-0.272, we still would have rejected the null hypothesis.

Source gap (S0392): Source wording and decision note: the prompt says the resorts are from the same chain, but the recorded independence explanation calls them different chains. On page 178 the answer fails to reject the null hypothesis; on page 179 it says it still would have rejected it using the manually derived value. Both statements are retained.
Source gap (S0394): Source input/result distinction: no alternative is visibly highlighted in the input screen; only Calculate is highlighted. The input selection is indeterminate. The following S0395 result header explicitly shows p₁ ≠ p₂, which is retained separately.
Captured two-proportion test inputs and results
ScreenFieldCaptured value
Inputx1x_137
Inputn1n_155
Inputx2x_257
Inputn2n_282
InputAlternatives shownp1≠p2;p1<p2;p1>p2p_1\ne p_2;\quad p_1<p_2;\quad p_1>p_2
InputSelected alternativeIndeterminate; no alternative is visibly highlighted.
ResultAlternative shown in headerp1≠p2p_1\ne p_2
Resultzz−0.276882…
Resultp-value0.7818706…
Resultp^1\hat p_10.672727…
Resultp^2\hat p_20.695122…
ResultPooled p^\hat p0.686131…

Interactive 4.4.1 Example 4.2.1

Captured annotation overview of a Normal curve with orange shading in both tails beyond z = −0.277 and z = 0.277. A callout z-statistic of Interest points to the negative cutoff; a callout p-value of interest points into the orange left tail. The widget title says Example 4.2.1. Open full-size image S0396

Captured callout labels: z-statistic of Interest; p-value of interest. Captured cutoffs: z=−0.277z=-0.277 and z=0.277z=0.277.

Source gap (S0396): Only the annotation overview is captured; expanded callout explanations are absent. The original interactive title says Example 4.2.1 although the surrounding example is 4.4.1.
Recorded answer to Example 4.4.1 (b)

b) A confidence interval consistent with our results in (a) would have a confidence level of 95%. A confidence level of 95% for a two-sided significance test means that we have to divide the significance level, α=0.05\alpha=0.05, between both tails; an area of 0.025 lies in the right tail and an area of 0.025 lies in the left. 0.025 in the right tail means that the area to the left of it is 0.975, which corresponds to a critical z-value of 1.96 according to the z-table.

Using the formula for the two-sample z-interval, we get:

(p^1−p^2)±z∗p^1(1−p^1)n1+p^2(1−p^2)n2(\hat p_1-\hat p_2)\pm z^*\sqrt{\frac{\hat p_1(1-\hat p_1)}{n_1}+\frac{\hat p_2(1-\hat p_2)}{n_2}}
(0.022)±1.960.673(0.327)55+0.695(0.305)82(0.022)\pm1.96\sqrt{\frac{0.673(0.327)}{55}+\frac{0.695(0.305)}{82}}
=(−0.182, 0.137)=(-0.182,\ 0.137)

Refer to Gallery 4.4.3 for how to perform these steps on your calculator.

We can be 95% confident that a given gift basket from the second resort contains between 18.2% less fruit and 13.7% more fruit than a gift basket from the first resort. Since 0 is included in this interval (meaning that the first resort puts just as large a percentage of fruit in their gift baskets as the second resort), this goes with the results from the hypothesis test in stating that we lack the evidence to say if the fruit ratios actually differ between the two dif-

Source gap (S0400): Source gap: the final recorded sentence stops at “between the two dif-” at the bottom of page 180. No continuation appears in the assigned captures; the next page contains the quiz.
Source gap (S0400): Source calculation and interpretation note: the interval substitution prints positive 0.022 although the earlier difference is 0.673 − 0.695; the resulting interval is printed (−0.182, 0.137). The interpretation refers to the second resort relative to the first and equates inclusion of zero with equal percentages. These captured expressions and statements are retained.
Source gap (S0397): Source caption note: the first frame’s caption says to choose “1-PropZInt,” while the captured menu highlights “2-PropZInt.” The caption is retained.
Captured two-proportion interval inputs and results
ScreenFieldCaptured value
Inputx1x_137
Inputn1n_155
Inputx2x_257
Inputn2n_282
InputC-Level0.95
ResultInterval(−0.1815, 0.13668)
Resultp^1\hat p_10.672727…
Resultp^2\hat p_20.695122…
Resultn1n_155
Resultn2n_282

Pop Quiz 4.4.1

Question 1 of 5

In a hypothesis test involving proportions, both npnp and n(1−p)n(1-p) should

Question 2 of 5

A law school wants to determine whether the recently hired professor Paul is working out. 16 out of 25 of Professor Paul’s students passed the bar exam on the first try. In comparison, 57 out of 72 of more experienced Professor John’s students passed the test on the first try. Is Paul’s success rate worse than John’s? The hypotheses to be tested are:

Question 3 of 5

Considering question 2, the sample proportions are:

Question 4 of 5

From question 2, it can be concluded that at the 90% confidence interval that:

Question 5 of 5

A public health researcher wants to know how urban and rural schools differ in the percentage of students who smoke. A random survey of shows that: 47 urban and 52 rural smokers out of a total of 125 and 153 surveyed, respectively. What is a 90% confidence interval for the difference between the smoking rates in the two schools?

Source gap (S0401): All five quiz prompts and choices are captured in S0401–S0405. None displays a checked answer or answer feedback. The phrase “A random survey of shows that” in Question 5 and all answer-choice values are retained from the source.
Glossary and deeper reading · 14 refreshers

These editorial refreshers supplement the reading. Definitions and examples are added guidance; original source wording and recorded answers remain in their original context.

  • Statistical inference

    Statistical inference uses data and a study design to draw conclusions beyond the observed values. Random sampling supports population generalization, while well-conducted random assignment supports treatment-effect conclusions. For example, a random sample can estimate a school-wide preference without surveying every student.

    Read more: Statistical inference in the captured Statistics reading →

  • Sample proportion

    A sample proportion is the number of sampled individuals with a specified characteristic divided by the sample size. It is commonly written p-hat and estimates the corresponding population proportion. For example, 18 walkers among 60 sampled students give a sample proportion of 0.30.

    Read more: Sample proportion in the captured Statistics reading →

  • Difference between sample proportions

    A difference between sample proportions compares the observed fractions in two samples. Its order matters, and inference must account for both sample sizes and the independence or dependence of the groups. For example, subtracting one class’s walking proportion from another’s estimates a difference between their population proportions.

    Read more: Difference between sample proportions in the captured Statistics reading →

  • Difference between sample means

    A difference between sample means compares two groups’ observed averages. Inference must reflect whether the samples are independent or paired rather than treating every comparison the same way. For example, two independently sampled classes’ mean travel times can estimate a difference between their population means.

    Read more: Difference between sample means in the captured Statistics reading →

  • Sample

    A sample is the subset of a population actually studied. How it is selected matters for the conclusions that can be drawn about the population. For example, 60 selected students may be a sample from a school’s full enrollment.

    Read more: Sample in the captured Statistics reading →

  • Random sampling

    Random sampling uses a specified chance process to select individuals from a population. It supports population inference when the sampling frame and data collection are appropriate, but does not guarantee perfect balance or eliminate every source of bias. For example, a random-number generator can select student identifiers from an enrollment list.

    Read more: Random sampling in the captured Statistics reading →

  • Sampling distribution

    A sampling distribution describes how a statistic varies across all possible samples drawn under a specified sampling design and sample size. It is a distribution of statistics rather than of individual observations. For example, the proportions from repeated random samples of 60 students form a sampling distribution.

    Read more: Sampling distribution in the captured Statistics reading →

  • Central limit theorem

    Editorial qualification: The captured n ≥ 30 statement is not a universal guarantee. Under the CLT’s assumptions, the accuracy of a Normal approximation depends on the population and sample size.

    For independent identically distributed observations with finite variance, the central limit theorem explains why the standardized sample mean approaches a Normal distribution as sample size increases. There is no universal sample size that makes every population sufficiently close to Normal; skewness and extreme tails affect the approximation. For example, averaging many independent waiting times can produce a less skewed distribution of averages than the original waiting-time distribution.

    Read more: Central limit theorem in the captured Statistics reading →

  • Statistical independence

    Statistical independence means that learning one outcome does not change the probability distribution of another. For two events, it implies that the probability of both occurring equals the product of their probabilities. For example, independent draws with replacement keep the second draw’s color probabilities unchanged by the first.

    Read more: Statistical independence in the captured Statistics reading →

  • Sampling without replacement

    Sampling without replacement does not return selected items before later selections. Selections from a finite population are dependent, although treating them as approximately independent can be reasonable when the sample is a small fraction of the population. For example, selecting students without replacement ensures that no student is chosen twice.

    Read more: Sampling without replacement in the captured Statistics reading →

  • Significance test

    A significance test assesses how compatible observed data are with a specified null model. It compares a test statistic or p-value with a decision rule chosen for the study. For example, a test can assess whether a sample provides evidence that a population walking proportion differs from a stated value.

    Read more: Significance test in the captured Statistics reading →

  • Test statistic

    A test statistic summarizes how the sample departs from the null model. Its reference distribution under the null supplies the probabilities used in testing. For example, a z-statistic expresses a sample proportion’s difference from a hypothesized proportion in null-model standard-error units.

    Read more: Test statistic in the captured Statistics reading →

  • Null hypothesis

    A null hypothesis specifies the reference claim or model used to calculate a test’s probabilities. It commonly states no population difference or a particular parameter value. For example, a null hypothesis can state that the population mean travel time equals 15 minutes.

    Read more: Null hypothesis in the captured Statistics reading →

  • Alternative hypothesis

    An alternative hypothesis specifies the population difference or direction for which a test seeks evidence. It should be chosen from the research question before inspecting results. For example, an alternative can state that the population mean travel time is greater than 15 minutes.

    Read more: Alternative hypothesis in the captured Statistics reading →

Search lessons, terms and problems