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

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 be the sample mean of observations in a random sample from a normal population with mean and standard deviation .
The -value for testing against one of the alternatives , or is illustrated using tests based on the test statistic when is assumed known, and when is not known, where , and is the sample standard deviation.
The -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 and are respectively the standard Gaussian and Student on degrees of freedom. So when is known, the slider for is disabled.


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


Snapshot 1: versus , assumed known and based on a sample of 10 observations, so
Snapshot 2: as in Snapshot 1, but unknown and , yielding
Snapshot 3: and , and , yielding . A two-sided test is used.
Snapshot 4: As in Snapshot 3, but suppose is based on
Snapshot 5: with known variance
The two-sided test is always more conservative and for this reason many researchers discourage the use of one-sided tests [1].
[1] G. van Belle, Statistical Rules of Thumb, 2nd ed., New York: Wiley, 2008 p. 16.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2018 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+