Back to glossary
Z

Z-Test

Learn what a Z-test is, when to use it, how to calculate it, and how to interpret the result with clear examples and steps.

What is a Z-test

A Z-test is a simple statistical test. It checks if a sample comes from a population with a certain value. You use it when the sampling distribution of the statistic is approximately normal and you know the population standard deviation. It gives a Z statistic and a p-value. The p-value tells you how likely the observed result is if the null hypothesis is true.

When to use a Z-test

Use a Z-test when:

  • You are testing a sample mean and the population standard deviation is known. Or
  • You are testing a population proportion and the sample size is large enough.
  • The sample observations are independent.
  • For proportions, both np and n(1-p) should be at least about 5 to 10.

If the population standard deviation is unknown and the sample is small, use a t-test instead.

Two main types

  • Z-test for a mean. Use when you compare a sample mean to a hypothesized population mean and you know the population standard deviation.
  • Z-test for a proportion. Use when you test whether a sample proportion differs from a stated proportion.

The formulas

For a sample mean: Z = (x̄ - μ0) / (σ / sqrt(n))

Where:

  • x̄ is the sample mean
  • μ0 is the hypothesized population mean under the null
  • σ is the population standard deviation (known)
  • n is the sample size

For a sample proportion: Z = (p̂ - p0) / sqrt( p0(1 - p0) / n )

Where:

  • p̂ is the sample proportion (x / n)
  • p0 is the hypothesized population proportion
  • n is the sample size

How to run a Z-test step by step

  1. State the null hypothesis H0 and the alternative hypothesis Ha.
    • Example: H0: μ = 50. Ha: μ ≠ 50 for a two-tailed test.
  2. Choose a significance level α. Common choices are 0.05 or 0.01.
  3. Compute the Z statistic using the correct formula.
  4. Find the p-value or compare Z to a critical value from the standard normal table.
    • For two-tailed α = 0.05, the critical values are ±1.96.
    • For one-tailed α = 0.05, the critical value is 1.645 for the right tail.
  5. Decide.
    • If |Z| > critical value or p-value < α, reject H0.
    • Otherwise, fail to reject H0.

Quick reference critical values

  • Two-tailed α = 0.05: ±1.96
  • Two-tailed α = 0.01: ±2.576
  • One-tailed α = 0.05: 1.645
  • One-tailed α = 0.01: 2.33

Examples

Example 1: Test a mean

  • Hypothesis: H0: μ = 50, Ha: μ ≠ 50
  • Known σ = 10, sample n = 36, sample mean x̄ = 53
  • Z = (53 - 50) / (10 / sqrt(36)) = 3 / (10 / 6) = 3 / 1.6667 = 1.8
  • Two-tailed p-value ≈ 0.0718
  • At α = 0.05, p > 0.05 so we fail to reject H0. The sample mean is not significantly different from 50.

Example 2: Test a proportion

  • Hypothesis: H0: p = 0.50, Ha: p ≠ 0.50
  • n = 100, success x = 60, so p̂ = 0.60
  • Z = (0.60 - 0.50) / sqrt(0.50 * 0.50 / 100) = 0.10 / 0.05 = 2.0
  • Two-tailed p-value ≈ 0.0455
  • At α = 0.05, p < 0.05 so we reject H0. The proportion is significantly different from 0.5.

Interpreting results

A small p-value means the observed result is unlikely under the null hypothesis. This gives evidence against the null. It does not prove the alternative is true. It also does not measure effect size. Report both the Z statistic and the p-value. If possible, report confidence intervals as well.

Assumptions and pitfalls

  • Known σ is rare in practice. Often you estimate σ. If n is small and σ is unknown, use a t-test.
  • For means, if n is large, the central limit theorem makes the Z-test more reliable even when the original data is not normal.
  • For proportions, ensure np0 and n(1 - p0) are not too small.
  • Multiple testing inflates false positive rate. Adjust α if doing many tests.
  • Significance is not the same as practical importance. Look at the effect size.

Summary

A Z-test is a fast way to test hypotheses about means or proportions when the sampling distribution is normal and key conditions hold. It uses a Z statistic and standard normal probabilities to decide if the observed result is unlikely under the null hypothesis. Use it correctly and explain both the statistical and practical meaning of your result.

Related Terms