6 Inference for numerical data: 2 samples
6.1 Independent Vs Dependent samples
Two samples may classified either as independent or dependent (paired) groups of observations (Figure 6.1).
Independent samples
Two samples are independent (unrelated) if the measurements of one group are not related to or somehow paired or matched with the measurements of the other group.
For example, one group of participants is randomly assigned to treatment group, while a second and separate group of participants is randomly assigned to placebo group (randomized controlled trial). These two groups are independent because the individuals in the treatment group are in no way paired or matched with corresponding members in the placebo group .
Dependent samples
Two samples are dependent (paired or matched) if the measurements of one group are related to or somehow paired or matched with the measurements of the other group.
For example, two measurements that are taken at two different times from the same individuals (before-after design) are related.
6.2 Two-sample t-test (Student’s t-test)
Two sample t-test (Student’s t-test) can be used if we have two independent (unrelated) groups (e.g., males/females, treatment/non-treatment) and one quantitative variable of interest (e.g., age, weight, systolic blood pressure). For example, we may want to compare the age in males and females or the weights in two groups of children, each child being randomly allocated to receive either a dietary supplement or placebo.
6.3 Paired samples t-test
A paired t-test is used to assess whether the mean of the differences between the two related measurements, x and y, is significantly different from zero.
| x | y | d = x-y |
|---|---|---|
| \(x_{1}\) | \(y_{1}\) | \(d_{1}=x_{1}-y_{1}\) |
| \(x_{2}\) | \(y_{2}\) | \(d_{2}=x_{2}-y_{2}\) |
| \(x_{3}\) | \(y_{3}\) | \(d_{3}=x_{3}-y_{3}\) |
| . | . | . |
| \(x_{i}\) | \(y_{i}\) | \(d_{i}=x_{i}-y_{i}\) |
| . | . | . |
| \(x_{n}\) | \(y_{n}\) | \(d_{n}=x_{n}-y_{n}\) |
Because of the paired nature of the data, the two samples must be of the same size, \(n\). We have \(n\) differences \(d\), with sample mean \(\bar{d}\) and standard deviation \(s_{\bar{d}}\).



