# 6. t-tests

Often in biology, we wish to compare the means of two treatments or populations. In many cases, the distributions of values of the two populations overlap to one degree. We can use statistics to determine if those populations are different. A very useful test for such applications is the t-test (sometimes referred to as Student’s t-test after the statistician who developed the test). To introduce this test, let’s compare the heights of men and women in the United States. We can’t measure the height of every adult in the United States so we take a sample of the population and use statistics to allow us to make inferences about the whole population from a sample of that population. The null hypothesis in this case is: women and men in the United States are equally tall, on average. To test the hypothesis, we gather data from 10 men and women, chosen randomly. The heights of men and women overlap broadly although the tallest individuals are men and the shortest are women.

Student developed the t-test to allow us to assign a probability level to describe the likelihood that the null hypothesis is true. The calculation is straightforward, requiring us to calculate both the mean of each population and a measure of the variation of each mean.

Here is the formula for calculating t:

t = (X1 – X2)/(sp)((1/n1 + 1/n2)0.5

where X1 and X2 are the means of the two populations and n1 and n2 are the sample sizes of each population. Finally, sp is the pooled standard deviation. To calculate this number we first calculate the pooled variance:

sp2 = [(n1 – 1)s12 + (n2 – 1)s 22]/(n1 + n 2 -2)

where n1 and n2 are the sample sizes of the two groups, and s12 and s22 are the sample variances of the two groups. Take the square root of sp2 to calculate s2 in the equation for t. For the example above, the calculation of t gives a value of 2.791. Now we can consult a table of critical values of t, analagous to searching for the critical values of the chi-squared test. Here is a portion of a table of critical values of t:

degrees of freedom/probability |
0.10 |
0.05 |
0.01 |
0.001 |

16 | 1.746 | 2.120 | 2.921 | 4.015 |

17 | 1.740 | 2.110 | 2.898 | 3.965 |

18 | 1.734 | 2.101 | 2.878 | 3.922 |

19 | 1.729 | 2.093 | 2.861 | 3.883 |

20 | 1.725 | 2.086 | 2.845 | 3.850 |

The degrees of freedom for our example is 18 (10 samples for women + 10 samples for men – 2). If we scroll across the line for 18 degrees of freedom, we can find that our observed value of t lies between the critical values of 2.101 and 2.878. That means that the probability of finding the differences we saw between the two populations is between 0.05 and 0.01 if there was no difference in height between women and men. Because the p-value for our test is less than 0.05, we reject the null hypothesis of no difference between women’s height and men’s height and infer that men are taller than women. With this statistical test, we are able to make inferences about all humans based on a small sub-sample. That is power!