t-Test Formula (Table of Contents)
What is the t-Test Formula?
In statistics, the term “t-test” refers to the hypothesis test in which the test statistic follows a Student’s t-distribution. It is used to check whether two data sets are significantly different from each other or not.
One of the variants of the t-test is the one-sample t-test which is used to determine if the sample is significantly different from the population. The formula for a one-sample t-test is expressed using the observed sample mean, the theoretical population means, sample standard deviation, and sample size. Mathematically, it is represented as,
where
- x̄ = Observed Mean of the Sample
- μ = Theoretical Mean of the Population
- s = Standard Deviation of the Sample
- n = Sample Size
In case statistics of two samples are to be compared, then a two-sample t-test is to be used, and its formula is expressed using respective sample means, sample standard deviations, and sample sizes. Mathematically, it is represented as,
Where,
- x̄1 = Observed Mean of 1st Sample
- x̄2 = Observed Mean of 2nd Sample
- s1 = Standard Deviation of 1st Sample
- s2= Standard Deviation of 2nd Sample
- n 1 = Size of 1st Sample
- n 2 = Size of 2nd Sample
Examples of t-Test Formula (With Excel Template)
Let’s take an example to understand the calculation of the t-Test Formula in a better manner.
t-Test Formula – Example #1
Let us take the example of a classroom of students that appeared for a test recently. Out of the total 150 students, a sample of 10 students has been picked. If the mean score of the entire class is 78 and the mean score of sample 74 with a standard deviation of 3.5, then calculate the sample’s t-test score. Also, comment on whether the sample statistics are significantly different from the population at a 99.5% confidence interval.
Solution:
t-Test value is calculated using the formula given below
t = ( x̄ – μ) / (s / √n)
- t = (74 – 78) / (3.5 / √10)
- t = -3.61
Therefore, the sample’s absolute t-test value is 3.61, which is less than the critical value (3.69) at a 99.5% confidence interval with a degree of freedom of 9. So, the hypothesis of sample statistic different than the population can be rejected.

4.5 (8,955 ratings)
View Course
t-Test Formula – Example #2
Let us take the example of two samples to illustrate the concept of a two-sample t-test. The two samples have means of 10 and 12, standard deviations of 1.2 and 1.4, and sample sizes of 17 and 15. Determine if the sample’s statistics are different at a 99.5% confidence interval.
Solution:
t-Test value is calculated using the formula given below
t = ( x̄1 – x̄2) / √ [(s21 / n 1 ) + (s22 / n 2 )]
- t = (10 – 12) /√ [(1.22 / 17) + (1.42 / 15)]
- t = -4.31
Therefore, the absolute t-test value is 4.31, which is greater than the critical value (3.03) at a 99.5% confidence interval with a degree of freedom of 30. So, the hypothesis that the statistics of the two samples are significantly different can’t be rejected.
Explanation
The formula for one-sample t-test can be derived by using the following steps:
Step 1: Firstly, determine the observed sample mean, and the theoretical population means specified. The sample mean and population mean is denoted by and μ, respectively.
Step 2: Next, determine the standard deviation of the sample, and it is denoted by s.
Step 3: Next, determine the sample size, which is the number of data points in the sample. It is denoted by n.
Step 4: Finally, the formula for a one-sample t-test can be derived using the observed sample mean (step 1), the theoretical population means (step 1), sample standard deviation (step 2) and sample size (step 3), as shown below.
t = ( x̄ – μ) / (s / √n)
The formula for the two-sample t-test can be derived by using the following steps:
Step 1: Firstly, determine the observed sample mean of the two samples under consideration. The sample means are denoted by and.
Step 2: Next, determine the standard deviation of the two samples, which are denoted by and.
Step 3: Next, determine the size of the two samples, which are denoted by and.
Step 4: Finally, the formula for a two-sample t-test can be derived using observed sample means (step 1), sample standard deviations (step 2) and sample sizes (step 3) as shown below.
t = ( x̄1 – x̄2) / √ [(s21 / n 1 ) + (s22 / n 2 )]
Relevance and Use of t-Test Formula
It is imperative for a statistician to understand the concept of t-test as it holds significant importance while drawing conclusive evidence about whether or not two data sets have statistics that are not very different. This test is run to check the validity of a null hypothesis based on the critical value at a given confidence interval and degree of freedom. However, please note that the student’s t-test is applicable for data set with a sample size of less than 30.
t-Test Formula Calculator
You can use the following t-Test Formula Calculator
x̄ | |
μ | |
s | |
√n | |
t-Test Formula | |
t-Test Formula = | (x̄ - μ) / (s / √n) | |
(0 - 0) / (0 / 0) = | 0 |
Recommended Articles
This is a guide to the t-Test Formula. Here we discuss how to calculate t-Test along with practical examples. We also provide a t-Test Formula calculator with a downloadable excel template. You may also look at the following articles to learn more –