# T-test Formula

The t-test formula helps us to compare the average values of two data sets and determine if they belong to the same population or are they different. The t-score is compared with the critical value obtained from the t-table. The large t-score indicates that the groups are different and a small t-score indicates that the groups are similar.

## What Is the T-test Formula?

The t-test formula is applied to the sample population. The t-test formula depends on the mean, variance, and standard deviation of the data being compared. There are 3 types of t-tests that could be performed on the n number of samples collected.

- One-sample test,
- Independent sample t-test and
- Paired samples t-test

The critical value is obtained from the t-table looking for the degree of freedom(df = n-1) and the corresponding α value(usually 0.05 or 0.1). If the t-test obtained statistically > CV then the initial hypothesis is wrong and we conclude that the results are significantly different.

### One-Sample T-Test Formula

For comparing the mean of a population \(\overline{x}\) from n samples, with a specified theoretical mean μ, we use a one-sample t-test.

**\(t= \dfrac{\overline{x}- μ}{\dfrac{\sigma}{\sqrt{n}}}\)**

where σ/√n is the standard error

### Independent Sample T-Test

Students t-test is used to compare the mean of two groups of samples. It helps evaluate if the means of the two sets of data are statistically significantly different from each other.

**\(t = \dfrac{\overline{x_{1}}-\overline{x_{2}}}{\sqrt{(\dfrac{s_{1}^2}{n_{1}}+\dfrac{s_{2}^2}{{n_{2}}}})}\)**

where

- t = Student's t-test
- \(x_{1}\) = mean of first group
- \(x_{2}\)= mean of second group
- \(s_{1}\) = standard deviation of group 1
- \(s_{2}\) = standard deviation of group 1
- \(n_{1}\)= number of observations in group 1
- \(n_{2}\)= number of observations in group 2

### Paired Samples T-Test

Whenever two distributions of the variables are highly correlated, they could be pre and post test results from the same people. In such cases, we use the paired samples t-test.

**\(t = \dfrac{Σ(x_{1}-x_{2})}{\dfrac{s}{\sqrt{n}}}\)**

where

t = Student's t-test

\(x_{1}-x_{2}\) = Difference mean of the pairs

s= standard deviation

n = sample size

## Examples Using t-test Formula

**Example 1: Calculate a t-test for the following data of the number of times people prefer coffee or tea in five time intervals.**

Coffee | Tea |
---|---|

4 | 3 |

5 | 8 |

7 | 6 |

6 | 4 |

9 | 7 |

**Solution: let \(x_{1}\) be the sample of data that prefers coffee and \(x_{2}\) be the sample of data that prefers tea.**

**let us find the mean, variance and the SD**

\(x_{1}\) | (\(x_{1}-\overline{x_{1}})\) | (\(x_{1}-\overline{x_{1}})^2\) | \(x_{2}\) | (\(x_{2}-\overline{x_{2}})\) | (\(x_{2}-\overline{x_{2}})^2\) |

4 | -2.2 | 4.84 | 3 | -2.6 | 6.76 |

5 | -1.2 | 1.44 | 8 | 2.4 | 5.76 |

7 | 0.8 | 0.64 | 6 | 0.4 | 0.16 |

6 | -0.2 | 0.04 | 4 | -1.6 | 2.56 |

9 | 2.8 | 7.84 | 7 | 1.4 | 1.96 |

6.2 |
14.8 |
5.6 |
17.20 |

\(\overline{x_{1}}\) = 31/ 5 = 6.2

\(\overline{x_{2}}\) = 28/5 = 5.6

Σ(x_{1}-\(\overline{x_{1}}\))^{2} = 14.8

Σ(x_{2}-\(\overline{x_{2}}\))^{2}= 17.2

S_{1= }14.8/4 = 3.7

S_{2 }= 17.2/4 = 4.3

According to the t-test formula,

\(t = \dfrac{\overline{x_{1}}-\overline{x_{2}}}{\sqrt{(\dfrac{s_{1}^2}{n_{1}}+\dfrac{s_{2}^2}{{n_{2}}}})}\)

Applying the known values in the t-test formula, we get

\(t = \dfrac{6.2-5.6}{\sqrt{(\dfrac{3.7}{5}+\dfrac{4.3}{5})}}\)

\(=\dfrac{0.6}{\sqrt{1.6}}\)= 0.6/1.26 = 0.47

**t = 0.47**

**Example 2: A company wants to improve its sales. The previous sales data indicated that the average sale of 25 salesmen was $50 per transaction. After training, the recent data showed an average sale of $80 per transaction. If the standard deviation is $15, find the t-score. Has the training provided improved the sales?**

**Solution:**

\(H_{0}\)accepted hypothesis:the population mean = the claimed value⇒** **μ = μ_{0 }

\(H_{0}\)alternate hypothesis: the population mean not equal to the claimed value⇒** **μ ≠ μ_{0 }

t**-**test formula for independent test is \(t= \dfrac{m- μ}{\dfrac{s}{\sqrt{n}}}\)

Mean sale = 80, μ = 50, s= 15 and n= 25

substituting the values, we get t= (80-50)/(15/√25)

t = (30 ×5)/10 = 10

looking at the t-table we find 10 > 1.711 . (I.e. CV for α = 0.05). ∴ the accepted hypothesis is not true. Thus we conclude that the training boosted the sales.

**Example 3: A pre-test and post-test conducted during a survey to find the study hours of Patrick on weekends. Calculate the t-score and determine (for α = 0.25) if the pre-test and post-test surveys are significantly different?**

Pre-test(X) | Post-test(Y) | X-Y | (X-Y)^{2} |
---|---|---|---|

1 | 2 | -1 | 1 |

2 | 4 | -2 | 4 |

**Solution:**

According to the t-test formula, we know that \(t = \dfrac{ΣX-Y}{\dfrac{s}{\sqrt{n}}}\)

Σ(X-Y)= -3 = 3

s= Σ(X-Y)^{2}/(n-1) = 5^{2}/1 = 25

t= 3/(25/2) = 6/25 = 0.24

here degree of freedom is n-1 = 2-1 =1 and the corresponidng critical value in the t-table for α= 0.25, is 1.

t < CV.

Therefore the scores are not significantly different.

## FAQs on T-test Formula

### How Do You Calculate The T-test?

The following steps are followed to calculate the t-test.

- Get the data. Find the mean.
- Subtract the mean score from each individual score
- Square the differences.
- Add up all the squared differences.
- Find the variance and standard deviation.
- Key-in the values in the formula: \(t = \dfrac{Σx_{1}- mean}{\dfrac{s}{\sqrt{n}}}\)

### What is the Formula for Finding The Independent T-test?

Students t-test is used to compare the mean of two groups of samples.

\(t = \dfrac{\overline{x_{1}}-\overline{x_{2}}}{\sqrt{(\dfrac{s_{1}^2}{n_{1}}+\dfrac{s_{2}^2}{{n_{2}}}})}\)

where

t = Student's t-test score

\(x_{1}\) = mean of first group and \(x_{2}\)= mean of second group

\(s_{1}\) = standard deviation of group 1 and \(s_{2}\) = standard deviation of group 1

\(n_{1}\)= number of observations in group 1 and \(n_{2}\)= number of observations in group 2

### What is a One-Sample t-test?

The one-sample t-test is the statistical test used to determine whether an unknown population mean is different from a specific value. For example, comparing the mean height of the students with respect to the national average height of an adult.

### What is a T-test Formula Used For?

We use the T-test Formula to statistically determine if there is a significant difference between the means of two groups that are related in certain aspects. Examples: a gym center tests the weight loss from a few samples, a company hiring candidates is set to determine the skills of 2 candidates from two different universities at the interview, and so on.

visual curriculum