Course Content
Learning Statistics with Python
Learning Statistics with Python
What is t-test
T-test is a statistical test used to determine whether there is a significant difference between the means of two samples.
To better understand this definition, here's an example. Suppose you want to determine whether there is a significant difference between the heights of males and females.
To do this, we need two samples: one for male heights and another for female heights:
Calculating the means and plotting the histograms together gives us this:
Based on this, the conclusion is that, on average, males are taller. Mystery solved? Not quite. Another example below will help provide further insight:
These are two samples of male heights, both sampled from the same population, so they should be roughly equal. However, by chance, the second sample happened to have more tall men. We can't conclusively say that men are taller than men. The difference between these two samples is purely the result of chance.
Returning to the male/female height example:
Is the difference in means merely a result of chance, or do the samples indeed differ? This is the question that the t-test can help to answer.
Thanks for your feedback!