Does a sample come from a population with the mean you expect? A one-sample z-test answers when the population standard deviation is known, as in quality control with a long record of measurements, or in standardized scales such as IQ. This calculator computes the z statistic, the p-value for the test you choose, and the confidence interval for the mean, and tells you whether the result is significant at your α.
How the calculation works
- Standard error = σ ÷ √n
- z = (sample mean − null mean) ÷ standard error
- p-value, two-sided = 2 × (1 − Φ(|z|)), where Φ is the standard normal cumulative distribution
- p-value, right-sided = 1 − Φ(z), and left-sided = Φ(z)
- Confidence interval = sample mean ± z critical × standard error, with z critical = Φ⁻¹(1 − α/2)
The result is significant when the p-value is smaller than α.
Example
An IQ test is designed to have a mean of 100 and a standard deviation of 15. A sample of 50 students has a mean of 103. The standard error is 15 ÷ √50 = 2.12, so z = 3 ÷ 2.12 = 1.41. The two-sided p-value is 0.157, which is not significant at α = 0.05, so we cannot say the group differs from 100. The 95 % interval for the mean runs from about 98.8 to 107.2 and includes 100.
Why it matters
A difference between a sample mean and an expected value can be real, or it can be chance. The z-test puts that difference on a common scale (standard errors) and gives a probability, so that decisions about a process, a drug or a classroom are not made on gut feeling. The confidence interval adds the size of the effect, which the p-value alone cannot do.
Good to know
The z-test assumes a random sample, independent observations and either a normal population or a large sample. When the standard deviation is estimated from the sample, a t-test is more exact. A significant p-value does not prove that the effect is large or important, and a non-significant one does not prove there is no effect: look at the interval and at the sample size. Choose the type of test and α before looking at the data. This tool is for education.
Related tools
The one-sample t-test calculator handles an unknown standard deviation, the z-score calculator standardizes a single value, and the confidence interval calculator gives intervals for means and proportions.