Hypothesis Testing and p-values

The p-value is a shaded area under an assumption. Move the observation and watch the area, and the assumption, stay exactly where they were.

Hypothesis Testing and p-values

This module needs JavaScript: the numbers are computed in the page rather than recorded.

Worth knowing

The curve is the distribution of the test statistic assuming the null hypothesis is true. Everything else follows from that.
The p-value is the shaded area: the probability of a result at least this extreme, if the null held.
It is not the probability the null is true, and it is not the probability your result was a fluke.
0.05 is a convention Fisher suggested as a rule of thumb, not a property of nature.

Overview

Specify the test

A hypothesis test starts with a null hypothesis H₀ and an alternative H₁, then chooses a test statistic and a reference distribution under H₀. The p-value is the probability, assuming H₀ and the model assumptions, of observing a statistic at least as incompatible with H₀ as the one measured.

p-value = P(statistic at least as extreme as observed | H₀)

For a two-sided test of a normal mean with known standard error, the statistic is z = (x̄−μ₀)/SE; evidence in either tail contributes to the p-value. A one-sided test counts one specified direction. The direction must be chosen before inspecting results.

In this guide
  1. What a p-value cannot tell you
  2. Follow the test from question to conclusion
  3. Try this above
  4. Sources and next steps

Hypothesis Testing and P-values

A p-value measures how surprising the observed data would be if the null model were true; it is not the probability the null is true.

What a p-value cannot tell you

A small p-value is evidence against the null under the test model, not the probability that H₀ is true, the size of an effect, or its practical importance. A large p-value does not prove no effect; the data may be imprecise. Report effect estimates and uncertainty too. Multiple testing and optional stopping can make nominal p-values misleading.

See confidence intervals and Type I and Type II errors.

Follow the test from question to conclusion

Suppose a bottler claims its mean fill is 500 mL. A two-sided test may set H₀: μ=500 and H₁: μ≠500, collect a sample, and compare x̄ with 500 relative to its standard error. Under H₀ and the model assumptions, the p-value is the probability of a test statistic at least as incompatible with H₀ as the observed one. It is calculated as if the null model were true; it is not P(H₀|data).

Choose a one-sided or two-sided alternative before inspecting the results. A one-sided test asks about one prespecified direction; a two-sided test counts evidence in either direction. A threshold such as α=0.05 is a decision convention, not a boundary between important and unimportant effects. Report an effect estimate and uncertainty interval too. Checking many outcomes or repeatedly testing as data arrive can make the chance of a false alarm larger than the nominal level unless the analysis accounts for that design. See Type I and Type II errors for what the decision rule does over repeated studies.

Try this above

Move the observation farther from the null while keeping the standard error fixed, then change the sample size. Compare the p-value with the effect size.

Statistical significance and practical importance are separate. With a huge sample, a tiny difference can yield a small p-value; with a small sample, an important difference may remain uncertain. A p-value does not measure the probability that a result will replicate, either. Use an effect estimate and interval to show plausible magnitudes, and specify the analysis before looking at the data when possible. The ASA statement linked below gives a fuller account of what p-values can and cannot support.

Sources and next steps

Check yourself

0 of 3

Answer without scrolling back up.

  1. A p-value is the probability of:

  2. A study reports p = 0.4. What can you conclude?

  3. Why must the choice of one or two tails be made before seeing the data?

Cheat sheet

Hypothesis Testing and p-values

Run a hypothesis test step by step. See what the p-value actually measures and why a small one does not mean the effect is large.

MATHS · vizlearn.in/maths/hypothesis_testing_and_p_values.html

About the author

Ashish Jangra builds and maintains VizLearn. Every module here is written and the visualisation behind it hand-built, so the numbers in a readout come from the same code that draws the picture. Corrections are genuinely welcome and get priority over everything else — if a page states something wrong, or an animation misrepresents what the algorithm does, get in touch.

Teaching a course with this? Individual teachers can use it freely; for a whole department or programme, see institutional licences.