Two-Sample z-Tests
What you'll learn: How to test whether two population means or proportions differ significantly when you know the population standard deviations and have independent samples.
The Core Idea
A two-sample z-test extends the one-sample z-test to compare two groups. You might ask: "Do men and women have different average heights?" or "Do two drugs have different cure rates?" When you have independent random samples from both populations and know (or can assume) the population standard deviations, you use a two-sample z-test.
The key is constructing a test statistic from the difference between sample means (or proportions). Under the null hypothesis that the two population parameters are equal, this difference should be close to zero—but random variation will cause some discrepancy. The z-test quantifies whether the observed difference is too large to attribute to chance alone.
For Means
When comparing means μ₁ and μ₂ with known standard deviations σ₁ and σ₂:
Test statistic: z = (x̄₁ - x̄₂) / √(σ₁²/n₁ + σ₂²/n₂)
Under H₀: μ₁ = μ₂, this follows a standard normal distribution.
For Proportions
When comparing proportions p₁ and p₂:
Test statistic: z = (p̂₁ - p̂₂) / √[p̂(1-p̂)(1/n₁ + 1/n₂)]
where p̂ is the pooled sample proportion: p̂ = (x₁ + x₂)/(n₁ + n₂).
The Process
- State hypotheses (two-tailed: H₀: μ₁ = μ₂ vs. Hₐ: μ₁ ≠ μ₂, or one-tailed)
- Compute the test statistic
- Find the p-value using the standard normal distribution
- Compare to significance level α and make a decision
Key Takeaway: Two-sample z-tests compare two independent groups by standardizing the difference in sample statistics; when population standard deviations are known and samples are large enough, the test statistic follows a standard normal distribution under the null hypothesis.