🧮  Z-Test

Z-Test#

A hypothesis test using the normal distribution when variance is known or n is large.

Important

✨ AI-generated content. This page was written with the assistance of an AI language model and is provided as a learning aid. Despite careful review, it may still contain mistakes, omissions, or out-of-date information. Whether you are new to the topic, a team lead, or a senior practitioner, treat it as a starting point rather than an authoritative reference: read it critically and independently verify anything you act on (code, commands, figures, and factual claims) against official documentation and primary sources before relying on it.

What it is#

A z-test is a hypothesis test for whether a sample mean (or proportion) differs from a known population value, built on the standard normal distribution. It applies when the sample is large (\(n > 30\), so the CLT holds) and the population variance is known — or well approximated by a large sample.

The statistic#

For a one-sample mean,

\[z = \frac{\bar{X} - \mu}{\sigma / \sqrt{n}},\]

the gap between the sample mean \(\bar{X}\) and the hypothesised \(\mu\), measured in standard errors. There are three common forms: one-sample (mean vs population), two-sample (two independent means), and the proportion z-test.

The procedure#

State \(H_0\) (no difference) and \(H_1\); pick \(\alpha\); compute \(z\); and compare to the critical value (\(\pm 1.96\) at \(\alpha = 0.05\), two-tailed) or read off a p-value — reject when \(|z|\) exceeds it.

Examples#

With \(\mu = 100, \sigma = 15, n = 50\) and a sample mean of 105, \(z = 5 / 2.12 \approx 2.36 > 1.96\), so reject \(H_0\). For a proportion, 320 of 500 (0.64) against a hypothesised 0.60 gives \(z = 0.04 / 0.022 \approx 1.82 < 1.96\)fail to reject.

Z-test vs t-test#

The choice turns on what you know about the variance. Use a z-test when \(\sigma\) is known and the sample is large, working from the normal distribution; use a t-test when \(\sigma\) is unknown and estimated from the sample \(s\), working from the heavier-tailed Student’s t — the gap between them vanishes as \(n\) grows.


Theme: Statistical Inference & Power  ·  All terminology



See also

Source article Adapted (context, re-expressed) in our own words from: Z-Test (insightful-data-lab.com).

Tags: purpose: reference topic: terminology level: beginner