This lecture explains how to conduct hypothesis tests about the mean of a normal distribution.
We tackle two different cases:
when we know the variance of the distribution, then we use a z-statistic to conduct the test;
when the variance is unknown, then we use the t-statistic.
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
The assumptions are the same we made in the lecture on confidence intervals for the mean.
The sample is made of
independent draws from a normal distribution.
Specifically, we observe the realizations of
independent random variables
,
...,
,
all having a normal distribution with:
unknown mean
;
known variance
.
We test the null hypothesis that
the mean
is equal to a specific value
:
To construct a test statistic, we
use the sample
mean
The test statistic, called z-statistic,
is
A test of hypothesis based on it is called z-test.
We prove below that
has a normal distribution with zero mean and unit variance.
The critical region
iswhere
.
Thus, the critical values of the test are
and
.
How they are chosen is explained below.
The null hypothesis is rejected if
,
that is,
if
Otherwise, it is not rejected.
The power function of the test
iswhere
is a standard normal random variable.
The notation
indicates
that the probability of rejecting the null is computed under the alternative
hypothesis that the true mean is equal to
.
The power function can be written
aswhere
we have
defined
As
demonstrated in the lecture entitled Point
estimation of the mean, the sample mean
has a normal distribution with mean
and variance
,
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
(
in this case) has a standard normal distribution.
When evaluated at the point
,
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
where
the test statistic
is a standard normal random variable.
Substite
with
in the power function and note that
when
.
As usual, the critical value is chosen so as to achieve a desired size
.
In other words, we fix the size
and then we find the critical value
that
solves
We explain how to do this in the page on critical values.
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.
We observe the realizations of
independent random variables
,
...,
,
all having a normal distribution with
unknown mean
;
unknown variance
.
We test the null hypothesis that the mean
is equal to a specific value
:
We construct the test statistic by using the sample
meanand
the adjusted sample
variance
The test statistics, called t-statistic,
is
The test of hypothesis based on it is called t-test.
We prove below that
has a standard Student's t distribution with
degrees of freedom.
The critical region
iswhere
.
Thus, the critical values of the test are
and
.
How they are chosen is explained below.
We reject the null hypothesis if
Otherwise, we do not reject it.
The power function of the test
is
where:
the notation
indicates
that the probability of rejecting the null is computed under the alternative
hypothesis that the true mean is equal to
;
is a non-central standard Student's t distribution with
degrees of freedom and non-centrality parameter equal
to
The power function can be written
aswhere
we have
defined
Given
the assumptions made above, the sample mean
has a normal distribution with mean
and variance
(see Point estimation of the mean), so
that the random
variable
has
a standard normal distribution. Furthermore, the adjusted sample variance
has a Gamma distribution with parameters
and
(see Point estimation of the variance).
It follows
that
has
a Gamma distribution with parameters
and
.
If we add a constant
to a standard normal distribution and we divide the sum thus obtained by the
square root of a Gamma variable with parameters
and
,
we obtain a non-central standard Student's t distribution with
degrees of freedom and non-centrality parameter
.
The variable
has exactly this distribution, with
parameter
The size of the test is equal to
where
the test statistic
has a standard Student's t distribution with
degrees of freedom.
The size of the test is obtained by
evaluating the power function at the point
:
The
statistic
has a non-central standard Student's t distribution with
degrees of freedom and non-centrality parameter equal
to
When
,
the non-centrality parameter is equal to
and
has a standard Student's t distribution.
As before, we choose the critical value so as to achieve a desired size
.
Therefore, the critical value
needs to solve the
equation
The page on critical values explains how this equation is solved.
Below you can find some exercises with explained solutions.
Denote by
the distribution function
of a non-central standard Student's t distribution with
degrees of freedom and non-centrality parameter equal to
.
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:
she runs a t-test based on the 100 observed realizations;
she sets
as the critical value.
Express the probability in terms of
.
The probability of rejecting the null
hypothesis
is obtained by evaluating the power function of the test at
:
The
notation
indicates
that the probability of rejecting the null is computed under the alternative
hypothesis that the true mean is equal to
.
The variable
has a non-central standard Student's t distribution with
degrees of freedom and non-centrality
parameter
Thus,
the probability of rejecting the null hypothesis is equal
to
Denote by
the distribution function of a standard Student's t distribution with
degrees of freedom, and by
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
.
A Type I error is committed when the null
hypothesis is true, but it is rejected. The probability of rejecting the null
hypothesis
is
where
is the critical value, and
is a standard Student's t distribution with
degrees of freedom. This probability can be expressed
as
where:
in step
we have used the fact that the density of a standard Student's t distribution
is symmetric around zero. Thus, we need to set
in such a way
that
This
is accomplished
by
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.
Most of the learning materials found on this website are now available in a traditional textbook format.