Hypothesis TestingTopic #26 of 33

Z-Test for Means

Testing population means when σ is known: one-sample and two-sample z-tests.

Overview

The z-test is used to test hypotheses about population means when the population standard deviation (σ\sigma) is known or the sample size is large.

Conditions

  1. Population σ\sigma is known (or n30n \geq 30 and use ss)
  2. Random sample
  3. Population is normal OR n30n \geq 30 (by CLT)

Test Statistic

Z=xˉμ0σ/nZ = \frac{\bar{x} - \mu_0}{\sigma/\sqrt{n}}

Where:

  • xˉ\bar{x} = sample mean
  • μ0\mu_0 = hypothesized population mean
  • σ\sigma = population standard deviation
  • nn = sample size

One-Sample Z-Test

Hypotheses

Test TypeH0H_0H1H_1
Two-tailedμ=μ0\mu = \mu_0μμ0\mu \neq \mu_0
Left-tailedμμ0\mu \geq \mu_0μ<μ0\mu < \mu_0
Right-tailedμμ0\mu \leq \mu_0μ>μ0\mu > \mu_0

Critical Values

α\alphaTwo-tailedOne-tailed
0.10±1.645\pm 1.6451.28
0.05±1.96\pm 1.961.645
0.01±2.58\pm 2.582.33

Two-Sample Z-Test

For Independent Samples

Z=(xˉ1xˉ2)(μ1μ2)0σ12n1+σ22n2Z = \frac{(\bar{x}_1 - \bar{x}_2) - (\mu_1 - \mu_2)_0}{\sqrt{\frac{\sigma_1^2}{n_1} + \frac{\sigma_2^2}{n_2}}}

Usually testing H0:μ1μ2=0H_0: \mu_1 - \mu_2 = 0

Examples

Example 1: One-Sample Two-Tailed

A factory claims mean output is 500 units. Sample: n=64n = 64, xˉ=510\bar{x} = 510, σ=40\sigma = 40. Test at α=0.05\alpha = 0.05.

H0:μ=500,H1:μ500H_0: \mu = 500, \quad H_1: \mu \neq 500 Z=51050040/64=105=2.0Z = \frac{510 - 500}{40/\sqrt{64}} = \frac{10}{5} = 2.0

Critical values: ±1.96\pm 1.96

2.0>1.96Reject H0\lvert 2.0 \rvert > 1.96 \Rightarrow \text{Reject } H_0 p-value=2×P(Z>2.0)=2×0.0228=0.0456\text{p-value} = 2 \times P(Z > 2.0) = 2 \times 0.0228 = 0.0456

Evidence supports μ500\mu \neq 500.

Example 2: One-Sample Left-Tailed

Claim: μ<100\mu < 100. Sample: n=50n = 50, xˉ=97\bar{x} = 97, σ=15\sigma = 15. Test at α=0.05\alpha = 0.05.

H0:μ100,H1:μ<100H_0: \mu \geq 100, \quad H_1: \mu < 100 Z=9710015/50=32.12=1.42Z = \frac{97 - 100}{15/\sqrt{50}} = \frac{-3}{2.12} = -1.42

Critical value: 1.645-1.645

1.42>1.645Fail to reject H0-1.42 > -1.645 \Rightarrow \text{Fail to reject } H_0

Not enough evidence that μ<100\mu < 100.

Example 3: Two-Sample Test

Compare two populations:

  • Group 1: n1=100n_1 = 100, xˉ1=75\bar{x}_1 = 75, σ1=10\sigma_1 = 10
  • Group 2: n2=100n_2 = 100, xˉ2=72\bar{x}_2 = 72, σ2=12\sigma_2 = 12

Test H0:μ1=μ2H_0: \mu_1 = \mu_2 at α=0.05\alpha = 0.05.

Z=(7572)0100100+144100=32.44=31.56=1.92Z = \frac{(75 - 72) - 0}{\sqrt{\frac{100}{100} + \frac{144}{100}}} = \frac{3}{\sqrt{2.44}} = \frac{3}{1.56} = 1.92

Critical values: ±1.96\pm 1.96

1.92<1.96Fail to reject H0\lvert 1.92 \rvert < 1.96 \Rightarrow \text{Fail to reject } H_0

No significant difference between means.

Decision Summary

Using p-value

pαReject H0p \leq \alpha \Rightarrow \text{Reject } H_0 p>αFail to reject H0p > \alpha \Rightarrow \text{Fail to reject } H_0

Using critical value

Z>zcriticalReject H0(two-tailed)\lvert Z \rvert > z_{\text{critical}} \Rightarrow \text{Reject } H_0 \quad \text{(two-tailed)} Z>zcriticalReject H0(right-tailed)Z > z_{\text{critical}} \Rightarrow \text{Reject } H_0 \quad \text{(right-tailed)} Z<zcriticalReject H0(left-tailed)Z < -z_{\text{critical}} \Rightarrow \text{Reject } H_0 \quad \text{(left-tailed)}

When to Use Z vs T

SituationUse
σ\sigma knownZ-test
σ\sigma unknown, n30n \geq 30Z or T (similar results)
σ\sigma unknown, n<30n < 30T-test