student t test featured image

What is a Student T Test in Statistics ? An Overview for the Data Scientist

In order to find the z score in the Normal DIstribution, you have to know the population standard deviation. Without the value of it, you are unable to find the z score and find the relationship with between the sample deviation and population deviation. But in the real world, most of the problems you are unable to know the population standard deviation. To solve the problems like this Student T  Test distribution came to exists.

In the Student’s T distribution you select various small samples when you don’t know the population standard deviation. You use T – Table to determine the significant difference between the two sets of the data. In Z test you consider only the mean for finding the score but in the t-test, you consider sample variance.

Types of the Student T-test

One-Sample T Test

In this, you test the null hypothesis that the population mean is equal to a particular value that is based on the sample mean. For example, the sample student’s test score mean is equal to the mean of the students in the population. The formula for the one Sample T-Test is the below

one sample t test formula

How to calculate student t test for the One Sample ?

Just like in the Z score you consider the table for the lookup of the Z score, in the same way, You lookup for the T Table for finding the score. But these scored depend upon the sample size (n) and the level of significance, \alpha  ( Default is 0.05).
After that, you compare it with T – Table Score to determine the options for fail to reject or reject Hypothesis.

compare t value one sample

Independent two Sample t-test

In this t-test you test the null hypothesis that the two exclusive sample means \overline{x_{1}} and \overline{x_{2}} bar are equal.

For example, you want to check the mean test scores of the two samples of the students. It can be statistically equal or not. Note that this test is named as Independent two-sample t-test as each sample are independent of each other.
The calculation of this Sample Test is different from the One sample test and depends upon the following cases.
Equal Sample Size(n) and Equal Variance (S)
Unequal Sample Size(n) and Equal Variance(S)
Equal or Unequal Sample Size(n) and Unequal Variance (S_{1}) and (S_{2})
The third case is the most common situation
Note that when you say to compare one thing to another thing. Then it means you will find the ratio between them. In this two sample t -test you are finding the T ratio between the two samples and the formula is the below.

two independent t test in unequal mean and variance

The General formula for the degree for the freedom is

Dependent Paired Sample T-test.
It is used when the samples are dependent on each other. There can be two cases of it. One is that the one sample has been tested twice and the other is two samples are being matched or paired.
For example, you want to check the test scores that this course has improved the test scores of the same group of students before and after taking the course.

How to calculate student t test for the two independent samples ?

Suppose you have two samples Sample A and Sample B. To do T-test on the two samples.

Step 1: Compare the means of the two sample. (x_{1}) – (x_{2}). If there is a large difference then you can easily decide the best sample. But if the difference is less then you have to calculate the T-Test.

Step 2 : State the Null and Alternate Hypothesis and select the type of test and the degree of the Freedom.

Step 3: Calculate the variance of the Each of the Sample A and Sample B that is (S_{a}) and (S_{b})

Step 4 : Using All the calculated values find the T value using the following formulae.

two independent t test in unequal mean and variance

Step 5: Look for the Critical Value from the T table.

Inside the T table, you look for the type of the test, one tail or two tails, the degree of the Freedom, critical level of the significance.

Step 6: Compare the T value with the critical value.

t test for the independent two samples

Step 7: After comparing you are now statistically able to determine whether you to reject or fail to reject the Null Hypothesis.


Student T Test  is very useful when you have two large samples and their difference between mean is very small.  As it uses sample variance, you can compare them to find the best sample. You can think it as an Upgrade of the Z Score. Other things like Test type, level of significance are the same as the Z score.

Hope, you understood the Student  T distribution and How to calculate it. If you want to add something in this tutorial and want to ask something, then please contact us. You can also subscribe us and like Data Science Learner Page

Thank you For sharing.We appreciate your support. Don't Forget to LIKE and FOLLOW our SITE to keep UPDATED with Data Science Learner