Learn Without Walls

Hypothesis Tests for Means

Master z-tests and t-tests for testing claims about population means

Lesson Objectives

By the end of this lesson, you will be able to:

1. Z-Test vs. T-Test: When to Use Which?

When testing hypotheses about population means, we use either a z-test or a t-test:

Test When to Use Requirements
Z-Test Population standard deviation (σ) is KNOWN • σ is known
• n ≥ 30 OR population is normal
T-Test Population standard deviation (σ) is UNKNOWN • σ is unknown (use sample s)
• n ≥ 30 OR population is normal
In Practice: We almost always use the t-test because we rarely know the true population standard deviation σ. The z-test is mostly used in textbook examples or when we have census data.

Decision Flowchart

Testing a claim about μ (population mean)?

Do we know the population standard deviation (σ)?

  • YES, σ is known → Use Z-TEST
  • NO, σ is unknown → Use T-TEST (use sample standard deviation s)

2. Z-Test for Population Mean

When to Use

Use the z-test when:

Test Statistic for Z-Test

z = (x̄ - μ₀) / (σ / √n)

Where:
x̄ = sample mean
μ₀ = hypothesized population mean (from H₀)
σ = population standard deviation
n = sample size

Critical Value Approach

Steps:

  1. State H₀ and Hₐ, choose α
  2. Calculate test statistic z
  3. Find critical value(s) from z-table based on α and test type
  4. Compare test statistic to critical value(s)
  5. Make decision and interpret
Test Type Critical Value(s) Rejection Rule
Two-tailed
(Hₐ: μ ≠ μ₀)
α = 0.05: ±1.96
α = 0.01: ±2.576
Reject H₀ if |z| > critical value
Right-tailed
(Hₐ: μ > μ₀)
α = 0.05: 1.645
α = 0.01: 2.326
Reject H₀ if z > critical value
Left-tailed
(Hₐ: μ < μ₀)
α = 0.05: -1.645
α = 0.01: -2.326
Reject H₀ if z < critical value

Example 1: Z-Test (Two-Tailed)

Problem: A manufacturer claims light bulbs have a mean lifespan of 1000 hours. A consumer group tests 50 bulbs and finds x̄ = 980 hours. The population standard deviation is known to be σ = 60 hours. Test at α = 0.05.

Step 1: State hypotheses

  • H₀: μ = 1000 (manufacturer's claim is correct)
  • Hₐ: μ ≠ 1000 (claim is incorrect) — two-tailed test
  • α = 0.05

Step 2: Calculate test statistic

z = (x̄ - μ₀) / (σ / √n)
z = (980 - 1000) / (60 / √50)
z = -20 / 8.49
z = -2.36

Step 3: Find critical value

Two-tailed test, α = 0.05 → critical values = ±1.96

Step 4: Make decision

|z| = 2.36 > 1.96, so z is in the critical region

Decision: Reject H₀

Step 5: Conclusion

There is sufficient evidence at the 0.05 significance level to reject the manufacturer's claim that the mean lifespan is 1000 hours. The bulbs appear to have a shorter lifespan than claimed.

P-Value Approach

Definition: P-Value

The p-value is the probability of obtaining a test statistic as extreme as (or more extreme than) the one calculated, assuming the null hypothesis is true.

Decision Rule:

Interpreting P-Values:
  • p < 0.01: Very strong evidence against H₀
  • 0.01 ≤ p < 0.05: Strong evidence against H₀
  • 0.05 ≤ p < 0.10: Weak evidence against H₀
  • p ≥ 0.10: Little or no evidence against H₀

Example 2: P-Value Approach (Right-Tailed)

Problem: A gym claims their program increases vertical jump by more than 5 inches. Test 40 participants: x̄ = 6.2 inches, σ = 2.5 inches. Use α = 0.05.

Step 1: State hypotheses

  • H₀: μ = 5 (no more than 5-inch increase)
  • Hₐ: μ > 5 (more than 5-inch increase) — right-tailed
  • α = 0.05

Step 2: Calculate test statistic

z = (6.2 - 5) / (2.5 / √40)
z = 1.2 / 0.395
z = 3.04

Step 3: Find p-value

For right-tailed test: p-value = P(Z > 3.04)

From z-table: P(Z < 3.04) = 0.9988

p-value = 1 - 0.9988 = 0.0012

Step 4: Make decision

p-value (0.0012) < α (0.05)

Decision: Reject H₀

Step 5: Conclusion

There is very strong evidence (p = 0.0012) that the gym's program increases vertical jump by more than 5 inches.

3. T-Test for Population Mean

When to Use

Use the t-test when:

Test Statistic for T-Test

t = (x̄ - μ₀) / (s / √n)

Where:
x̄ = sample mean
μ₀ = hypothesized population mean (from H₀)
s = sample standard deviation
n = sample size
Degrees of freedom: df = n - 1

Key Difference from Z-Test:
  • We use sample standard deviation s instead of σ
  • We use the t-distribution instead of standard normal distribution
  • Critical values depend on degrees of freedom (df = n - 1)
  • The t-distribution has heavier tails than normal distribution (more conservative)

Finding Critical Values for T-Test

Critical values come from the t-distribution table using:

Example 3: T-Test (Left-Tailed)

Problem: A weight-loss program claims participants lose 10 pounds on average. A study of 25 participants shows x̄ = 8.2 pounds, s = 3.5 pounds. Test if weight loss is less than claimed (α = 0.05).

Step 1: State hypotheses

  • H₀: μ = 10 (weight loss is 10 pounds as claimed)
  • Hₐ: μ < 10 (weight loss is less than 10 pounds) — left-tailed
  • α = 0.05

Step 2: Calculate test statistic

t = (x̄ - μ₀) / (s / √n)
t = (8.2 - 10) / (3.5 / √25)
t = -1.8 / 0.7
t = -2.57

Step 3: Find critical value

df = n - 1 = 25 - 1 = 24

Left-tailed test, α = 0.05, df = 24 → critical value = -1.711 (from t-table)

Step 4: Make decision

t = -2.57 < -1.711, so t is in the critical region

Decision: Reject H₀

Step 5: Conclusion

There is sufficient evidence at the 0.05 significance level that the average weight loss is less than the claimed 10 pounds. The program appears to be less effective than advertised.

Example 4: T-Test (Two-Tailed) with P-Value

Problem: A coffee shop claims the average wait time is 5 minutes. A customer times 30 visits: x̄ = 5.8 minutes, s = 1.5 minutes. Test at α = 0.01.

Step 1: State hypotheses

  • H₀: μ = 5 (wait time is 5 minutes)
  • Hₐ: μ ≠ 5 (wait time differs from 5 minutes) — two-tailed
  • α = 0.01

Step 2: Calculate test statistic

t = (5.8 - 5) / (1.5 / √30)
t = 0.8 / 0.274
t = 2.92

Step 3: Find critical value and p-value

df = 30 - 1 = 29

Two-tailed test, α = 0.01, df = 29 → critical values = ±2.756

For t = 2.92, df = 29: p-value ≈ 0.007 (from t-table or calculator)

Step 4: Make decision

Critical value approach: |t| = 2.92 > 2.756 → Reject H₀

P-value approach: p-value (0.007) < α (0.01) → Reject H₀

Step 5: Conclusion

There is strong evidence (p = 0.007) that the average wait time is different from the claimed 5 minutes. The actual average appears to be higher.

Check Your Understanding

Question 1: A researcher wants to test if the mean salary in a profession is $50,000. Should they use a z-test or t-test? Why?

Answer: Use a t-test.

Reasoning: In real-world scenarios, we almost never know the true population standard deviation (σ) for salaries. We would only have the sample standard deviation (s) from our study, so we must use the t-test.

Question 2: Calculate the test statistic: n = 36, x̄ = 102, μ₀ = 100, s = 12. Is this a z-test or t-test?

This is a t-test because we're given the sample standard deviation (s), not the population standard deviation (σ).

Calculation:

t = (x̄ - μ₀) / (s / √n)
t = (102 - 100) / (12 / √36)
t = 2 / 2
t = 1.0

df = n - 1 = 36 - 1 = 35

Question 3: For a two-tailed test with α = 0.05, the critical values are ±1.96 (z-test). If your calculated z = 1.85, what is your decision?

Decision: Fail to reject H₀

Reasoning: For a two-tailed test, we reject H₀ if |z| > 1.96.

|1.85| = 1.85, which is NOT greater than 1.96, so the test statistic is not in the critical region.

We do not have sufficient evidence to reject the null hypothesis at the 0.05 significance level.

Summary

  • Use z-test when σ is known; use t-test when σ is unknown (almost always)
  • Z-test statistic: z = (x̄ - μ₀) / (σ / √n)
  • T-test statistic: t = (x̄ - μ₀) / (s / √n) with df = n - 1
  • Critical value approach: Compare test statistic to critical value(s)
  • P-value approach: Compare p-value to α
  • Both approaches always give the same conclusion
  • Always interpret results in the context of the original question
← Previous: Errors & Power Next: Tests for Proportions →