Skip to main content
Calkulon
Back to Guides
3 min read6 Steps

How to Perform a Two-Sample t-Test: Step-by-Step Guide

Learn to perform a two-sample t-test manually

Skip the math — use the calculator

Step-by-Step Instructions

1

Calculate the Means and Standard Deviations

First, calculate the mean and standard deviation of each sample using the formula: \[ ar{x} = rac{\sum x_i}{n} \]

2

Calculate the Pooled Standard Deviation

Next, calculate the pooled standard deviation using the formula: \[ s_p = \sqrt{ rac{(n_1 - 1)s_1^2 + (n_2 - 1)s_2^2}{n_1 + n_2 - 2}} \]

3

Calculate the t-Statistic

Now, calculate the t-statistic using the formula: \[ t = rac{ar{x_1} - ar{x_2}}{s_p \sqrt{ rac{1}{n_1} + rac{1}{n_2}}} \]

4

Determine the Degrees of Freedom

The degrees of freedom for the two-sample t-test is: \[ df = n_1 + n_2 - 2 \]

5

Look Up the p-Value

Using a t-distribution table or calculator, look up the p-value associated with the calculated t-statistic and degrees of freedom

6

Draw a Conclusion

Finally, compare the p-value to your chosen significance level (usually 0.05) and draw a conclusion about the significance of the difference between the means of the two samples

Introduction to the Two-Sample t-Test

The two-sample t-test is a statistical test used to determine if there is a significant difference between the means of two independent groups. In this guide, we will walk you through the steps to perform a two-sample t-test manually.

Prerequisites

Before you start, make sure you have two independent samples of data, each with a mean and a standard deviation. The samples should be normally distributed or have a large enough sample size to assume normality.

Step-by-Step Guide

Step 1: Calculate the Means and Standard Deviations

First, calculate the mean and standard deviation of each sample. The formula for the mean is: [ ar{x} = rac{\sum x_i}{n} ] where ( ar{x} ) is the mean, ( x_i ) are the individual data points, and ( n ) is the sample size.

Step 2: Calculate the Pooled Standard Deviation

Next, calculate the pooled standard deviation using the formula: [ s_p = \sqrt{ rac{(n_1 - 1)s_1^2 + (n_2 - 1)s_2^2}{n_1 + n_2 - 2}} ] where ( s_p ) is the pooled standard deviation, ( n_1 ) and ( n_2 ) are the sample sizes, and ( s_1 ) and ( s_2 ) are the standard deviations of the two samples.

Step 3: Calculate the t-Statistic

Now, calculate the t-statistic using the formula: [ t = rac{ar{x_1} - ar{x_2}}{s_p \sqrt{ rac{1}{n_1} + rac{1}{n_2}}} ] where ( t ) is the t-statistic, ( ar{x_1} ) and ( ar{x_2} ) are the means of the two samples.

Step 4: Determine the Degrees of Freedom

The degrees of freedom for the two-sample t-test is: [ df = n_1 + n_2 - 2 ]

Step 5: Look Up the p-Value

Using a t-distribution table or calculator, look up the p-value associated with the calculated t-statistic and degrees of freedom.

Step 6: Draw a Conclusion

Finally, compare the p-value to your chosen significance level (usually 0.05). If the p-value is less than the significance level, you reject the null hypothesis and conclude that there is a significant difference between the means of the two samples.

Worked Example

Suppose we have two samples: Sample 1: 23, 21, 19, 24, 20 (mean = 21.4, standard deviation = 1.67, n = 5) Sample 2: 25, 22, 26, 23, 24 (mean = 24, standard deviation = 1.58, n = 5)

Using the formulas above, we calculate: [ s_p = \sqrt{ rac{(5 - 1)1.67^2 + (5 - 1)1.58^2}{5 + 5 - 2}} = \sqrt{ rac{4(2.79 + 2.49)}{8}} = \sqrt{ rac{4(5.28)}{8}} = \sqrt{2.64} = 1.62 ] [ t = rac{21.4 - 24}{1.62 \sqrt{ rac{1}{5} + rac{1}{5}}} = rac{-2.6}{1.62 \sqrt{0.4}} = rac{-2.6}{1.62 imes 0.6325} = rac{-2.6}{1.025} = -2.54 ] [ df = 5 + 5 - 2 = 8 ]

Looking up the p-value in a t-distribution table or using a calculator, we find that the p-value is approximately 0.03.

Since the p-value is less than our chosen significance level of 0.05, we reject the null hypothesis and conclude that there is a significant difference between the means of the two samples.

Common Mistakes to Avoid

  • Forgetting to calculate the pooled standard deviation
  • Using the wrong degrees of freedom
  • Looking up the wrong t-distribution table
  • Failing to check for normality of the data

When to Use a Calculator

While it is possible to perform a two-sample t-test manually, it is often more convenient to use a calculator or statistical software to perform the calculations and look up the p-value. This can save time and reduce the chance of error.

Ready to Calculate?

Skip the manual work and get instant results.

Open Calculator

Settings

PrivacyTermsAbout© 2026 Calkulon