# Chapter 2 The paired $$t$$-test

The paired $$t$$-test can be used when we have the same set of subjects in each sample, and for each subject we have two measurements of the same characteristic. For example, if we had a group of 20 students who each took a memory test before drinking and after drinking, and we wanted to know if there was a significant difference i nthe before and after results, we could carry out a paired $$t$$-test.

To further illustrate, we will consider a data set called anorexia , which is freely available in the R package called MASS. The data set consists of weight change data for 72 anorexia patients who have undergone treatment. The weight of each patient in lbs, before and after treatment, has been measured.

Suppose we want to know whether the average difference in the before and after weights was statistically significant. To find out, we could carry out a paired $$t$$-test with the following hypotheses:

$H_0:\mu_D = 0\;\;\text{versus}\;\;H_1:\mu_D \neq 0,$

where:

• $$\mu_D$$ is defined as the true (population) mean difference between before and after weights.

What does it mean to have two dependent groups, as we need to have to carry out a paired $$t$$-test? One way of thinking of it would be that all individuals must be in both groups. Considering our example, the weights of patients were measured before and after treatment. This means that all patients are in both groups. That is, the groups are dependent, meaning these groups are appropriate for the paired $$t$$-test.

What type of variables are required for the paired $$t$$-test?

A paired $$t$$-test will always involve two variables:

1. The dependent variable, sometimes also called the response variable. This should be a numeric, continuous variable.
2. The independent variable. This should be a categorical variable with only two categories which represent before/after categories, or two different conditions.