T-Test Calculator

Compare the means of two samples using a single-sample or two-sample t-test below.

Sample:
Sample One:
Sample Two:

Results:

Two-tailed P:
 
Left-tailed P:
 
Right-tailed P:
 
Test Statistic (t):
 
Degrees of Freedom (df):
 


How to do a t-test

A t-test calculates how significant the difference between the means of two groups are. The results let you know if those differences could have occurred by chance, or rather, whether the difference is statistically significant.

A t-test uses the test statistic, sometimes called a t-value or t-score, the t-distribution values, and the degrees of freedom to calculate the statistical significance of the difference.

Types of t-tests

The first part of doing a t-test is determining which type of t-test you need to do.

There are three different types of t-tests:

  • single-sample t-test: used to compare the mean of a sample to the known mean of a population
  • two-sample t-test: used to compare the mean of two different independent samples
  • paired t-test: used to compare the mean of two different samples after an intervention or change

Calculate the t-value

The next step is to calculate the test statistic, or t-score.

Step one: gather sample statistics

The first step to find the t-score is to find the mean, standard deviation, and size for each sample.

Step two: calculate degrees of freedom

Then, you’ll need to calculate the degrees of freedom. You can use the degrees of freedom formula to find this value:

df = n1 + n2 – 2

The degrees of freedom is equal to the size of sample one n1 plus the size of sample two n2 minus 2.

Step three: calculate pooled standard deviation

The next step is to calculate the pooled standard deviation, which will be used to find the t-score.

sp = √((n1 – 1)s12 + (n2 – 1)s22 ÷ df)

The pooled standard deviation is equal to the square root of the size of sample one n1 minus 1 times the standard deviation of sample one s1 squared, plus the size of sample two n2 minus 1 times the standard deviation of sample two s2 squared, divided by the degrees of freedom.

Step four: calculate t

Finally, put it all together using the t-value formula:

t = 1 – x̄2sp × √((1 ÷ n1) + (1 ÷ n2))

Thus, the t-score t is equal to the difference of the mean of sample one 1 and the mean of sample two 2 divided by the pooled standard deviation sp times the square root of 1 divided by the size of sample one n1 plus 1 divided by the size of sample two n2.

A large t-value suggests that the samples are very different, while a small t-value suggests that they are similar.

Find the p-value

The next step is to find the p-value for the t-value. A p-value is used to determine whether to reject the null hypothesis.

Use a t-table and locate the degrees of freedom in the left-most column. Then, locate the desired p-value in the heading row, 0.05 is most commonly used for a 95% confidence level.

Then, find the intersection of the row and column to find the critical value.

If the calculated t-value is larger than the critical value, then you can reject the null hypothesis. If it is less than the critical value, then you fail to reject the null hypothesis.