# What is T-test? | Definition, Calculation, Formula and Examples

A T-test is a statistical tool that is used for hypothesis testing to compare the mean of two sets of observed data and find out the rate of difference between them.

It falls within the ambit of inferential statistics, the branch that is concerned with making predictions and generalisations regarding a given population by picking up a sample of that population.

Unlike in Z-test, the sample size in a T-test should be less than 30, and the standard deviation should be unknown.

## Origin of T-test

A T-test was conducted for the first time by William Sealy Gosset, an English statistician, chemist and brewer. While working for a brewing company called Guinness, he applied the t-test to observe the consistent character of the stout.

Eventually, this test was upgraded with its current connotation referring to any hypothesis test whose data variables follows a t-distribution (a bell-shaped curve with weighty tails) if the null hypothesis proves to be accurate.

## When can a T-test be conducted?

A T-test has to adhere to the following conditions for a standard interpretation and validation.

1. The sets of observed data should not be more than two.
2. The data should be sampled randomly.
3. The sample size must not be more than 30.
4. The data variables must be independent.
5. The data variables must reflect an approximately normal distribution.
6. The variance needs to be unknown and homogenous.
7. The outcome of the scale of measurement applied to the collected data must follow a continuous line.

## Which kind of T-test is most suitable?

The choice of a type of T-test will primarily depend on two things:

1. Whether the collected data sets belong to the same population or two different populations.
2. The intention of the conductor of the test to examine the difference in a particular direction.

Based on the nature of the sample population, a T-test may be classified into three types.

1. One Sample T-test: It entails comparing the mean of a single data set with a known mean or standard value.
2. Paired Sample T-test: It involves comparing the mean of a single set of observed data at different intervals, say, before and after an experiment.
3. Independent Samples T-test: Also known as Two-Samples T-test, it entails comparing two different sets of observed data and their averages.

Based on the test conductor’s intention to examine the difference in a particular direction, a T-test may be classified into the following two types.

1. One-tailed T-test: It is used to find out whether a population average is less or greater than the other population mean.
2. Two-tailed T-test: It is used to find out whether there is a difference between two sets of data or not.

## How to conduct a T-test?

A T-test measures the real difference between the means of two sample groups by employing the ratio of the difference in sample group means over the pooled standard error of both sample groups.

The following formula can be used to run a two-sample or student’s t-test:

Here,

• t = value of the T-test
• x1 and x2 = Means of the two sample groups
• s2 = Pooled Standard Error of the two sample groups
• n1 and n2 = Number of Observations in each sample group

To find out if the computed t-value is more than that of the t-value expected by chance, one has to employ a critical value chart and compare the calculated t-value with the critical t-value.

If the computed t-value is indeed higher, it implies that the null hypothesis is rejected. Accordingly, one can conclude that the sample groups are indeed different.

## What is t-score?

A t-score or t-value is a number that represents the extent of difference between the averages of two sets of observed data.

A higher t-score implies that the sample groups are different. In contrast, a smaller t-score means that there are similarities between the sample groups.

The following are some notable advantages of the T-test:

1. It is one of the most straightforward and versatile tools for comparing two sets of data.
2. The output of the independent variables is easy to interpret.
3. It requires a small sample size. Consequently, data collection is relatively more comfortable under a t-test.
4. It is used for finding out whether two sets of sample data belong to the same population or not. Consequently, it helps in obtaining the source of data.