## 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, let's take a look at an example. Suppose we 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, we can conclude that, on average, males are taller. Mystery solved? Not quite. Let's take a look at another example below:

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 our 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 us answer.

Everything was clear?

Course Content

Learning Statistics with Python

# Learning Statistics with Python

2. Mean, Median and Mode with Python

4. Covariance vs Correlation

## 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, let's take a look at an example. Suppose we 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, we can conclude that, on average, males are taller. Mystery solved? Not quite. Let's take a look at another example below:

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 our 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 us answer.

Everything was clear?