Comprehensive Guide to Hypothesis Testing

Overview of Hypothesis Testing

  • Definition of Statistical Hypothesis: A statistical hypothesis is a claim or statement regarding the value or values of a specific population parameter.

  • The Statistical Process: To verify claims statistically, sample data must be gathered and analyzed. The results from the sample lead to one of two conclusions about the hypothesized value of the population parameter:

    • The value is accepted as probably true.

    • The value is rejected as probably false.

  • Hypothesis Testing Definition: This is the formal statistical process used to test the validity of a claim regarding the true value of any population parameter.

Types of Hypothesis

  • 1. Null Hypothesis (H0H_{0}):

    • This is the specific hypothesis that is being tested.

    • It represents a claim or statement about a population parameter that is assumed to be true until evidence suggests it is false.

    • It is often called the "hypothesis of no difference."

    • Notation: Includes symbols of equality or semi-equality, such as H0:(=, or  ≥,  or  ≤)H_{0}: (=, \text{ or } \text{ ≥, } \text{ or } \text{ ≤}).

  • 2. Alternative Hypothesis (H1H_{1}):

    • This is the hypothesis believed to be true if the null hypothesis (H0H_{0}) is rejected.

    • It is known as the "hypothesis of difference."

    • Notation: Includes symbols of inequality, such as H1:(≠, or <, or >)H_{1}: (\neq, \text{ or } <, \text{ or } >).

Directions and Tails in Hypothesis Testing

  • Rejection Region Logic: The rejection region of a test is determined entirely by the alternative hypothesis (H1H_{1}).

  • Two-Tailed Test: Defined by the symbol ≠\neq in the alternative hypothesis. This test has two rejection regions (one in each tail of the distribution).

  • One-Tailed Test: Defined by the symbols >> or << in the alternative hypothesis. These tests have only one rejection region.

    • One-Sided Upper-Tailed Test: Used when the claim states the parameter is more than a specified value.

      • H0:population parameter ≤ specified valueH_{0}: \text{population parameter} \text{ ≤ } \text{specified value}

      • H1:population parameter>specified valueH_{1}: \text{population parameter} > \text{specified value}

      • The rejection region is in the far right tail.

    • One-Sided Lower-Tailed Test: Used when the claim states the parameter is less than a specified value.

      • H0:population parameter ≥ specified valueH_{0}: \text{population parameter} \text{ ≥ } \text{specified value}

      • H1:population parameter<specified valueH_{1}: \text{population parameter} < \text{specified value}

      • The rejection region is in the far left tail.

Risks and Errors in Hypothesis Testing

Because hypothesis tests are based on samples (which may be biased or non-representative), there is always a probability of making an incorrect decision.

  • Type I Error (αα): The probability of rejecting the null hypothesis when it is actually true.

    • α=P(rejecting H0∣H0 is true)α = P(\text{rejecting } H_{0} | H_{0} \text{ is true})

  • Type II Error (ββ): The probability of accepting (not rejecting) the null hypothesis when it is actually false.

    • β=P(not rejecting H0∣H0 is false)β = P(\text{not rejecting } H_{0} | H_{0} \text{ is false})

Decision Matrix Summary:

Situation

Conclusion: H0H_{0} Not Rejected

Conclusion: H0H_{0} Rejected

H0H_{0} is True

Correct Decision

Type I Error (αα)

H0H_{0} is Not True

Type II Error (ββ)

Correct Decision

  • Relationship between αα and ββ: These probabilities work inversely; as the probability of a Type I error (αα) increases, the probability of a Type II error (ββ) decreases.

Hypothesis Test for a Single Population Mean (μμ)

Hypotheses Formulation
  • Left-tailed: H0:μ ≥ μ0H_{0}: μ \text{ ≥ } μ_{0}; H1:μ<μ0H_{1}: μ < μ_{0}

  • Right-tailed: H0:μ ≤ μ0H_{0}: μ \text{ ≤ } μ_{0}; H1:μ>μ0H_{1}: μ > μ_{0}

  • Two-tailed: H0:μ=μ0H_{0}: μ = μ_{0}; H1:μ≠μ0H_{1}: μ \neq μ_{0}

Test Statistics
  • Z-Test Statistic: Used when the population standard deviation (σσ) is known or the sample size is large (n ≥ 30n \text{ ≥ } 30).

    • Zcalc=xˉ−μ0σ√nZ_{calc} = \frac{\bar{x} - μ_{0}}{\frac{σ}{\text{√}n}}

    • Critical Value: Zcrit=Ztable=ZαZ_{crit} = Z_{table} = Z_{α}

  • T-Test Statistic: Used when the population standard deviation (σσ) is unknown and the sample size is small (n<30n < 30).

    • tcalc=xˉ−μ0s√nt_{calc} = \frac{\bar{x} - μ_{0}}{\frac{s}{\text{√}n}}

    • Denominator Note: s√n\frac{s}{\text{√}n} is an estimate for the standard error term σ√n\frac{σ}{\text{√}n}.

    • Critical Value: tcrit=ttable=tα,dft_{crit} = t_{table} = t_{α, df} where df=n−1df = n - 1.

Distribution Consistency Table

Condition

σσ is known

σσ is not known

n ≥ 30n \text{ ≥ } 30

Z-test

Z-test

n<30n < 30

Z-test

t-test

Hypothesis Test for Single Population Proportion (ππ)

Hypotheses Formulation
  • Left-tailed: H0:π ≥ π0H_{0}: π \text{ ≥ } π_{0}; H1:π<π0H_{1}: π < π_{0}

  • Right-tailed: H0:π ≤ π0H_{0}: π \text{ ≤ } π_{0}; H1:π>π0H_{1}: π > π_{0}

  • Two-tailed: H0:π=π0H_{0}: π = π_{0}; H1:π≠π0H_{1}: π \neq π_{0}

Calculation
  • Sample Proportion (pp): p=xnp = \frac{x}{n}, where xx is the number of successes in sample size nn.

  • Z-Test Statistic:

    • Zcalc=p−π√π(1−π)nZ_{calc} = \frac{p - π}{\text{√}\frac{π(1 - π)}{n}}

  • Critical Value: Zcrit=Ztable=ZαZ_{crit} = Z_{table} = Z_{α}

Hypothesis Test for the Difference Between Two Population Means (μ1−μ2μ_{1} - μ_{2})

Hypotheses Formulation
  • Left-tailed: H0:μ1 ≥ μ2H_{0}: μ_{1} \text{ ≥ } μ_{2}; H1:μ1<μ2H_{1}: μ_{1} < μ_{2}

  • Right-tailed: H0:μ1 ≤ μ2H_{0}: μ_{1} \text{ ≤ } μ_{2}; H1:μ1>μ2H_{1}: μ_{1} > μ_{2}

  • Two-tailed: H0:μ1=μ2H_{0}: μ_{1} = μ_{2}; H1:μ1≠μ2H_{1}: μ_{1} \neq μ_{2}

Calculation Cases
  • Case 1: σ1,σ2σ_{1}, σ_{2} known; n1,n2n_{1}, n_{2} large.

    • zcalc=xˉ1−xˉ2√(σ12n1+σ22n2)z_{calc} = \frac{\bar{x}_{1} - \bar{x}_{2}}{\text{√}(\frac{σ_{1}^{2}}{n_{1}} + \frac{σ_{2}^{2}}{n_{2}})}

  • Case 2: σ1,σ2σ_{1}, σ_{2} known; n1,n2n_{1}, n_{2} small.

    • Same Z-statistic formula as Case 1.

  • Case 3: σ1,σ2σ_{1}, σ_{2} unknown; n1,n2n_{1}, n_{2} large.

    • zcalc=xˉ1−xˉ2√(s12n1+s22n2)z_{calc} = \frac{\bar{x}_{1} - \bar{x}_{2}}{\text{√}(\frac{s_{1}^{2}}{n_{1}} + \frac{s_{2}^{2}}{n_{2}})}

  • Case 4: σ1,σ2σ_{1}, σ_{2} unknown; n1,n2n_{1}, n_{2} small.

    • Assumption: Population variances are equal (σ12=σ22=σ2σ_{1}^{2} = σ_{2}^{2} = σ^{2}).

    • Pooled Variance (Sp2S_{p}^{2}):

      • Sp2=(n1−1)s12+(n2−1)s22n1+n2−2S_{p}^{2} = \frac{(n_{1} - 1)s_{1}^{2} + (n_{2} - 1)s_{2}^{2}}{n_{1} + n_{2} - 2}

    • T-Test Statistic:

      • tcalc=xˉ1−xˉ2√(Sp2(1n1+1n2))t_{calc} = \frac{\bar{x}_{1} - \bar{x}_{2}}{\text{√}(S_{p}^{2} (\frac{1}{n_{1}} + \frac{1}{n_{2}}))}

    • Critical Value: tα,n1+n2−2t_{α, n_{1} + n_{2} - 2}

Examples and Numerical Case Studies

Single Mean Examples
  • Example 1 (SARS Tax Returns): SARS claims eFiling takes typical taxpayers less than 45 minutes on average (μ<45μ < 45). Sample of n=12n = 12. Times: 42, 56, 29, 35, 47, 37, 39, 29, 45, 35, 51, 53. Sample mean xˉ=41.5\bar{x} = 41.5, sample SD s=9.04s = 9.04. Test at α=0.05α = 0.05.

  • Example 2 (Cement Bags): Hardware store receives complaints that "1 kg" bags weight less than 1 kg (μ<1μ < 1). Sample n=40n = 40, mean xˉ=0.987\bar{x} = 0.987, known population SD σ=0.025σ = 0.025. Test at α=0.05α = 0.05.

  • Example 3 (Coffee Containers): Manager suspects over-filling of "500 g" containers (μ>500μ > 500). Sample n=30n = 30, mean xˉ=501.8\bar{x} = 501.8, known population variance σ2=60σ^{2} = 60 (σ=√60σ = \text{√}60). Test at α=0.05α = 0.05.

  • Example 4 (Frozen Shrimp Cans): Factory manager checks if cans conform to label weight of 600 g (μ=600μ = 600). Tests for both over and under filling (μ≠600μ \neq 600). Sample n=50n = 50, mean xˉ=595\bar{x} = 595, known population SD σ=20σ = 20. Test at α=0.05α = 0.05 and α=0.10α = 0.10.

Single Proportion Examples
  • Example 1 (Construction Schedule): Company suspects 20% of jobs are behind schedule (π=0.2π = 0.2). Data: n=80n = 80, x=22x = 22 late jobs. Calculation: p=2280=0.275p = \frac{22}{80} = 0.275. Test at α=0.05α = 0.05.

  • Example 2 (Product Marketing): Campaign for new product. Data: x=176x = 176 out of n=200n = 200 users would use it (p=176200=0.88p = \frac{176}{200} = 0.88). Test evidence for more than 85% (π>0.85π > 0.85) at α=0.01α = 0.01.

Two Means Examples
  • Example 1 (Hospital Response): Comparison of response times for senior citizens vs other patients. Complaint: Seniors take longer (μsenior>μotherμ_{senior} > μ_{other}). Test at α=0.01α = 0.01.

  • Example 2 (Metal Hardening): Comparing saltwater quenching (μ1μ_{1}) vs oil quenching (μ2μ_{2}). Assume hardness is normally distributed and variances are equal. Test H0:μ1=μ2H_{0}: μ_{1} = μ_{2} at α=0.05α = 0.05.