# T-Test Calculator

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

## Results:

Two-tailed P: | |
---|---|

Left-tailed P: | |

Right-tailed P: | |

Test Statistic (t): | |

Degrees of Freedom (df): |

Two-tailed P: | |
---|---|

Left-tailed P: | |

Right-tailed P: | |

Test Statistic (t): | |

Degrees of Freedom (df): |

Two-tailed P: | |
---|---|

Left-tailed P: | |

Right-tailed P: | |

Test Statistic (t): | |

Degrees of Freedom (df): | |

Pooled Standard Deviation: | |

Difference of Means: | |

Standard Error of Difference: |

## 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 = n_{1} + n_{2} – 2

The degrees of freedom is equal to the size of sample one *n _{1}* plus the size of sample two

*n*minus 2.

_{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.

s_{p} = √((n_{1} – 1)s_{1}^{2} + (n_{2} – 1)s_{2}^{2} ÷ df)

The pooled standard deviation is equal to the square root of the size of sample one *n _{1}* minus 1 times the standard deviation of sample one

*s*squared, plus the size of sample two

_{1}*n*minus 1 times the standard deviation of sample two

_{2}*s*squared, divided by the degrees of freedom.

_{2}#### Step four: calculate t

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

t = x̄_{1} – x̄_{2}s_{p} × √((1 ÷ n_{1}) + (1 ÷ n_{2}))

Thus, the t-score *t* is equal to the difference of the mean of sample one x̄_{1} and the mean of sample two x̄_{2} divided by the pooled standard deviation s_{p} times the square root of 1 divided by the size of sample one n_{1} plus 1 divided by the size of sample two n_{2}.

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.