Two-Sample z-Test — Definition, Formula & Example
A two-sample z-test is a hypothesis test that checks whether the difference between two sample means is large enough to suggest the two population means really differ. You can use it only when you know the standard deviation of each population.
Given independent random samples of sizes and from populations with known standard deviations and , the two-sample z-test evaluates (usually ). Under , the test statistic below follows the standard normal distribution exactly if both populations are normal, and approximately if both samples are large (commonly ). The p-value comes from this distribution.
Key Formula
Where:
- = Sample means of groups 1 and 2
- = Hypothesized difference under , usually 0
- = Known population standard deviations
- = Sample sizes
- = Standard error of
Worked Example
Problem: Years of data show that exam scores have population standard deviation at School A and at School B. A random sample of 50 students from School A has mean score 78. A random sample of 72 students from School B has mean score 74. At , test against .
Step 1: Compute the standard error of the difference in sample means.
Step 2: Compute the test statistic.
Step 3: Find the two-sided p-value from the standard normal distribution and compare it with .
Answer: With and , reject . The data give convincing evidence that the mean exam scores at the two schools differ.
Why It Matters
On the AP Statistics exam, choosing the correct procedure is graded directly. Real data almost never come with known values of , so you will usually use a two-sample t-test for means. The z version shows where the t-test's structure comes from. Comparisons of two proportions use a separate procedure, the two-proportion z-test.
Common Mistakes
Mistake: Using a two-sample z-test when only the sample standard deviations and are given.
Correction: Replacing with adds extra variability, so the statistic no longer follows . Use the two-sample t-test instead, which accounts for this through its degrees of freedom.
