A one‑sample z‑test asks one question: is this sample mean farther from the claimed value than sampling noise alone would plausibly push it? The whole test is a change of ruler. You know how far the sample mean is from the claim in the original units — millilitres, points, pounds per square inch — but those units cannot tell you whether the gap is big, because “big” depends entirely on how much sample means bounce around. So you re‑measure the gap in standard errors, and that re‑measured number is z. Once the gap is in standard errors, one fixed curve — the standard normal — answers the question for every study ever run. Below you can run the test end to end: draw a real sample, watch its mean form, see z land on the curve beside the critical value and the shaded p‑value, and then run the same test hundreds of times to see how often it gets the answer right.
The test statistic, on the curve
This is the sampling distribution of the test statistic if H0 were true — and because z is measured in standard errors, it is the same curve for every z‑test in the world. The dark marker is your z. The pale red region is where you agreed in advance to reject; the hatched region is every result at least as extreme as yours, whose area is the p‑value. Read the two rulers under the axis: the top row is z, the bottom row is the sample mean that produces it. Drag the marker to move your result.
rejection region — area = αat least this extreme — area = pyour test statistic z
The sample it came from
Every dot is one real observation, drawn one at a time from a population with the true mean you set on the right. The wide outline is that population — how much a single observation varies. The narrow shaded spike is where the mean of n of them lands when H0 is true, and its width is the standard error. That spike is the curve in the panel above, still wearing its original units.
one observation varies this much (σ)the mean of n varies this much (σ/√n)x̄μ0
Run the whole test, over and over
A single test either rejects or it doesn’t; you cannot tell from one run whether the procedure is any good. So run it repeatedly. Each click below draws a brand‑new sample of n observations from the same population, computes its own z, and applies the same rule. Bars in the pale red zone are the runs that rejected H0.
Tests run0
Rejected H00
Observed rate—
Exact long‑ run rate—
Four studiespick one to begin
The study on the table
Set the test up
1 · Which alternative did you commit to?
2 · How much false-alarm risk will you accept?
3 · The data
—
—
4 · The world the sample comes from
—
The test, step by step, with your numbers
Standard error—σ/√n
Test statistic z—SEs from μ₀
Critical value—
p‑value vs α—
Say it right
Seven things people say after running a z‑test. Two are correct. Tap each one.
The test in one lineMeasure the gap x̄ − μ0 in units of σ/√n, then ask how often pure sampling noise would push it that far. That is all a z‑test is.
When a z‑test is the right tool
The z‑test needs σ, and you almost never have it. Notice what the standard error formula asks for: σ, the population standard deviation — a fixed, known constant, not something computed from your sample. The four studies here each have a genuine reason to claim it: a scoring scale built to a fixed spread, a filling line with years of calibration logs, an instrument with a manufacturer’s reference database. Outside cases like those, you do not know σ, you estimate it with the sample standard deviation s — and the moment you do, the statistic stops following the normal curve and follows a t distribution instead, with heavier tails to pay for the extra thing you had to guess. Same gap, same logic, same arithmetic, wider curve. That is the next section, and in practice it is the one you will use.
Three conditions, and only one of them is optional.Random sampling is not negotiable: the standard error formula is derived from independent draws, and no sample size repairs a biased one — a large convenience sample is just a confidently wrong answer. σ known is what makes it a z‑test rather than a t‑test. Approximate normality of x̄ is the one you can buy with sample size: if the population itself is normal, x̄ is exactly normal at any n, and if it is not, the Central Limit Theorem pulls the sampling distribution of x̄ toward normal as n grows — conventionally n ≥ 30 is enough unless the population is severely skewed or has outliers. Drop n below 30 on the reaction‑time study, where the population is right‑skewed, and the condition check flags it.
Pick the tail before you look. A one‑sided test at α = 0.05 puts the whole 5% in one tail, so its critical value is 1.645 instead of 1.960 — easier to reject, but only in the direction you named. Switching to the tail your data happened to favour after seeing the data quietly doubles your real false‑alarm rate, because you gave yourself two chances and charged yourself for one. Choose the alternative from the question you set out to answer, and leave it alone.
One last thing the curve makes visible. Push n up on any study while holding x̄ where it is, and watch z stretch away from zero without the gap in the original units changing at all. The world did not move; your instrument got sharper. A z of 6 from an enormous sample can sit on a difference far too small to act on, and a z of 1 from a small sample can sit on a difference that would matter enormously if only you had the data to see it. Significance and importance are different questions, and only the first one is answered here.