Search for probability and statistics terms on Statlect
StatLect

Hypothesis tests about the mean

by , PhD

This lecture explains how to conduct hypothesis tests about the mean of a normal distribution.

We tackle two different cases:

In each case we derive the power and the size of the test.

We conclude with two solved exercises on size and power.

Table of Contents

Known variance: the z-test

The assumptions are the same we made in the lecture on confidence intervals for the mean.

The sample

The sample is made of n independent draws from a normal distribution.

Specifically, we observe the realizations of n independent random variables X_1, ..., X_n, all having a normal distribution with:

The null hypothesis

We test the null hypothesis that the mean mu is equal to a specific value $mu _{0}$:[eq1]

The test statistic

To construct a test statistic, we use the sample mean[eq2]

The test statistic, called z-statistic, is[eq3]

A test of hypothesis based on it is called z-test.

We prove below that $Z_{n}$ has a normal distribution with zero mean and unit variance.

The critical region

The critical region is[eq4]where [eq5].

Thus, the critical values of the test are $-z$ and $z$. How they are chosen is explained below.

The decision

The null hypothesis is rejected if $Z_{n}in C$, that is, if[eq6]

Otherwise, it is not rejected.

The power function

The power function of the test is[eq7]where Z is a standard normal random variable.

The notation $QTR{rm}{P}_{mu }$ indicates that the probability of rejecting the null is computed under the alternative hypothesis that the true mean is equal to mu.

Proof

The power function can be written as[eq8]where we have defined[eq9]As demonstrated in the lecture entitled Point estimation of the mean, the sample mean Xbar_n has a normal distribution with mean mu and variance $sigma ^{2}/n$, given the assumptions we made above. If we de-mean a normal random variable and we divide it by the square root of its variance, the resulting variable (Z in this case) has a standard normal distribution.

The size of the test

When evaluated at the point $mu =mu _{0}$, the power function is equal to the probability of committing a Type I error, that is, of rejecting the null hypothesis when it is true.

This probability, called the size of the test, is equal to [eq10]where the test statistic $Z_{n}$ is a standard normal random variable.

Proof

Substite mu with $mu _{0}$ in the power function and note that $Z=Z_{n}$ when $mu =mu _{0}$.

How to choose the critical value

As usual, the critical value is chosen so as to achieve a desired size $lpha $.

In other words, we fix the size $lpha $ and then we find the critical value $z$ that solves[eq11]

We explain how to do this in the page on critical values.

Unknown variance: the t-test

This case is similar to the previous one. The only difference is that we now relax the assumption that the variance of the distribution is known.

The sample

We observe the realizations of n independent random variables X_1, ..., X_n, all having a normal distribution with

The null hypothesis

We test the null hypothesis that the mean mu is equal to a specific value $mu _{0}$:[eq12]

The test statistic

We construct the test statistic by using the sample mean[eq2]and the adjusted sample variance[eq14]

The test statistics, called t-statistic, is[eq15]

The test of hypothesis based on it is called t-test.

We prove below that $T_{n}$ has a standard Student's t distribution with $n-1 $ degrees of freedom.

The critical region

The critical region is[eq16]where [eq5].

Thus, the critical values of the test are $-z$ and $z$. How they are chosen is explained below.

The decision

We reject the null hypothesis if [eq18]

Otherwise, we do not reject it.

The power function

The power function of the test is[eq19]

where:

Proof

The power function can be written as[eq21]where we have defined[eq22]Given the assumptions made above, the sample mean Xbar_n has a normal distribution with mean mu and variance $sigma ^{2}/n$ (see Point estimation of the mean), so that the random variable[eq23]has a standard normal distribution. Furthermore, the adjusted sample variance $s_{n}^{2}$ has a Gamma distribution with parameters $n-1$ and sigma^2 (see Point estimation of the variance). It follows that[eq24]has a Gamma distribution with parameters $n-1$ and 1. If we add a constant $c$ to a standard normal distribution and we divide the sum thus obtained by the square root of a Gamma variable with parameters $n-1$ and 1, we obtain a non-central standard Student's t distribution with $n-1$ degrees of freedom and non-centrality parameter $c$. The variable $W_{n-1}$ has exactly this distribution, with parameter[eq25]

The size of the test

The size of the test is equal to [eq26]where the test statistic $T_{n}$ has a standard Student's t distribution with $n-1$ degrees of freedom.

Proof

The size of the test is obtained by evaluating the power function at the point $mu =mu _{0}$:[eq27]The statistic $T_{n}$ has a non-central standard Student's t distribution with $n-1$ degrees of freedom and non-centrality parameter equal to[eq28]When $mu =mu _{0}$, the non-centrality parameter is equal to 0 and $T_{n} $ has a standard Student's t distribution.

How to choose the critical values

As before, we choose the critical value so as to achieve a desired size $lpha $.

Therefore, the critical value $z$ needs to solve the equation[eq29]

The page on critical values explains how this equation is solved.

Solved exercises

Below you can find some exercises with explained solutions.

Exercise 1

Denote by [eq30] the distribution function of a non-central standard Student's t distribution with n degrees of freedom and non-centrality parameter equal to k.

Suppose that a statistician observes 100 independent realizations of a normal random variable.

The mean and the variance of the random variable, which the statistician does not know, are equal to 1 and 4 respectively.

Find the probability that the statistician will reject the null hypothesis that the mean is equal to zero if:

Express the probability in terms of [eq30].

Solution

The probability of rejecting the null hypothesis $mu _{0}=0$ is obtained by evaluating the power function of the test at $mu =1$:[eq32]The notation $QTR{rm}{P}_{mu }$ indicates that the probability of rejecting the null is computed under the alternative hypothesis that the true mean is equal to $mu =1$. The variable $W_{99}$ has a non-central standard Student's t distribution with $99$ degrees of freedom and non-centrality parameter[eq33]Thus, the probability of rejecting the null hypothesis is equal to[eq34]

Exercise 2

Denote by [eq35] the distribution function of a standard Student's t distribution with n degrees of freedom, and by [eq36] its inverse.

A statistician observes 100 independent realizations of a normal random variable.

She performs a t-test of the null hypothesis that the mean of the variable is equal to zero.

What critical value should she use in order to incur into a Type I error with 10% probability? Express it in terms of [eq37].

Solution

A Type I error is committed when the null hypothesis is true, but it is rejected. The probability of rejecting the null hypothesis $mu _{0}=0$ is [eq38]where $z$ is the critical value, and $W_{99}$ is a standard Student's t distribution with $99$ degrees of freedom. This probability can be expressed as[eq39]where: in step $box{A}$ we have used the fact that the density of a standard Student's t distribution is symmetric around zero. Thus, we need to set $z$ in such a way that[eq40]This is accomplished by[eq41]

How to cite

Please cite as:

Taboga, Marco (2021). "Hypothesis tests about the mean", Lectures on probability theory and mathematical statistics. Kindle Direct Publishing. Online appendix. https://www.statlect.com/fundamentals-of-statistics/hypothesis-testing-mean.

The books

Most of the learning materials found on this website are now available in a traditional textbook format.