The one-sample z-test formula
This calculator runs a one-sample z-test, the standard procedure for deciding whether a sample mean is consistent with a hypothesized population mean when the population standard deviation is known. The test statistic is:
z = (x̄ − μ₀) / (σ / √n)
Here x̄ is the observed sample mean, μ₀ is the value claimed by the null hypothesis (H₀: μ = μ₀), σ is the known population standard deviation, and n is the sample size. The denominator σ / √n is the standard error of the mean — the standard deviation of the sampling distribution of x̄. The z-statistic simply counts how many standard errors separate your sample mean from the hypothesized mean.
Turning z into a p-value
Because the sampling distribution of x̄ is normal (either because the population is normal, or by the Central Limit Theorem when n is large), the standardized statistic z follows the standard normal distribution N(0, 1) under H₀. The p-value is read off that distribution using Φ, the standard normal cumulative distribution function:
- Two-tailed (Hₐ: μ ≠ μ₀): p = 2 · [1 − Φ(|z|)]
- Right-tailed (Hₐ: μ > μ₀): p = 1 − Φ(z)
- Left-tailed (Hₐ: μ < μ₀): p = Φ(z)
You reject the null hypothesis when p < α, where α is your chosen significance level (the tolerated probability of a false positive, or Type I error).
Critical values you should recognize
Equivalently, you can compare |z| against a critical value. For a two-tailed test the standard critical values are 1.645 (α = 0.10), 1.960 (α = 0.05), and 2.576 (α = 0.01). For a one-tailed test they are 1.282, 1.645, and 2.326 respectively. If |z| exceeds the critical value, the result is significant — the same conclusion the p-value gives.
A worked example
Suppose a standardized test has a known σ = 15. A class of n = 36 students scores a mean of x̄ = 103, and you want to know whether that beats the national average μ₀ = 100. The standard error is 15 / √36 = 15 / 6 = 2.5, so z = (103 − 100) / 2.5 = 1.20. A two-tailed p-value is 2 · [1 − Φ(1.20)] ≈ 2 · (1 − 0.8849) ≈ 0.230. Since 0.230 > 0.05, you fail to reject H₀: the 3-point difference is not statistically significant with this sample.