Z-Test for a Sample Mean
What Is a Z-Test?
A Z-test for a sample mean is a statistical procedure that lets you determine whether the average of a sample is significantly different from a known population mean. The defining feature of this test is that you already know the population standard deviation — the measure of how spread out scores are in the entire population.
Imagine a factory that produces lightbulbs with a known average lifespan of 1,200 hours and a known population standard deviation of 100 hours. A quality control engineer tests a batch of 50 bulbs and finds their average lifespan is 1,170 hours. Is this batch genuinely worse than normal, or could the difference just be due to random variation? A Z-test can answer that question.
How Does It Work?
The Z-test works by calculating a z-statistic (sometimes called a z-score). This value tells you how many standard errors your sample mean is away from the population mean. The formula is straightforward: take the difference between your sample mean and the population mean, then divide by the standard error, which is the population standard deviation divided by the square root of your sample size.
The standard error represents how much you would expect a sample mean to fluctuate from sample to sample due to chance. A larger sample gives a smaller standard error, which means you can detect smaller differences more reliably.
The Connection to the Normal Distribution
The reason this test is called a “Z” test is that the z-statistic follows a standard normal distribution (also called the Z-distribution) — the familiar bell-shaped curve centered at zero with a standard deviation of one. Once you have calculated your z-statistic, you can look up where it falls on this distribution to find a p-value, which tells you how likely it would be to see a result at least as extreme as yours if the population mean had not actually changed.
For example, a z-statistic of 1.96 corresponds to the point where only 2.5% of the distribution lies beyond it in each tail. This is why a z-value of roughly 1.96 (or greater in absolute value) is often associated with statistical significance at the 0.05 level in a two-tailed test.
How Is It Different from a T-Test?
The Z-test and the one-sample t-test answer the same basic question — is the sample mean different from a known value? The critical difference is what you know about the population. The Z-test requires you to know the population standard deviation in advance. The t-test does not; instead, it estimates the standard deviation from the sample data itself.
Because the t-test relies on an estimate, it uses a slightly different probability distribution (the t-distribution) that has heavier tails, especially with small samples. This makes the t-test a bit more conservative. As the sample size grows, the t-distribution converges toward the standard normal distribution, and the two tests produce nearly identical results.
When Is the Z-Test Used in Practice?
In most real-world research, the population standard deviation is unknown, which is why the t-test is far more common. However, the Z-test is genuinely useful in several situations:
- Quality control and manufacturing — When a process has been running for a long time, historical data can provide a reliable population standard deviation.
- Standardized testing — Large-scale tests (like IQ tests) have well-established population parameters. A researcher could use a Z-test to check whether a particular group’s average IQ differs from the known population mean of 100 with a standard deviation of 15.
- Large samples — When your sample is very large (often cited as n > 30, though this is a rough guideline), the sample standard deviation becomes a reliable estimate of the population standard deviation, and the Z-test and t-test give virtually the same answer.
Key Assumptions
For the Z-test to be valid, several conditions should hold:
- Known population standard deviation — This is the defining requirement. If you do not know it, use a t-test instead.
- Independence — Each observation in your sample should be independent of the others. One measurement should not influence another.
- Normality or large sample — The sampling distribution of the mean should be approximately normal. This is guaranteed if the population itself is normal. Even if it is not, the Central Limit Theorem tells us that the sampling distribution will be approximately normal when the sample size is large enough (generally 30 or more).
- Random sampling — The sample should be drawn randomly from the population of interest so that the results can be generalized.
Interpreting Your Result
After calculating the z-statistic, you compare it to a critical value or examine the p-value. If the p-value is less than your chosen significance level (commonly 0.05), you reject the null hypothesis and conclude that your sample mean is significantly different from the population mean. In the lightbulb example, a significant result would suggest the batch truly has a shorter lifespan than normal, prompting further investigation into the manufacturing process.