WOLFRAM|DEMONSTRATIONS PROJECT

The p-Value in One-Sample Tests for the Mean

​
display
two-sided
upper-tail
lower-tail
observed test statistic (​
Z
o
or
t
o
​)
1.5
n, sample size
5
σ
unknown
known
In reporting the result of a significance test, showing the observed test statistic and its location in the null distribution along with the tail area is a helpful and frequently used graphic. This Demonstration makes it easy to construct this plot for the one-sample test for the population mean of a normal distribution. The effect of sample size, the assumption that the population variance is known or not, as well the question of using a one-sided or two-sided test may also be explored.
Let
x
be the sample mean of
n
observations in a random sample from a normal population with mean
μ
and standard deviation
σ
.
The
p
-value for testing
H
0
:μ=
μ
0
against one of the alternatives
H
a
:μ≠
μ
0
,
H
a
:μ>
μ
0
or
H
a
:μ<
μ
0
is illustrated using tests based on the test statistic
Z
0
=(
x
-μ)
σ
x
when
σ
is assumed known, and
t
o
=(
x
-μ)

σ
x
when
σ
is not known, where
σ
x
=σ
n
,

σ
x
=s
n
and
s
is the sample standard deviation.
The
p
-value for the test is shown by the shaded area. When the tail area is smaller than 5%, a red arrow is used to indicate the position of the test statistic.
The null distribution for
Z
0
and
t
0
are respectively the standard Gaussian and Student
t
on
n-1
degrees of freedom. So when
σ
is known, the slider for
n
is disabled.