8. Testing for Differences in Means and Proportions: Practical 8
Introduction
Objectives
Learn how to apply statistical null hypothesis testing in R to evaluate whether
- the means from two groups differ
- paired measurements from two groups differ systematically
- the proportions from two groups differ
Instruction
- Read through the text below
- Execute code-examples and compare your results with what is explained in the text
- Make the exercises
- Time: 60 minutes
In the last practicum, you tested for differences based on the mean and proportions of one sample. It is also possible to test for differences between groups. You will practice this again with the air quality dataset.
If you don't have the data from the last practicum saved in R, you can reload them with the following command
source('http://horizon.science.uva.nl/public/VVA/amsterdam_airq.R')
Create some groups of interest, as you did in the previous practicum. The groups are based on the components NO2 and PM10 and the locations 'Amsterdam-Vondelpark' and 'Amsterdam-Stadhouderskade',
# select components of interest
NO2 <- air[air$component == 'NO2',]
PM10 <- air[air$component == 'PM10',]
# divide data in 4 groups based on location and component
NO2_vp <- NO2[NO2$location == 'Amsterdam-Vondelpark',]
NO2_shk <- NO2[NO2$location == 'Amsterdam-Stadhouderskade',]
PM10_vp <- PM10[PM10$location == 'Amsterdam-Vondelpark',]
PM10_shk <- PM10[PM10$location == 'Amsterdam-Stadhouderskade',]
Unlock full access