Challenge your conclusionLesson 21 of 30 · 6 min

What would happen without the effect?

Construct a reference distribution under a stated no-effect model.

A null hypothesis is a specific statistical claim used as a reference, such as a population mean difference of zero. A null model adds the assumptions needed to predict what data would look like under that claim.

A test statistic compresses the data into a quantity that is sensitive to the departure you care about. Here it is the mean difference. Simulate independent normal differences centred at zero, then calculate a mean for each simulated experiment.

Compare the observed statistic with this null distribution. For a two-sided test based on absolute mean difference, values at least as far from zero count as extreme. The fraction estimates a tail probability under this specified model. It is not the probability that the null hypothesis is true.

Count both extreme tails
-9-4.504.590162325488650Simulated experimentsMean difference (ms)
-9-4.504.590162325488650Simulated experimentsMean difference (ms)
  • Null-model means
  • At least as extreme
Actual seeded null-model reference: 5,000 means from independent normal differences centred at zero. Amber tails are at least as far from zero as ±5 ms. Their fraction estimates a probability under this model, not a probability the null is true.

Under a zero-mean model, must every sample mean be zero?

Write a prediction (optional)

Run the prepared example

This page puts the example in the Python editor. Select Run Python with the code unchanged.

Seeded null simulation

Editor tools
About Python ↗

Ctrl+Enter or ⌘+Enter runs the code.

What to compare

Find Fraction at least as extreme. The histogram shows differences from simulated experiments with no mean effect. Why can some simulated means lie as far from zero as −5 ms?

Published example output

The site ran the original code to produce this reference. Build environment ↗

Simulated null experiments: 5000
Fraction at least as extreme: 0.0224
A histogram of 5,000 means simulated under zero effect. Vertical lines mark the two thresholds at equal distance from zero.
Open full-size figure ↗

The simulated means vary from sample to sample even with a population mean of zero. Both tails count because this comparison uses distance from zero.

Change and run again

In the Python editor, change observed_mean = -5.0 to observed_mean = -1.0 and select Run Python. Then change noise_sd_ms from 10 to 20 and run again. Compare Fraction at least as extreme after each change. Which change moves the observed value and which spreads out the reference? Return to the Python editor

What this example supports. The noise level is treated as known in this simulation. Real tests usually estimate nuisance quantities and require their own assumptions.

Try a fresh case

A null model assumes independent observations. If your observations share session-level noise, what is the concern?

Choose an answer

Hints for this question
  1. Think about the session example.
  2. A model must represent how whole experiments vary, not just individual values.
Your notes