Paired test
In the previous lesson, you've worked on the sleep
dataset. The dataset contains data on the effect of two drugs on the increase in sleep hours.
In the case of this experiment, the data are pairs of measurements. The same people were tested with each of the drugs. If data contain pairs of measurements, you should use a paired test. It is worth keeping this distinction in mind during the interview.
To carry out a paired test, set the paired
parameter of the t.test()
function to TRUE
.
The dataset is available as sleep
in your environment. Recall that extra
is the increase in the number of sleep hours, and group
indicates which drug has been given.
This exercise is part of the course
Practicing Statistics Interview Questions in R
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Subset the first group
drug1 <- sleep$extra[___ == ___]
# Subset the second group
___ <- ___[sleep$group == ___]