# t-test Hypothesis Testing for Means with Unknown Variance

In the situation where you have a sample and would like to know if the population represented by the sample has a mean different than some specification, then this is the test for you. In this case, you do not know the actual variance of the population, you just have a sample.

This test is often the second one in a textbook that describes hypothesis testing. It is a useful hypothesis test and applies in many situations as we rarely know the population variance.

# Assumptions

A good practice when applying any statistical application is to consider the related assumptions. For this test there are two assumptions involved:

- The sample is randomly selected from the population under investigation
- The population distribution is a normal distribution. Note as the sample size goes up this becomes less of a concern due to the central limit theorem. Generally, when n > 25 the difference between the z and t-tests is very small.

If either assumption is not true the results of the t-test statistic may not be informative.

# Test Setup

The null hypothesis for the t-test is

where μ_0 is specified

Next, specify the alternative hypothesis. There are three choices depending if you want to check if the mean has changed from an expected value either higher or lower (two-sided). Or, if the test is to detect a shift higher or lower (one-sided)

The alternative hypothesis for a z-test may be:

The test statistic is the calculated number of t values the sample mean y_bar indicates the population has shifted. The test statistic is

Here, s, is the sample standard deviation and n is the number of samples.

The last step for the setup is to determine the rejection region. This is the value of t that indicates the alternative hypothesis has sufficient evidence to suggest the population mean value has indeed changed.

To do this we need to specify the value α which corresponds to the risk we are willing to take that the sample indicates a shift of the mean when in fact is has not changed. We call this a Type 1 error. If we are willing to accept the risk of 1 in 40 times a random sample will result in a sample mean falling in the rejection region, we would establish…