# 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 in the before and after results, we could carry out a paired \(t\)-test.

To further illustrate, we will consider a data set called `anorexia`

(Venables and Ripley 2002; Hand et al. 1993), 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:

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

**Your turn**

- In the anorexia example, which variable is the
variable?*dependent* - In the anorexia example, which variable is the
variable?*independent*

- Weight
- Time ('before' / 'after')

### References

*A Handbook of Small Data Sets*. Chapman & Hall.

*Modern Applied Statistics with s*. Fourth. New York: Springer. https://www.stats.ox.ac.uk/pub/MASS4/.