2 sample T test

A farmer has two paddocks and both are infested with bugs, he wants to determine whether his insecticide is effective at treating and killing the bugs. In order for his experiment to be valid he has to have a control group and a treatment group. So he treats one paddock but leaves the other untreated. Then he randomly samples different plants in each paddock, counting how many bugs he sees on each plant he samples.

A two sample t test can be used when our data follows a normal distribution. This test looks at the mean of the distribution for two samples and allows you to determine whether there is a statistical significance between the control and treatment groups. This is more commonly used then the z-test since we don’t need to know the standard deviation of the population, rather we can just use the standard deviation for our samples.

For the t-test we also have to look at the degrees of freedom which is found by subtracting 1 from the sample size.

We can use a 1 sided or 2 sided t test.

We can use this test if we want to determine the mean time for your meal to come out at the restaurant with 5 staff on. Our research question is: Does using an insecticide reduce the number of bugs in the paddocks?

Step 1: Hypothesis

  • H0 is our null hypothesis i.e. the difference between what we observe and what we expected to observe is null and is a result of normal fluctuations.
    • The mean number of bugs in our paddocks is the same for the control and treatment group.
  • H1 is our alternative hypothesis and assumes that the differences between what we observed and what we expected is of statistical significance.
    • There is a difference in the number of bugs in our control group and our treatment group (2 sided)
    • The insecticide reduced the number of bugs in the treatment group to the control group (1 sided)

Step 2: Analyze evidence


  • The two samples are independent: i.e. treating one paddock will not result in the other being effected.
  • The spread of the two samples are the same: i.e. we expect the two populations to both have the same variation of bugs
  • We expect the number of bugs in both populations is normally distributed.

Test statistic = the (observed mean – expected mean) / (Standard deviation of population/ square root of sample size)

This image has an empty alt attribute; its file name is image-7.png

The largest the test statistic, the larger the difference between the observed and expected value hence more evidence that you should reject H0

  • So reject H0 if our tn-1 value is less then the significance level
  • Fail to reject H0 if our tn-1 value is greater then the significance level

Note: tn-1 will vary for one sided and two sided t tests.

Step 3: Conclusion

Therefore, you can chose to accept or fail to reject H0.

Note: you can never prove anything you just fail to reject it.

This is extension:

If the two groups variance in the number of bugs is different, we would have to use the Welch 2 sample T test.

If the data is not normally distributed you can use tests such as Mann-whitney-Wilcoxon test.

This lesson flows into the Paired t-test which is what we would want to use if we compared the bugs in our paddocks before and after treatment.

Leave a Reply