Student's T-test

This lesson covers: 

  1. How the student's t-test can be used to compare means between two datasets

Comparing means using student’s t-test

The student’s t-test is a statistical test used to determine if there is a significant difference between the mean values of a particular variable across two populations.


The conditions for using student's t-test are:

  • The data must be continuous and normally distributed.
  • The variances of the populations should be equal.
  • The samples must be independent of each other.


Note: variance is the standard deviation squared. You don't need to learn the formula, but it is:

variance =n1Σ(xxˉ)2

Conducting a t-test

Step 1 - State the null hypothesis.

This assumes there is no significant difference between the means of the datasets.


Step 2 - Calculate the t statistic using the t-test formula (this will be provided in exams).

t=(n1σ12)+(n2σ22)(xˉ1xˉ2)


Where:

  • xˉ1= mean of the first dataset
  • xˉ2= mean of the second dataset
  • σ1= standard deviation of the first dataset
  • σ2= standard deviation of the second dataset
  • n1= sample size of the first dataset
  • n2= sample size of the second dataset


Step 3 - Calculate the degrees of freedom.

degrees of freedom (df) in a t−test = n1+n22


Step 4 - Compare the calculated t statistic against a critical value.

The critical value is determined by the degrees of freedom and the chosen significance level (usually p = 0.05). You will be provided with a table of critical values in an exam.


If the t statistic is greater than the critical value:

  • Reject the null hypothesis.
  • This suggests that the means are significantly different.


If the t statistic is less than the critical value:

  • Accept the null hypothesis.
  • This suggests that there is no significant difference between the means, and any difference is just due to chance.

Worked example - Comparison of turtle egg hatch rates using student's t-test

Given the following data, use the student's t-test to determine if there is a significant difference between the mean number of turtle eggs hatched in high and low temperature conditions.

DatasetMean (number of eggs)SD (number of eggs)Sample size (n)
High temperature80515
Low temperature70515

Step 1: Equation

t=(n1σ12)+(n2σ22)(xˉ1xˉ2)


Step 2: Substitution and correct evaluation

t=(1552)+(1552)(8070)

t=(1525)+(1525)(10)

t=1.66...+1.66...10

t=3.33...10

t=1.82...10

t=5.48 (to 3 s.f.)


Step 3: Calculate degrees of freedom (df)

df in a t−test = n1+n22

df=(15+15)2=28


Step 4: Determine significance

with a t value of 5.48 and df of 28, we compare this to the critical t value at a significance level of 0.05

the critical value for the t-test statistic at p = 0.05 and 28 degrees of freedom is 2.05

as our calculated t value (5.48) is greater than this critical value, we reject the null hypothesis and conclude that there is a significant difference between the hatch rates of turtle eggs in high and low temperatures