# One sample t-test: Definition, Formula, and Examples

This tutorial provides the definition of one sample t-test, the formulas of one sample t-test, examples of manual calculation.

## Definition and examples of One sample t-test

One sample t-test is used to determine whether a mean is different from a specific value. You can calculate a mean based on a sample and compare whether the mean is different from a predetermined number.

You measure the height of a group of 100 students and want to infer all the 3000 students’ height in the same school. Then, you get the mean of these 100 students is 6 ft, and then you want to compare whether the mean if 6 ft is different from 6 ft 1 in. In this case, it is a one-sample t-test.

Mean of 100 students vs. a fixed number

You collect data of sales of 150 stores and want to infer all the stores in the country. Then, you want to test whether the average sales number in this country is higher or lower than a certain sales number. In this case, it is a one-sample t-test.

Mean of 150 stores' sales vs. a fixed number

The null and alternative hypotheses for one sample t-test are as follows.

$H_0: \bar{x} = \mu$

$H_1: \bar{x} \neq \mu$

## Formula of one sample t-test

$t=\frac{\bar{x}-\mu}{s/ \sqrt{n}}$

Where,

$$\bar{x}$$ is the sample mean

$$\mu$$ is the predetermined value to compare with

s is the sample standard deviation

n is the sample size

The degree of freedom for one sample t-test is n-1.

## Manual Calculation

In this section, we are going to do one sample t-test via manual calculation.

Suppose that you would like to see whether a group of students’ exam grade mean is significantly different from 60, a predetermined number. The following is the grades of these students.

65, 70, 75, 80, 68, 95

You can then calculate the means of these numbers.

Mean=(65+70+75+80+68+95)/ 6=75.5

We can then calculate the sample standard deviation.

$s=\sqrt{\frac{(65-75.5)^2+(70-75.5)^2+(75-75.5)^2+(80-75.5)^2+(68-75.5)^2+(95-75.5)^2}{7-1}}=10.93$

Thus, we can calculate the t statistic as follows.

$t=\frac{\bar{x}-\mu}{s/ \sqrt{n}}=\frac{75.5-60}{10.93/ \sqrt{6}}=3.47$

We can also calculate the degree freedom, and it is 6-1=5.

Thus, we can compare this t statistic with the critical value based on the t-table. The critical t value for df = 5 and p-value = 0.05 is 2.571. Thus, we can reject the null hypothesis such that the mean is not equal to 60. Further, based on the mean, we can see that the mean of 75.5 is significantly higher than 60.