ML0069 Z-Test vs T-Test

When do you use a z-test versus a t-test?

Answer

Both tests compare an estimated effect with its standard error to judge whether a mean differs from a reference value. Use a z-test when the reference distribution can be treated as exactly normal: the population standard deviation \sigma is known, or the sample is large enough that the estimate of \sigma is essentially exact. Use a t-test when \sigma is estimated from a small sample: the extra estimation uncertainty fattens the tails of the test statistic, and the t-distribution with n - 1 degrees of freedom accounts for it. As n grows, the t-distribution converges to the normal, so beyond a few dozen observations the two tests give nearly identical p-values.

(1) Same Statistic, Different Reference: both divide an effect estimate by its standard error; they differ only in whether the reference distribution is the standard normal or the heavier-tailed t.
(2) When t Is Mandatory: small samples with unknown \sigma, where the t’s heavier tails keep the false positive rate at the promised \alpha. Use Welch’s variant when the two groups have unequal variances.
(3) In Practice at Scale: conversion metrics in online experiments are proportions with millions of users, so the normal (z) approximation is effectively exact; Booking.com’s experimentation write-ups fall back to the two-sample t-test when comparing means on smaller or skewed samples.

Standard normal curve overlaid with a heavy-tailed t distribution with 3 degrees of freedom, the t tails visibly higher beyond plus minus 2

Figure 1: Why the distinction exists: the t-distribution (3 degrees of freedom shown) has visibly heavier tails than the standard normal, so its critical values sit farther out. As degrees of freedom grow, the t curve collapses onto the normal and the two tests coincide.

Mathematical Formulation:
z = \frac{\bar{x} - \mu_0}{\sigma / \sqrt{n}}
t = \frac{\bar{x} - \mu_0}{s / \sqrt{n}}

Where:

  • \bar{x} is the sample mean, \mu_0 the hypothesized mean, and n the sample size.
  • \sigma is the known population standard deviation used by the z-test; s is the sample-estimated standard deviation used by the t-test.
  • The t statistic follows a t-distribution with n - 1 degrees of freedom, which approaches N(0, 1) as n grows.
FeatureZ-TestT-Test
Spread Parameter\sigma known (or n huge)s estimated from the sample
Reference DistributionStandard normalt with n - 1 degrees of freedom
Tail BehaviorThinner tails, tighter critical valuesHeavier tails at small n
Typical CaseProportion tests at scale (conversion)Small samples, heavy-tailed metrics
Large-n BehaviorAsymptotically valid for proportions via the CLTCoincides with the z-test

Login to view more content


Log in to track your progress

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *