Topic 9: Hypothesis Testing for One and Two Sample Proportions


These are the solutions for Computer Lab 10.


1 One-sample Test of Proportions

1.1

\(\widehat{p} = \displaystyle \frac{x}{n} = \frac{582}{840} \approx 0.693\).

1.2

We have \(H_0: p = 0.65\), versus \(H_1: p \neq 0.65\).

1.3

Note that for these tests, we use the null hypothesis \(p\) value.

We have \(n \times p = 840 \times 0.65 = 546 > 5\), and \(n \times (1-p) = 840 \times 0.35 = 294 > 5\).

Since both conditions are satisfied, we can conclude that the one-sample proportion test conditions have been met.

1.4

The approximate distribution for our proportion is:

\[ \widehat{P} \stackrel{\tiny \text{approx.}}\sim N\left(0.65,0.00027\right)\]

1.5

1.6

  • the \(p\)-value is 0.009
  • the 95% confidence interval for the proportion is (0.660, 0.724).

1.7

We have carried out a one-sample test of proportion to check the claim that 65% of first-year university students regularly drink coffee. Based on our test results, we can reject this claim at the 5% level of significance (\(p = 0.009\), also supported by our 95% confidence interval (0.660, 0.724)), and conclude that the proportion of first-year university students who regularly drink coffee is statistically significantly different from 65%.

2 Two-sample Test of Proportions

2.1

We have \(\widehat{p}_1 = \widehat{p} \approx 0.693\), and \(\widehat{p}_2 = \displaystyle \frac{302}{414} \approx 0.729\).

2.2

We have \(H_0: p_1 = p_2\), versus \(H_1: p_1 \neq p_2\).

2.3

Note that it may be helpful to use the following notation when answering this question:

  • \(x_1 = 582\) and \(x_2 = 302\)
  • \(n_1 = 840\) and \(n_2 = 414\)

To check the assumptions, we note that, since we don’t know \(p_1\) and \(p_2\), we instead use \(\widehat{p}_1\) and \(\widehat{p}_2\) respectively. Hence, we check:

  • \(n_1 \times \widehat{p}_1 = 840 \times 0.693 = 582 > 5\),
  • \(n_2 \times \widehat{p}_2 = 414 \times 0.729 = 302 > 5\),
  • \(n_1 \times (1 - \widehat{p}_1) = 840 \times 0.307 \approx 258 > 5\),
  • \(n_2 \times (1 - \widehat{p}_2) = 414 \times 0.271 \approx 112 > 5\).

So the conditions for the test are all satisfied.

2.4

Example R output is provided below:

## 
##  2-sample test for equality of proportions with continuity correction
## 
## data:  c(582, 302) out of c(840, 414)
## X-squared = 1.6154, df = 1, p-value = 0.2037
## alternative hypothesis: two.sided
## 95 percent confidence interval:
##  -0.09137036  0.01814745
## sample estimates:
##    prop 1    prop 2 
## 0.6928571 0.7294686

2.5

The test statistic value is 1.6154, and the corresponding \(p\)-value is 0.2037. Based on this information, we cannot reject \(H_0\). We also note that the 95% confidence interval for the difference in proportions is (-0.0914, 0.0181). This provides further evidence to support not rejecting \(H_0\), since the interval contains the value 0.

In conclusion, we have carried out a two-sample test of proportions to check if the proportion of first-year university students who regularly drink coffee differs significantly from the proportion of final-year university students who regularly drink coffee. Based on the results of our test, we cannot reject our null hypothesis that these proportions are the same (\(p\)-value 0.2037, also supported by our 95% confidence interval (-0.0914, 0.0181)). While a higher percentage of the final-year students who were surveyed drank coffee regularly, the difference was not found to be statistically significant.


That’s everything! If there were any parts you were unsure about, take a look back over the relevant sections of the Topic 9 material.


References


These notes have been prepared by Amanda Shaker and Rupert Kuveke. The copyright for the material in these notes resides with the authors named above, with the Department of Mathematical and Physical Sciences and with La Trobe University. Copyright in this work is vested in La Trobe University including all La Trobe University branding and naming. Unless otherwise stated, material within this work is licensed under a Creative Commons Attribution-Non Commercial-Non Derivatives License BY-NC-ND.