Two-sample t-test is a parametric test used to test the means of two different populations. We have small samples (n<30) taken by the two other distributions.

It required to know:

• Standard Deviations of the two sample: it can be different or the same in the two sample;
• Means of the two sample;
• The two sample size.

Other important assumptions for the use of t-test are:

• Data need to be independent;
• The distribution of the data need to be normal, so you need to test it;
• T-test work badly with outlier; you need to remove them;
• We need parametric variable (best if they are continuous value).

The hypothesis of this test is like this in case of the two tails test:

• H0: m1 = m2 that means that the sample1 mean and the sample2 mean are equal;
• H1m1 != m2 that means that the sample1mean and the sample2 means are different

In case of one tail left you can have for example:

• H0: m1 = m2 that means that the sample1 mean higher or equal than the sample2 mean;
• H1m1 < m2 that means that the sample1 mean are lower than the sample2 mean.

In case of one tail right you can have for example:

• H0: m1 = m2 that means that the sample1 mean higher or equal than the sample2 mean;
• H1m1 Z m2 that means that the sample1 mean are lower than the sample2 mean.

The way to do this test is similar to the one-sample t-tests. The only difference is the formula for the statistics. You have a different formula for equal o unequal variance.

Two-Sample t-test equal variance

In case of the variance o sample1 and sample2 are equal the formula is the one in image1.

where:

• m1 and m2 are the means of the two sample;
• n1 and n2 are the size of the two sample;
• Sp is the pooled standard deviation that you can calculate with the formula in the image2.

Remember that, in the T-student table for the critical value, you need to use as a degree of freedom df = n1+n2 -2

Two-Sample t-test unequal variance

In case of the variance o sample1 and sample2 are unequal the formula is the one in image3.