May 16, 2024

T-Test is performed to find whether there is any significant difference in means between two groups

Hypothesis testing, an important concept in quantitative research, statistics and data analysis. T-test (also known as Student’s T-test) is one of the common tests to perform hypothesis testing. It refers to comparing the means between two groups. To exemplify, assume that the following two arrays represent the numbers of student “A” and student “B” in a four consecutive statistics score. 

student_A = [14,15,15,14]

student_B = [13,13,15,14] 

So, the average mark of student “A” is 14.5 and student “B” is 13.75. From a general perspective, it can be said that student “A” is better than student “B” in the exams since “A” s average marks are higher than B. 

But statistically, we cannot say so. What if B had a fever during exams? Or any unfortunate event that occurred with B that caused her a lower mark than “A”? That’s why hypothesis testing is necessary. T-test, a type of hypothesis testing, shows whether the mean difference of two datasets or groups are significant or not. It gives a statistical judgment of “A” really better than “B” filtering out every uncertain event that could occur with “B” in the exams. 

To do the t-test, two hypotheses are considered. 

  1. Null Hypothesis (H0) : The mean differences are not statistically significant. 
  2. Alternative Hypothesis (H1) : The mean differences are statistically significant. 

From the example, it is seen that “A” already proved his scores are better than “B”. So, now if it’s proved that their mean (average) difference in their scores is also huge (significant), then it means “B” really had no chance to do better than “A” in the exams. There was really no uncertain event that caused “B” s exams to go bad. “A” is really better than “B” in the exams. 

So, how to perform the t-test?  

It’s tough to do in pen and paper. So, statistical software (e.g. Python, R) or AI can be used. Below a Python code snippet is attached that displays how to perform t-test using Google Collaboratory. 

The program will return t-score and p-value. If p-value is less than 0.05 then we can reject the null hypothesis and accept the alternative hypothesis. That means, the mean difference in their scores is statistically significant. Otherwise, we cannot reject the null hypothesis. There is not enough evidence to say that the mean difference in the score is statistically significant. 

About The Author

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright © All rights reserved. | ChromeNews by AF themes.