7  Repeated Sample t-test

In the last chapter, we assumed the two groups were independent. That is, each bag of chips was independent of the other. However, sometimes we are interested in change over time or measuring the a similar variables within individuals. While many of the steps we took in the last chapter remain the same (if you skipped it, please go back!), there are some important differences.

7.1 Creatine and Muscles

You have a theory that exercise converts adenosine triphosphate (ATP) into adenosine diphosphate (ADP). When we ingest creatine phosphate, we convert ADP back into ATP and can exercise for longer. Imagine you are interested in the impact of a new type of creatine on how much weight someone can lift. You hypothesise that individuals will lift a different amount after ingesting creatine regularly for one month. Formally, we might consider the hypothesis:

\(H0: \mu_{d} = 0\) where d represent the difference in scores within a pair \(H1: \mu_{d} \neq 0\)

You decide to recruit 10 individuals from the local gym, measure how much they can bench press. Then, you give them 5g each day for one month and then re-measure their bench press strength. This pre-post design results in the following data:

kable(creatine) %>% 
  kable_material()
ID Bench1 Bench2
1 137 147
2 180 177
3 169 187
4 155 174
5 172 186
6 170 167
7 154 175
8 144 155
9 172 199
10 160 155

The t-statistic is: \(t = \frac{\Delta{\overline{x}_i}}{se_{diff}}\)

Our next step is to compute the difference scores. Note that higher difference scores reflect lifing more at T2, after ingesting the creatine:

kbl(creatine) %>% 
  kable_material()
ID Bench1 Bench2 Difference
1 137 147 10
2 180 177 -3
3 169 187 18
4 155 174 19
5 172 186 14
6 170 167 -3
7 154 175 21
8 144 155 11
9 172 199 27
10 160 155 -5

Our difference scores are simply one score subtract the other:

\(diff = \Delta{x_i} = x_{i1}-x_{i2}\)

The mean of our differences scores above is \(\overline{x}_{diff} =\) 10.9.

We can calculate the standard error of our differences scores in a similar way as the last chapter:

\(se_d = \frac{\sum(d_i-\overline{x}_{diff})^2\frac{1}{N}}{\sqrt{n}}\)

Calculating our squared difference scores, we get:

creatine %>% 
  select(ID, Difference, square_diff) %>% 
  kable() %>% 
  kable_styling(full_width = F)
ID Difference square_diff
1 10 0.81
2 -3 193.21
3 18 50.41
4 19 65.61
5 14 9.61
6 -3 193.21
7 21 102.01
8 11 0.01
9 27 259.21
10 -5 252.81

and the resulting sum of the squared differences is 1126.9. The sd of the difference scores is 11.1897771. Therefore:

\(se_{diff} = \frac{\sqrt{1126.9\frac{1}{10-1}}}{\sqrt{10}}=3.5385\)

and:

\(t = \frac{10.9}{3.5385}= 3.08\)

We can check our results with a formal analysis in R. We would need to specify the argument paired = TRUE.

t.test(data=creatine_long, Weight~Time, paired=T)

    Paired t-test

data:  Weight by Time
t = -3.0804, df = 9, p-value = 0.01313
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 -18.904684  -2.895316
sample estimates:
mean of the differences 
                  -10.9 

Thus, we would conclude that our data regarding changes in bench press weight lifted is unlikely given a true null hypothesis, t = 3.08, p = 013.

7.2 Practice Problem

Practice Problem: You are a researchers for Clearly Contact Lenses. You are asked to determine if their contacts improve the confidence of their users. You recruit 8 glasses wearers and measure their confidence. Then, clearly provide the glasses wearers contact lenses. After one month of wearing contacts, you re-assess the individuals’ confidence rating. The following data are obtained:

ID Glasses Contacts
1 52 52
2 46 52
3 59 60
4 68 64
5 60 59
6 61 63
7 47 42
8 60 61

Paired sample t-tests have more statistical power when compared to independent samples t-test, given the same number of observations.

7.3 Conclusion

Test Used for Hypothesis Formula
independent t-test Testing if two group means are the same \(H0: \mu_1 = \mu_2\) \(t = \frac{\bar{x_1} - \bar{x_2}} {\sqrt{\frac{s^2_p}{n_1}+\frac{s^2_p}{n_2}}}\)
paired t-test Testing changes in mean score \(H0: \mu_{diff}=0\) \(t = \frac{\Delta{x_i}}{se_{diff}}\)