Topic 9: Hypothesis Testing for One and Two Sample Proportions


In Topic 9 we extended our coverage of hypothesis tests to include hypothesis tests of proportions. In this computer lab, we will practice carrying out hypothesis tests for both one-sample and two-sample proportions.


1 One-sample Test of Proportions

🏡 For this question, suppose we are interested in the proportion of first-year university students who drink coffee regularly. Further suppose that a recent claim in a newspaper stated that 65% of first-year university students drink coffee regularly.

In order to test this claim, we can carry out a one-sample test of proportions. Let \(p\) denote the proportion of first-year university students who drink coffee regularly. Suppose that we survey first year students at La Trobe University, and find that, out of the \(n=840\) respondents, \(x=582\) students said that they drink coffee regularly.

1.1

🏡 What is \(\widehat{p}\), our estimate of \(p\)? 💬

1.2

🏡 What are the null and alternative hypotheses for this test? 💬

1.3

🏡 Remember, just like for other hypothesis tests, it is important to check that the assumptions of this hypothesis test are satisfied, before we proceed.

Check that the one-sample test of proportions conditions are satisfied for our example. 💬

Hint: If you need a reminder, check this week’s readings

1.4

🏡 Assuming that the test conditions have been satisfied, write down the approximate distribution for our proportion. 💬

1.5

💻 The data for this example can be found in the file called coffee.csv. Download this data from the LMS, and then import it into jamovi.

After doing so, carry out a one-sample test of proportions for our hypothesis test specified in Question 1.2.

1.6

🏡 Interpret the output of the one-sample test of proportions, and note down:

  • the \(p\)-value, and 💬
  • the 95% confidence interval for the proportion. 💬

1.7

🏡 Write a short conclusion summarising this test, and state your decision regarding the hypothesis, with reference to your findings from 1.6. 💬

2 Two-sample Test of Proportions

🏡 Suppose that we would now like 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.

Suppose that following a survey of final-year students at La Trobe University, we find that, out of the \(n=414\) respondents, \(x=302\) students said that they drink coffee regularly.

2.1

🏡 Let \(p_1\) now denote the proportion of first-year university students who drink coffee regularly, and let \(p_2\) denote the proportion of final-year university students who drink coffee regularly.

Using the survey data from questions 1 and 2, calculate \(\widehat{p}_1\) and \(\widehat{p}_2\). 💬

2.2

🏡 What are the null and alternative hypotheses for this test? 💬

2.3

🏡 Check that the assumptions for the two-sample test of proportions are satisfied. 💬

Hint: If you need a reminder, check this week’s readings

2.4

🏡 It is possible to carry out a two-sample test of proportions in jamovi via contingency tables, which we will be learning more about in the next computer lab. However for now, consider the following output from R for the hypothesis test specified in 2.2:

## 
##  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

🏡 Interpret the output of the two-sample test of proportions, and write a brief conclusion summarising your findings. 💬


Well done, that’s everything for today! If you still have time, you may like to have a go at Quiz 10, which is based on the Topic 10 readings.

Before you finish up, remember to save your work (e.g. your jamovi and Word files) somewhere safe (e.g. OneDrive) so that you can access it at a later time.


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.