开始使用免费开始使用

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.

本练习是课程的一部分

Practicing Statistics Interview Questions in R

查看课程

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Subset the first group
drug1 <- sleep$extra[___ == ___]

# Subset the second group
___ <- ___[sleep$group == ___]
编辑并运行代码