The Z-Test › When Should You Use a Z-Test?

Michael BrenndoerferUpdated January 12, 20263 min read
Machine Learning from ScratchAll chapters
Part 2 of 9Hypothesis Testing
Chapter 14The Z-Test › When Should You Use a Z-Test?
Reading section 2 of 11 · When Should You Use a Z-Test? · 3 minSection 2 of 11 · 3 min

Book contents

Section 2 of 11 · 3 min read

The Z-Test › When Should You Use a Z-Test?One section · Sections in this chapter2 / 11 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

The z-test is appropriate in three scenarios:

Scenario 1: Known Population Standard Deviation

This is rare but does occur:

  • Calibrated measurement systems: Manufacturing processes often have extensively characterized measurement instruments where σ is known from calibration studies
  • Standardized tests: IQ tests, for example, are designed to have σ = 15 in the general population
  • Quality control: When historical data from millions of measurements establishes σ reliably

Scenario 2: Testing Proportions

This is the most common real-world use of z-tests. When testing hypotheses about population proportions, the variance is determined by the proportion itself (σ2=p(1−p)\sigma^2 = p(1-p)). You don't need to estimate it separately, so the z-test is appropriate.

Scenario 3: Very Large Samples

When sample sizes exceed 100 or so, the t-distribution converges to the normal distribution. In these cases, z-tests and t-tests give essentially identical results. However, using the t-test is never wrong even with large samples, so there's no real advantage to using z here.

Out[2]:
Visualization
Visual diagram showing known σ scenario.
Known σ: Manufacturing, quality control, standardized tests.
Visual diagram showing proportions scenario.
Proportions: A/B testing, conversion rates, survey results.
Visual diagram showing large sample scenario.
Large n (n > 100): Any context with large samples where t ≈ z.