# Two Sample T test

*This test is also called Independent t-test & student t-test.

What is Two Sample t-test?

It is a statistical test used to check the significant difference between only 2 unrelated groups.

Unrelated group means that if a person is a part of one group, that person can not be a part of another group. Example – Person having blood group A +ve, can not be a part of group B +ve.

There are 2 types of variables used in this test.

1. Independent – will always be a categorical variable with groups. Example – Our data set has age as a variable having only 2 groups, ‘Below 40’ & ‘Above 40’

2. Dependent – will always be a numeric variable. Example – Hours spent on studying anything.

Why do we use Two Sample t-test?

We use it to check whether there is a significant difference between only 2 groups by comparing the means of these 2 groups.
Example – We can check whether people below age 40 study more or people above age 40

If there is a significant difference, we say that we reject null hypothesis.
If there is no significant difference, we do not reject null hypothesis.

There are typically two types of hypothesis:

1. Null Hypothesis – meaning, there is no change/ everything is same.

2. Alternate Hypothesis – meaning, there is a change / there is a difference.

Determining significant value is also in the hands of clients. In this tutorial we will be using significant value as 0.05, meaning, if the results are below 0.05, we will reject null hypothesis and say there is a significant difference between the groups.

Example of Two Sample t-test:

Problem Statement: Is there a significant difference in hours given on studying between people of age above 40 and below 40?

Here, the dependent variable will be hours. Hours given on studying is our numeric variable. Independent variable will be age having 2 groups as ‘Below 40’ & ‘Above 40’.

Let’s say, after running the test, our significant value comes as 0.003, we will say there is a significant difference between hours given on studying of people having age below 40 and above 40. The significant value is below 0.05, so we reject null hypothesis.
In other words, we can say people who are below age 40 and above age 40 each give different amount of hours to study. In the test results, the mean difference will also get reflwcted and you can see which group tends to study more.

Difference between ANOVA & Two sample t-test:

In ANOVA, Analysis of Variance, we have 2 or more groups in our independent variable having only 1 numeric dependent variable.
Whereas, in Two sample t-test, we only have 2 groups in our independent variable having only 1 numeric dependent variable.