**One-sample t-test** is a parametric test where you’re comparing the mean of a population against a given standard. It used typically to test mean on small sample size (n<30) and required to know:

- Standard Deviation of the sample
- Mean of the sample
- Sample Size
- Target or hypotized mean

Other important assumptions for the use of t-test are:

- Data need to be independent;
- The distribution of the data need to be normal, so you need to test it;
- T-test work badly with outlier; you need to remove them;
- We need parametric variable (best if they are continuous value).

The hypothesis of this sample test is like this in case of the **two tails test**:

**H**m_{0}:_{1}= m_{2}that means that the sample mean and the target mean are equal;**H**m_{1}:_{1}!= m_{2}that means that the sample mean and the target means are different

In case of **one tails left** you can have for example:

**H**m_{0}:_{1}= m_{2}that means that the sample mean is higher or equal than the target mean;**H**m_{1}:_{1}< m_{2}that means that the sample mean are lower than the target mean.

In case of **one tails right** you can have for example:

**H**m_{0}:_{1}= m_{2}that means that the sample mean is higher or equal than the target mean;**H**m_{1}:_{1}> m_{2}that means that the sample mean are lower than the target mean.

The significance level (alpha) depends by what you’re testing but typically you can use 0,05.

Then you need to collect the data of the sample and then calculate the T-Student statistics, basing on the sample, with the formula in ** image1**:

**where:**

- m1 is the mean of the sample;
- m2 is the target mean;
- n is the size of the sample;
- S is the standard deviation of the sample.

Finally, it would help determine the critical value of the t-distribution based on your value of alpha and n-1 degree of freedom. You can get this value from the T-Student table (you can easily find it on google). In the case of two-tail test you have two critical values (left and right)

Now, you can compare the value of the statistics with the critical value.

In case of two tail test you need to compare T with the two critical value:

- If T fit the two critical value range, you fail to reject
**H**_{0} - If T go out the range, you reject
**H**_{0}

**Example**

We improved our office heating system, so we want to test the average temperature in a room; we want to test if it is still near 5 or not, so we made all 4 steps for the Hypothesis test.

**S**t**ep1:**** **We formulate this hypothesis (in this case is a two tails test)

**H**m_{0}:_{1}= 5 that means that the improvements doesn’t work;**H**m_{1}:_{1}!= 5 that means that something is changed.

where m1 will be the mean of the sample.

** Step2:** We determine the significance level alpha=0,05 that is a pretty standard value

** Step3: **we collect the sample from the population, so the temperature in the room, and we get the data in

**.**

*image2***Step4:**** **we calculate the statistics; in

*you can look at all the calc made in excel (we just applied the formula in the*

**image3****):**

*image1*As you can se our **the value of our T-Statistics calculated on the sample, are 3,8**

** Step5:** Now, we need to evaluate the result. We need to get the critical value from the T-Student table to do this. Remember that we have 2-tails, df=9, and alpha = 0,025 for each tale (because we have alpha/2). The critical value is 2,26.

For the hypothesis stated in the ** step1 **for rejecting

**H**we want:

_{0}- Statistics > critical value
- Statistics < – critical value

(because in this example we are supposing a simmetrical distribution)

**In this case we have T-statistics = 3,8 > 2,26 so H0 is rejected.** The improvement to the Office heating system is working.