Introduction to Hypothesis Testing: Solved Exercises

Master the fundamentals of hypothesis testing: null and alternative hypotheses, significance levels, p-values, and decision-making processes through these 5 detailed exercises.

Hypothesis Testing Fundamentals
H₀: μ = μ₀
H₁: μ ≠ μ₀
Null vs Alternative Hypotheses
Key Definitions:

Null Hypothesis (H₀): Statement of no effect or no difference; represents the status quo

Alternative Hypothesis (H₁): Statement that contradicts the null; what we want to prove

Significance Level (α): Threshold for rejecting H₀; typically 0.05 or 0.01

P-value: Probability of observing data as extreme as the sample, assuming H₀ is true

5-Step Hypothesis Testing Process:
  1. State hypotheses: Define H₀ and H₁ clearly
  2. Set significance level: Choose α (typically 0.05)
  3. Calculate test statistic: Compute the relevant test statistic
  4. Determine p-value: Find the probability of the observed result
  5. Make decision: Compare p-value to α and conclude
Tip 1: Always state hypotheses in words and symbols.
Tip 2: If p-value ≤ α, reject H₀; otherwise, fail to reject H₀.
Tip 3: We never "accept" H₀, only "fail to reject" it.
Type I Error: Rejecting H₀ when it's true (false positive)
Type II Error: Failing to reject H₀ when it's false (false negative)
Solution: Exercises 1 to 3
1 One-Sample Mean Test
Exercise 1
A manufacturer claims their light bulbs last 1000 hours on average. A sample of 36 bulbs has a mean life of 980 hours with a standard deviation of 60 hours. Test the claim at α = 0.05.
Problem Setup:

Given: n = 36, x̄ = 980, s = 60, μ₀ = 1000, α = 0.05

Testing Method:

Since n > 30, we use the z-test for population mean.

Step 1: State the hypotheses

H₀: μ = 1000 (manufacturer's claim is true)

H₁: μ ≠ 1000 (manufacturer's claim is false)

Step 2: Set significance level

α = 0.05

Step 3: Calculate test statistic

Formula: z = (x̄ - μ₀)/(s/√n)

z = (980 - 1000)/(60/√36) = -20/(60/6) = -20/10 = -2.0

Step 4: Determine p-value

This is a two-tailed test: p-value = P(|Z| ≥ 2.0) = 2 × P(Z ≤ -2.0) = 2 × 0.0228 = 0.0456

Step 5: Make decision

Since p-value (0.0456) < α (0.05), we reject H₀.

Conclusion:

There is sufficient evidence to reject the manufacturer's claim that bulbs last 1000 hours on average.

Applied Rules:

• Central Limit Theorem: Used because n > 30

• Decision Rule: Reject H₀ if p-value ≤ α

• Two-tailed Test: H₁: μ ≠ μ₀ requires doubling the tail probability

2 Proportion Test
Exercise 2
A company claims 70% of customers are satisfied. In a survey of 200 customers, 130 were satisfied. Test the claim at α = 0.01.
Problem Setup:

Given: n = 200, x = 130, p̂ = 130/200 = 0.65, p₀ = 0.70, α = 0.01

Step 1: State the hypotheses

H₀: p = 0.70 (company's claim is true)

H₁: p ≠ 0.70 (company's claim is false)

Step 2: Check conditions

np₀ = 200 × 0.70 = 140 ≥ 5 and n(1-p₀) = 200 × 0.30 = 60 ≥ 5 ✓

Step 3: Calculate test statistic

Formula: z = (p̂ - p₀)/√[p₀(1-p₀)/n]

z = (0.65 - 0.70)/√[0.70 × 0.30/200] = -0.05/√[0.21/200] = -0.05/√0.00105 = -0.05/0.0324 = -1.54

Step 4: Determine p-value

This is a two-tailed test: p-value = P(|Z| ≥ 1.54) = 2 × P(Z ≤ -1.54) = 2 × 0.0618 = 0.1236

Step 5: Make decision

Since p-value (0.1236) > α (0.01), we fail to reject H₀.

Conclusion:

There is insufficient evidence to reject the company's claim that 70% of customers are satisfied.

Applied Rules:

• Normal Approximation: Conditions np₀ ≥ 5 and n(1-p₀) ≥ 5 must be met

• Proportion Test Formula: Uses standard error of proportion

• Decision Rule: Compare p-value to significance level

3 One-Tailed Test
Exercise 3
A new teaching method is believed to increase test scores. Historically, mean score was 75. A sample of 25 students using the new method had mean score of 78 with std dev of 10. Test at α = 0.05.
Problem Setup:

Given: n = 25, x̄ = 78, s = 10, μ₀ = 75, α = 0.05

Step 1: State the hypotheses

H₀: μ = 75 (new method has no effect)

H₁: μ > 75 (new method increases scores)

Step 2: Set significance level

α = 0.05

Step 3: Calculate test statistic

Since n < 30, we use t-test: t = (x̄ - μ₀)/(s/√n)

t = (78 - 75)/(10/√25) = 3/(10/5) = 3/2 = 1.5

Step 4: Determine critical value

df = n - 1 = 24, α = 0.05, one-tailed test

t_critical = 1.711

Step 5: Make decision

Since calculated t (1.5) < critical t (1.711), we fail to reject H₀.

Conclusion:

There is insufficient evidence to conclude that the new teaching method increases test scores.

Applied Rules:

• One-tailed Test: Directional alternative hypothesis (μ > 75)

• T-distribution: Used for small samples with unknown σ

• Degrees of Freedom: df = n - 1

Solution: Exercises 4 to 5
4 Two-Sample Comparison
Exercise 4
Two groups of students took a test. Group A (n₁=30, x̄₁=82, s₁=8) and Group B (n₂=25, x̄₂=79, s₂=10). Test if there's a significant difference in means at α = 0.05.
Problem Setup:

Given: n₁=30, x̄₁=82, s₁=8; n₂=25, x̄₂=79, s₂=10; α = 0.05

Step 1: State the hypotheses

H₀: μ₁ = μ₂ (no difference in means)

H₁: μ₁ ≠ μ₂ (there is a difference in means)

Step 2: Set significance level

α = 0.05

Step 3: Calculate pooled standard deviation

s_pooled = √[(n₁-1)s₁² + (n₂-1)s₂²]/(n₁+n₂-2)

s_pooled = √[(29×64) + (24×100)]/53 = √[1856 + 2400]/53 = √4256/53 = √80.3 = 8.96

Step 4: Calculate test statistic

t = (x̄₁ - x̄₂)/[s_pooled × √(1/n₁ + 1/n₂)]

t = (82 - 79)/[8.96 × √(1/30 + 1/25)] = 3/[8.96 × √(0.0333 + 0.04)] = 3/[8.96 × √0.0733] = 3/[8.96 × 0.2707] = 3/2.426 = 1.24

Step 5: Determine degrees of freedom

df = n₁ + n₂ - 2 = 30 + 25 - 2 = 53

Step 6: Make decision

For α = 0.05 and df = 53, critical t ≈ ±2.009

Since |t| = 1.24 < 2.009, we fail to reject H₀.

Conclusion:

There is insufficient evidence to conclude that there is a significant difference in mean test scores between the two groups.

Applied Rules:

• Two-sample t-test: For comparing means of two independent groups

• Pooled Variance: Assumes equal population variances

• Degrees of Freedom: df = n₁ + n₂ - 2

5 Chi-Square Goodness of Fit
Exercise 5
A die is rolled 60 times with results: 1(8), 2(12), 3(10), 4(11), 5(9), 6(10). Test if the die is fair at α = 0.05.
Problem Setup:

Observed frequencies: O₁=8, O₂=12, O₃=10, O₄=11, O₅=9, O₆=10

Expected frequency: E = 60/6 = 10 for each outcome

Step 1: State the hypotheses

H₀: Die is fair (each outcome has probability 1/6)

H₁: Die is not fair (at least one probability differs)

Step 2: Set significance level

α = 0.05

Step 3: Calculate chi-square statistic

χ² = Σ[(O - E)²/E]

= [(8-10)²/10] + [(12-10)²/10] + [(10-10)²/10] + [(11-10)²/10] + [(9-10)²/10] + [(10-10)²/10]

= [4/10] + [4/10] + [0/10] + [1/10] + [1/10] + [0/10] = 0.4 + 0.4 + 0 + 0.1 + 0.1 + 0 = 1.0

Step 4: Determine degrees of freedom

df = k - 1 = 6 - 1 = 5

Step 5: Find critical value

For α = 0.05 and df = 5, χ²_critical = 11.07

Step 6: Make decision

Since χ²_calculated (1.0) < χ²_critical (11.07), we fail to reject H₀.

Conclusion:

There is insufficient evidence to conclude that the die is unfair.

Applied Rules:

• Chi-square Test: For categorical data goodness-of-fit

• Degrees of Freedom: df = number of categories - 1

• Expected Frequency: Must be ≥ 5 for each category

Comprehensive Hypothesis Testing Guide
p-value = P(data | H₀ true)
P-value Interpretation
Z-test
z = (x̄ - μ₀)/(σ/√n)
Large samples, known σ
T-test
t = (x̄ - μ₀)/(s/√n)
Small samples, unknown σ
Z-proportion
z = (p̂ - p₀)/√[p₀(1-p₀)/n]
Proportion tests
Statistical Decision Framework:

Statistical Significance: Result is unlikely due to chance alone

Practical Significance: Result has meaningful impact in real world

Power of Test: Probability of correctly rejecting a false null hypothesis

Critical Value Approach:

Compare test statistic to critical value from distribution table

Reject H₀ if |test statistic| > critical value

Key Note: Larger sample sizes increase power and detect smaller differences.
Key Note: Smaller α reduces Type I error but increases Type II error.
Key Note: Confidence intervals provide range of plausible values.
Assumptions: Independence, normality (for small samples), random sampling
Effect Size: Standardized measure of magnitude of difference

Questions & Answers

Question: Why do we say "fail to reject H₀" instead of "accept H₀"? What's the difference in interpretation?

Answer: This is a fundamental concept in hypothesis testing! The distinction is crucial:

  • "Fail to reject H₀": We don't have enough evidence to conclude H₀ is false. It doesn't mean H₀ is definitely true.
  • "Accept H₀": Would imply H₀ is definitely true, which we cannot prove with statistical tests.

Think of it like a legal trial: "not guilty" doesn't mean "innocent," just that there wasn't enough evidence to convict. Similarly, failing to reject H₀ means we don't have sufficient evidence against it, but it might still be false.

This protects against Type II errors (failing to reject a false null hypothesis). The burden of proof is on showing the alternative hypothesis, not proving the null is true.

Question: How do I choose the significance level α? Is 0.05 always the best choice?

Answer: The choice of α depends on the context and consequences of errors:

  • α = 0.05: Standard in many fields; 5% risk of Type I error
  • α = 0.01: More stringent; used when Type I errors are costly (medical trials)
  • α = 0.10: Less stringent; used when Type II errors are more concerning

Consider the consequences:

  • Medical testing: Lower α to avoid approving ineffective drugs
  • Quality control: Balance between stopping production unnecessarily vs. missing defects
  • Academic research: Conventionally α = 0.05, but field-specific standards may vary

Always justify your α level based on the specific context and potential impacts of incorrect decisions.

Question: What's the relationship between confidence intervals and hypothesis tests? Are they equivalent?

Answer: Yes, confidence intervals and hypothesis tests are equivalent approaches to the same inference problem:

Equivalence: For a two-tailed test at significance level α, if the hypothesized value falls outside the (1-α)×100% confidence interval, we reject H₀.

Example: Testing H₀: μ = 100 vs H₁: μ ≠ 100 at α = 0.05

  • If 95% CI for μ is (95, 99), since 100 is not in the interval, we reject H₀
  • If 95% CI for μ is (98, 102), since 100 is in the interval, we fail to reject H₀

Confidence intervals provide more information: they give the range of plausible values for the parameter, while hypothesis tests provide a yes/no decision about a specific value. Both should lead to the same conclusion for the same α level.

Confidence intervals are often preferred because they provide practical significance (magnitude) along with statistical significance.