Hypothesis TestingTopic #24 of 33

Hypothesis Testing Basics

Null and alternative hypotheses, test statistics, p-values, and decision rules.

Overview

Hypothesis testing is a formal procedure for using sample data to evaluate claims about population parameters.

The Process

  1. State hypotheses (H0H_0 and H1H_1)
  2. Choose significance level (α\alpha)
  3. Collect data and calculate test statistic
  4. Find p-value or critical value
  5. Make decision and state conclusion

Hypotheses

Null Hypothesis (H0H_0)

The default assumption, typically:

  • No effect
  • No difference
  • Status quo

Alternative Hypothesis (H1H_1 or HaH_a)

What we're trying to find evidence for:

  • There is an effect
  • There is a difference
  • Something has changed

Types of Tests

Test TypeH0H_0H1H_1Rejection Region
Two-tailedμ=μ0\mu = \mu_0μμ0\mu \neq \mu_0Both tails
Left-tailedμμ0\mu \geq \mu_0μ<μ0\mu < \mu_0Left tail
Right-tailedμμ0\mu \leq \mu_0μ>μ0\mu > \mu_0Right tail

Significance Level (α\alpha)

The probability of rejecting H0H_0 when it's actually true (Type I error rate).

Common values: α=0.05\alpha = 0.05, 0.010.01, 0.100.10

Test Statistic

For Means (σ\sigma known or large nn)

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

For Means (σ\sigma unknown, small nn)

t=xˉμ0s/nt = \frac{\bar{x} - \mu_0}{s/\sqrt{n}}

For Proportions

Z=p^p0p0(1p0)/nZ = \frac{\hat{p} - p_0}{\sqrt{p_0(1-p_0)/n}}

P-Value

The probability of observing a test statistic as extreme or more extreme than the one calculated, assuming H0H_0 is true.

Decision Rule

If p-valueαReject H0\text{If p-value} \leq \alpha \Rightarrow \text{Reject } H_0 If p-value>αFail to reject H0\text{If p-value} > \alpha \Rightarrow \text{Fail to reject } H_0

Critical Value Approach

Compare test statistic to critical value(s):

If test stat>critical valueReject H0\text{If } \lvert \text{test stat} \rvert > \text{critical value} \Rightarrow \text{Reject } H_0

Decision Outcomes

H0H_0 TrueH0H_0 False
Reject H0H_0Type I Error (α\alpha)Correct
Fail to RejectCorrectType II Error (β\beta)

Steps Illustrated

         State H₀, H₁
              ↓
         Choose α
              ↓
         Collect data
              ↓
         Calculate test statistic
              ↓
         Find p-value
              ↓
    ┌────────┴────────┐
    ↓                 ↓
p ≤ α              p > α
Reject H₀      Fail to reject H₀

Examples

Example 1: Two-Tailed Test

Claim: μ=100\mu = 100. Sample: n=36n = 36, xˉ=103\bar{x} = 103, σ=12\sigma = 12, α=0.05\alpha = 0.05

H0:μ=100H_0: \mu = 100 H1:μ100H_1: \mu \neq 100 Z=10310012/36=32=1.5Z = \frac{103 - 100}{12/\sqrt{36}} = \frac{3}{2} = 1.5 p-value=2×P(Z>1.5)=2×0.0668=0.1336\text{p-value} = 2 \times P(Z > 1.5) = 2 \times 0.0668 = 0.1336 0.1336>0.05Fail to reject H00.1336 > 0.05 \Rightarrow \text{Fail to reject } H_0

Example 2: One-Tailed Test

Claim: μ>50\mu > 50. Sample: n=25n = 25, xˉ=53\bar{x} = 53, s=8s = 8, α=0.05\alpha = 0.05

H0:μ50,H1:μ>50H_0: \mu \leq 50, \quad H_1: \mu > 50 t=53508/25=31.6=1.875t = \frac{53 - 50}{8/\sqrt{25}} = \frac{3}{1.6} = 1.875 df=24,tcrit=1.711df = 24, \quad t_{\text{crit}} = 1.711 1.875>1.711Reject H01.875 > 1.711 \Rightarrow \text{Reject } H_0

Example 3: Proportion Test

Claim: p>0.5p > 0.5. Sample: n=200n = 200, p^=0.56\hat{p} = 0.56, α=0.05\alpha = 0.05

H0:p0.5,H1:p>0.5H_0: p \leq 0.5, \quad H_1: p > 0.5 Z=0.560.50.5×0.5/200=0.060.0354=1.69Z = \frac{0.56 - 0.5}{\sqrt{0.5 \times 0.5/200}} = \frac{0.06}{0.0354} = 1.69 p-value=P(Z>1.69)=0.0455\text{p-value} = P(Z > 1.69) = 0.0455 0.0455<0.05Reject H00.0455 < 0.05 \Rightarrow \text{Reject } H_0

Key Points

  • We never "prove" H0H_0 or "accept" H0H_0
  • Failing to reject ≠ proving true
  • Statistical significance ≠ practical significance
  • Choose α\alpha before analyzing data