• Home
  • How to Calculate t-Test with Examples?

How to Calculate t-Test with Examples?

The t-test is a statistical test used to compare the mean of a sample to a known value or to compare the means of two samples. It is commonly used to determine whether there is a significant difference between the means of two groups, such as in an experiment or study.

To calculate a t-test, you will need to know the mean, standard deviation, and sample size of your data. You will also need to know the hypothesized mean (if comparing to a known value) or the mean of the other sample (if comparing two samples).

Here is the formula for a one-sample t-test:

t = (x̄ – μ) / (s / √n)


  • x̄ is the sample mean
  • μ is the hypothesized mean
  • s is the sample standard deviation
  • n is the sample size

For a two-sample t-test, the formula is slightly different:

t = (x̄1 – x̄2) / √[(s1^2 / n1) + (s2^2 / n2)]


  • x̄1 and x̄2 are the means of the two samples
  • s1 and s2 are the standard deviations of the two samples
  • n1 and n2 are the sample sizes of the two samples

Once you have calculated the t-value, you can compare it to a critical value from a t-distribution table or use a software program to determine the p-value. If the p-value is below a certain threshold (usually 0.05), you can conclude that there is a significant difference between the means.

It’s important to note that the t-test assumes that the data is normally distributed and that the samples are independent. If these assumptions are not met, you may need to use a different statistical test.