CHAPTER 04 · TOPIC 01
Z Tests
Develop one- and two-sample Z tests, confidence intervals, Type I and II errors, power, and sample-size calculations from the same standardized framework.
On this page
- Distinguishing an Individual Z Score from a Z Statistic for a Mean
- Why the Z Test Is Valid
- Z-test conditions
- Hypotheses and Decision for a One-Sample Mean
- Z-test for independent two-sample means
- Confidence Interval: Solve the Same Standardized Equation for μ
- Overlapping the H₀ and H₁ Distributions
- Determine the Right-Tailed Critical Point from α under H₀
- β for a Right-Tailed Test: View the Same Critical Point under H₁
- Sample Size: Control α While Maintaining Power
- How the Formula Determines Sample Size
- Deriving Power from the Same Framework
The Z-test compares the sample statistic to the population specified by the null hypothesis and measures how many standard errors the difference is. Since standardized statistics follow or approximate a standard normal distribution under H₀, critical values and p-values can be determined.
Distinguishing an Individual Z Score from a Z Statistic for a Mean#
An individual Z score indicates how many population standard deviations X is away from the population mean. In testing the mean, we treat X̄ and use its standard deviation, the standard error σ/√n, as the denominator.
| Symbol | Meaning |
| X | individual observations |
| X̄ | sample mean of n observations |
| μ | population mean |
| μ₀ | The population mean specified by H₀ |
| σ | known population standard deviation |
| n | sample size |
| σ/√n | standard error of the sample mean |
Why the Z Test Is Valid#
If the population is normally distributed, the sample mean is also normally distributed. Even if it is non-normal, it can be approximated by the central limit theorem with appropriate conditions and sufficient n.
Z-test conditions#
- The sampling distribution of the statistic is normal or can be reasonably approximated by a normal distribution.
- Random sampling and independence of observations. Paired or clustered data require methods appropriate to that dependence structure
- In the Z test of the mean, the population standard deviation σ is known. When σ is unknown and replaced by s, use a t test as a general rule.
- Even with a large sample, unknown σ does not become known.
Hypotheses and Decision for a One-Sample Mean#
| Direction | Rejection condition | p-value |
| two-sided | |Zobs| ≥ z₁₋α⁄₂ | 2P(Z≥|Zobs|) |
| right-tailed | Zobs ≥ z₁₋α | P(Z≥Zobs) |
| left-tailed | Zobs ≤ zα | P(Z≤Zobs) |
Z-test for independent two-sample means#
For two independent groups, we treat the mean difference X̄₁−X̄₂. If the population variance is known, due to independence, the variance of the mean difference is the sum of the variances of the two groups.
For a test of no difference, Δ₀=0. Since covariance cannot be ignored in matched data, we analyze the differences between each pair.
Confidence Interval: Solve the Same Standardized Equation for μ#
A two-tailed (1−α) confidence interval is obtained by solving for the unknown μ from the median area 1−α of a standard normal distribution.
In the 95% interval, z₀.₉₇₅=1.96. The confidence level is the long-term proportion of intervals containing the true μ when the same procedure is repeated, not the probability that μ falls within the completed fixed interval.
Overlapping the H₀ and H₁ Distributions#
α is the area that exceeds the critical point and is falsely rejected when H₀ is true, and β is the area that cannot cross the same critical point when a certain H₁ (μ=μ₁) is true.
Determine the Right-Tailed Critical Point from α under H₀#
β for a Right-Tailed Test: View the Same Critical Point under H₁#
Sample Size: Control α While Maintaining Power#
By subtracting two equations that use the same critical point c for H₀ and H₁, c disappears and the required sample size can be found.
Round up n. This formula is for a one-sample, one-tailed, mean Z test with known σ, with z₁₋α⁄₂ for two-sided.
Supplementary example: sample size and detectable difference
In a study comparing hip ultrasound alpha angle between preterm and term infants, we planned a sample size for each group to detect a mean difference of 3° or 2°, with σ = 4.9°, two-sided α = 0.05, and a power of 80%.
| Detectable difference δ | Effect size d=δ/σ | Normal approximation | Published study |
| 3° | Approximately 0.61 | Approximately 42 hips in each group | 43 hips |
| 2° | Approximately 0.41 | Approximately 95 hips in each group | 96 hips |
Reference: Hockett C, et al. J Pediatr Orthop. 2024;44(1):e25–e29. doi:10.1097/BPO.0000000000002540.
How the Formula Determines Sample Size#
| change | necessary n | reason |
| α↓ | increase | Type 1 errors are suppressed and boundaries become stricter. |
| β↓(power↑) | increase | We need information so we don't miss the real difference. |
| σ↑ | increase | loud noise |
| |μ₁−μ₀|↑ | decrease | Big differences are easy to spot |
Deriving Power from the Same Framework#
For strict two-sided power, we add the probability that the H₁ distribution falls into both the left and right rejection regions. An increase in n or effect increases the power, and an increase in σ or a decrease in α decreases the power if other conditions are held constant.