How to Calculate the Z Test Statistic
The z test statistic measures how far a sample result sits from the null hypothesis's claim — in standard errors, not raw units. One formula pattern covers means and proportions; the craft is in the standard error and in an honest verdict.
The pattern: z = (observed − expected under H₀) / (standard error). For a mean: z = (x̄ − μ₀) / (σ/√n). For a proportion: z = (p̂ − p₀) / √(p₀(1 − p₀)/n). Then compare with the table or convert to a p-value.
A mean, worked end to end
Claim: a filling process averages μ₀ = 500 g. A sample of n = 36 gives x̄ = 504 g; the process σ is known to be 12 g. Standard error = σ/√n = 12/6 = 2 g. Test statistic: z = (504 − 500) / 2 = 2.00. Two-tailed p-value: 2 × (1 − Φ(2.00)) = 2 × 0.0228 = 0.0456 — significant at the 0.05 level, just barely. Report it whole: the statistic, the p-value, the direction ("above the claimed mean"), and the effect in real units (4 g on a 500 g fill, 0.8%). A second example for calibration: had x̄ been 502, z = 1.00 and p = 0.3174 — nowhere near significance. The statistic's whole job is to price sampling noise before anyone celebrates a 4-gram difference.
A proportion, worked end to end
A support team claims 50% first-contact resolution (p₀ = 0.50). In n = 100 audited tickets, 58 resolved first time (p̂ = 0.58). The standard error uses the null proportion: √(0.5 × 0.5 / 100) = 0.05. z = (0.58 − 0.50) / 0.05 = 1.60, two-tailed p = 2 × (1 − 0.9452) = 0.1096 — not significant at 0.05. The two recurring errors live here: using p̂ inside the standard error (that is the confidence-interval version, a different formula), and forgetting that the null value, not the sample, anchors the test. Both are examined on the what is a z statistic post; p-values for any statistic are one step away on the z score to p value calculator.
Before you trust the number
- Known σ? The z-test assumes it. With σ estimated from a small sample, the correct statistic is a t — same skeleton, heavier-tailed table; the z table vs t table page draws the line precisely.
- Sample size and shape: the z approximation leans on the central limit theorem — n of 30+ for means in most guidance; for proportions, np₀ and n(1 − p₀) both at least 10.
- Direction chosen in advance: a one-tailed test halves the p-value, which is exactly why the choice must predate the data.
- Units check: the standard error of a mean shrinks with √n. If your SE is larger than σ, the √n went the wrong way — the commonest arithmetic slip in the whole procedure.
Also asked as: how to calculate test statistic z · how to find z test statistic · how to find the z test statistic · how to compute the test statistic z.
Related questions
Frequently asked questions
What is the standard error, in plain words?
The standard deviation of the statistic itself — how much x̄ would wobble from sample to sample if the null were true. It is the yardstick the test statistic is measured against: a 4 g gap means one thing when samples wobble by 2 g and quite another when they wobble by 20 g.
How large must z be to be significant?
At the conventional two-tailed 0.05 level, |z| ≥ 1.96; at 0.01, |z| ≥ 2.576; one-tailed 0.05 needs z ≥ 1.645 in the predicted direction. The full set is tabulated on the critical z values page.