Two-Sample Hypothesis Tests: Comprehensive Guide

Master two-sample hypothesis tests for proportions and means: comparing groups with detailed step-by-step solutions through these 5 exercises.

Two-Sample Hypothesis Tests Fundamentals
Proportions: z = (p̂₁ - p̂₂) / √[p̂_pooled(1-p̂_pooled)(1/n₁ + 1/n₂)]
Means: t = (x̄₁ - x̄₂) / √[(s₁²/n₁) + (s₂²/n₂)]
Test Statistics
Key Definitions:

Null Hypothesis (H₀): No difference between groups (p₁ = p₂ or μ₁ = μ₂)

Alternative Hypothesis (H₁): Difference exists (≠, >, or <)

Pooled Proportion: p̂_pooled = (x₁ + x₂)/(n₁ + n₂)

Standard Error: Measures variability of the difference

P-value: Probability of observing the result under H₀

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

5-Step Procedure:
  1. State hypotheses: Define H₀ and H₁
  2. Check conditions: Independence, normality, success-failure
  3. Calculate test statistic: z or t value
  4. Find p-value: Based on test type and distribution
  5. Make decision: Compare p-value to α
Tip 1: Use z-test for proportions, t-test for means with unknown σ
Tip 2: Pool proportions for hypothesis testing, not for confidence intervals
Tip 3: Always check conditions before proceeding
When to Use: Comparing two independent groups
Assumptions: Independence, random sampling, normal populations for means
Solution: Exercises 1 to 3
1 Two-Sample Proportion Test
Exercise 1
A survey shows that 120 of 200 urban residents support a policy, while 80 of 150 rural residents support it. Test if there's a significant difference in support at α = 0.05.
Problem Setup:

Urban: n₁ = 200, x₁ = 120, p̂₁ = 120/200 = 0.60

Rural: n₂ = 150, x₂ = 80, p̂₂ = 80/150 = 0.533

Test Procedure:

Two-tailed z-test for difference in proportions

Step 1: State hypotheses

H₀: p₁ = p₂ (no difference in support)

H₁: p₁ ≠ p₂ (difference in support)

Step 2: Check conditions

Independence: ✓ (separate samples)

Success-failure: n₁p̂₁ = 120 ≥ 5, n₁(1-p̂₁) = 80 ≥ 5, n₂p̂₂ = 80 ≥ 5, n₂(1-p̂₂) = 70 ≥ 5 ✓

Step 3: Calculate pooled proportion

p̂_pooled = (x₁ + x₂)/(n₁ + n₂) = (120 + 80)/(200 + 150) = 200/350 = 0.571

Step 4: Calculate standard error

SE = √[p̂_pooled(1-p̂_pooled)(1/n₁ + 1/n₂)]

SE = √[0.571 × 0.429 × (1/200 + 1/150)]

SE = √[0.245 × 0.0117] = √0.00287 = 0.0536

Step 5: Calculate test statistic

z = (p̂₁ - p̂₂)/SE = (0.60 - 0.533)/0.0536 = 0.067/0.0536 = 1.25

Step 6: Find p-value

Two-tailed test: p-value = 2 × P(Z ≥ |1.25|) = 2 × 0.1056 = 0.2112

Step 7: Make decision

Since p-value (0.2112) > α (0.05), fail to reject H₀

Step 8: Conclusion

There is insufficient evidence to conclude a significant difference in policy support between urban and rural residents.

Final Answer:

z = 1.25, p-value = 0.2112

Fail to reject H₀: No significant difference in support

Applied Rules:

• Pooling: Use pooled proportion under H₀ (p₁ = p₂)

• Standard Error: SE = √[p̂_pooled(1-p̂_pooled)(1/n₁ + 1/n₂)]

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

2 Two-Sample Mean Test
Exercise 2
Test scores from two teaching methods: Method A (n₁ = 25, x̄₁ = 78.5, s₁ = 12.3) and Method B (n₂ = 20, x̄₂ = 75.2, s₂ = 10.8). Test if Method A is significantly better at α = 0.05.
Problem Setup:

Method A: n₁ = 25, x̄₁ = 78.5, s₁ = 12.3

Method B: n₂ = 20, x̄₂ = 75.2, s₂ = 10.8

Step 1: State hypotheses

H₀: μ₁ ≤ μ₂ (Method A not better than Method B)

H₁: μ₁ > μ₂ (Method A is better than Method B)

Step 2: Check conditions

Independence: ✓ (different groups)

Normality: Assume approximately normal or n₁, n₂ ≥ 30

Step 3: Calculate standard error

SE = √[(s₁²/n₁) + (s₂²/n₂)] = √[(12.3²/25) + (10.8²/20)]

SE = √[6.052 + 5.832] = √11.884 = 3.45

Step 4: Calculate test statistic

Using Welch's t-test (unequal variances):

t = (x̄₁ - x̄₂)/SE = (78.5 - 75.2)/3.45 = 3.3/3.45 = 0.957

Step 5: Calculate degrees of freedom

df = [(s₁²/n₁ + s₂²/n₂)²] / [(s₁²/n₁)²/(n₁-1) + (s₂²/n₂)²/(n₂-1)]

df = [11.884²] / [6.052²/24 + 5.832²/19] = 141.23 / [1.526 + 1.792] = 42.4 ≈ 42

Step 6: Find p-value

Right-tailed test: p-value = P(T₄₂ ≥ 0.957) ≈ 0.172

Step 7: Make decision

Since p-value (0.172) > α (0.05), fail to reject H₀

Step 8: Conclusion

There is insufficient evidence to conclude that Method A is significantly better than Method B.

Final Answer:

t = 0.957, df = 42, p-value = 0.172

Fail to reject H₀: No significant difference in scores

Applied Rules:

• Welch's T-Test: For unequal variances

• Degrees of Freedom: Welch-Satterthwaite approximation

• One-tailed Test: H₁: μ₁ > μ₂

3 Proportion Test with Large Samples
Exercise 3
In two cities, City A (n₁ = 800) has 520 voters supporting a candidate, while City B (n₂ = 750) has 450 supporters. Test if City A has significantly higher support at α = 0.01.
Problem Setup:

City A: n₁ = 800, x₁ = 520, p̂₁ = 520/800 = 0.65

City B: n₂ = 750, x₂ = 450, p̂₂ = 450/750 = 0.60

Step 1: State hypotheses

H₀: p₁ ≤ p₂ (City A not higher than City B)

H₁: p₁ > p₂ (City A higher than City B)

Step 2: Check conditions

Independence: ✓ (separate cities)

Success-failure: All np̂ and n(1-p̂) ≥ 5 ✓

Step 3: Calculate pooled proportion

p̂_pooled = (520 + 450)/(800 + 750) = 970/1550 = 0.626

Step 4: Calculate standard error

SE = √[0.626 × 0.374 × (1/800 + 1/750)]

SE = √[0.234 × 0.00258] = √0.000604 = 0.0246

Step 5: Calculate test statistic

z = (0.65 - 0.60)/0.0246 = 0.05/0.0246 = 2.03

Step 6: Find p-value

Right-tailed test: p-value = P(Z ≥ 2.03) = 0.0212

Step 7: Make decision

Since p-value (0.0212) > α (0.01), fail to reject H₀

Step 8: Conclusion

At α = 0.01, there is insufficient evidence to conclude City A has significantly higher support.

Final Answer:

z = 2.03, p-value = 0.0212

Fail to reject H₀ at α = 0.01: No significant difference

Applied Rules:

• One-tailed Test: H₁: p₁ > p₂

• Conservative Alpha: α = 0.01 requires stronger evidence

• Large Samples: Normal approximation valid

Solution: Exercises 4 to 5
4 Technology Performance Test
Exercise 4
Two computer models are tested. Model X (n₁ = 15) has mean processing speed x̄₁ = 3.2 GHz and SD s₁ = 0.4 GHz. Model Y (n₂ = 18) has mean x̄₂ = 3.0 GHz and SD s₂ = 0.5 GHz. Test if Model X is significantly faster at α = 0.05.
Problem Setup:

Model X: n₁ = 15, x̄₁ = 3.2 GHz, s₁ = 0.4 GHz

Model Y: n₂ = 18, x̄₂ = 3.0 GHz, s₂ = 0.5 GHz

Step 1: State hypotheses

H₀: μ₁ ≤ μ₂ (Model X not faster than Model Y)

H₁: μ₁ > μ₂ (Model X is faster than Model Y)

Step 2: Calculate standard error

SE = √[(0.4²/15) + (0.5²/18)] = √[0.0107 + 0.0139] = √0.0246 = 0.157

Step 3: Calculate test statistic

t = (3.2 - 3.0)/0.157 = 0.2/0.157 = 1.27

Step 4: Calculate degrees of freedom

df = [(0.0107 + 0.0139)²] / [0.0107²/14 + 0.0139²/17]

df = [0.0246²] / [0.0000082 + 0.0000114] = 0.000605 / 0.0000196 = 30.9 ≈ 31

Step 5: Find p-value

Right-tailed test: p-value = P(T₃₁ ≥ 1.27) ≈ 0.107

Step 6: Make decision

Since p-value (0.107) > α (0.05), fail to reject H₀

Step 7: Conclusion

There is insufficient evidence to conclude Model X is significantly faster than Model Y.

Final Answer:

t = 1.27, df = 31, p-value = 0.107

Fail to reject H₀: No significant difference in speed

Applied Rules:

• One-tailed Test: Testing for "faster" (μ₁ > μ₂)

• Small Samples: Use t-distribution

• Unequal Variances: Welch's t-test

5 Educational Achievement Test
Exercise 5
Two schools compare reading scores. School A (n₁ = 24) has mean x̄₁ = 76.8 and SD s₁ = 9.2. School B (n₂ = 28) has mean x̄₂ = 72.4 and SD s₂ = 11.1. Test if there's any significant difference at α = 0.05.
Problem Setup:

School A: n₁ = 24, x̄₁ = 76.8, s₁ = 9.2

School B: n₂ = 28, x̄₂ = 72.4, s₂ = 11.1

Step 1: State hypotheses

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

H₁: μ₁ ≠ μ₂ (difference in scores)

Step 2: Calculate standard error

SE = √[(9.2²/24) + (11.1²/28)] = √[3.527 + 4.414] = √7.941 = 2.82

Step 3: Calculate test statistic

t = (76.8 - 72.4)/2.82 = 4.4/2.82 = 1.56

Step 4: Calculate degrees of freedom

df = [(3.527 + 4.414)²] / [3.527²/23 + 4.414²/27]

df = [7.941²] / [0.541 + 0.725] = 63.06 / 1.266 = 49.8 ≈ 50

Step 5: Find p-value

Two-tailed test: p-value = 2 × P(T₅₀ ≥ |1.56|) = 2 × 0.062 = 0.124

Step 6: Make decision

Since p-value (0.124) > α (0.05), fail to reject H₀

Step 7: Conclusion

There is insufficient evidence to conclude a significant difference in reading scores between the schools.

Final Answer:

t = 1.56, df = 50, p-value = 0.124

Fail to reject H₀: No significant difference in scores

Applied Rules:

• Two-tailed Test: H₁: μ₁ ≠ μ₂

• P-value: Multiply by 2 for two-tailed test

• Decision Rule: Compare to α level

Comprehensive Two-Sample Tests Guide
Proportions: z = (p̂₁ - p̂₂) / √[p̂_pooled(1-p̂_pooled)(1/n₁ + 1/n₂)]
Means: t = (x̄₁ - x̄₂) / √[(s₁²/n₁) + (s₂²/n₂)]
Test Statistics
Proportions Test
z-statistic
Binary outcomes
Means Test
t-statistic
Continuous outcomes
Pooled Proportion
p̂_pooled = (x₁ + x₂)/(n₁ + n₂)
Under H₀
Key Test Concepts:

Population Parameters (p₁, p₂, μ₁, μ₂): True values in respective populations

Sample Statistics (p̂₁, p̂₂, x̄₁, x̄₂): Observed values in samples

Standard Error: Measures variability of the difference between groups

Sampling Distribution: Under H₀, follows z or t distribution

Power: Probability of detecting true differences

Test Selection Guidelines:

Use Proportions Test: When comparing percentages or proportions (success/failure outcomes)

Use Means Test: When comparing averages or continuous measurements

Use Z-test: For proportions

Use T-test: For means with unknown population standard deviations

Memory Tip: "Proportions get Z, Means get T" (with unknown σ)
Memory Tip: "Pool for tests, don't pool for intervals" (proportions)
Memory Tip: "Subtract same way every time" - Always group 1 minus group 2
Common Mistakes: Confusing test types, using wrong SE formula, misinterpreting p-values
Best Practices: Check conditions, choose correct test, interpret in context

Questions & Answers

Question: Why do we pool proportions for hypothesis tests but not for confidence intervals? What's the reasoning?

Answer: This is a fundamental concept that often confuses students:

Hypothesis Tests: We assume H₀ is true (p₁ = p₂), so we pool the samples to get a better estimate of the common proportion under the null hypothesis:

p̂_pooled = (x₁ + x₂)/(n₁ + n₂)

Confidence Intervals: We're estimating the true difference without assuming anything about the parameters. We use the individual sample proportions:

SE = √[(p̂₁(1-p̂₁)/n₁) + (p̂₂(1-p̂₂)/n₂)]

Intuitive Reasoning: In hypothesis tests, we're testing a specific assumption (that the proportions are equal), so we use that assumption to improve our estimate of the standard error. In confidence intervals, we're trying to estimate the true difference without restrictions.

This ensures that the test and confidence interval are consistent with their respective goals.

Question: How do I decide between using pooled vs. unpooled (Welch's) t-test for comparing means? When should I assume equal variances?

Answer: The decision between pooled and unpooled t-tests is important:

Use Pooled T-Test:

  • When you have strong theoretical reasons to assume equal variances
  • When preliminary tests (like F-test) show no significant difference in variances
  • When sample sizes are equal or very similar

Use Welch's T-Test (Unpooled):

  • When sample sizes are unequal
  • When variances appear different
  • As a default approach (most conservative)
  • When you're uncertain about equal variances

Modern Recommendation: Most statisticians recommend using Welch's t-test by default because:

  • It's more robust to violations of equal variance assumption
  • It maintains correct Type I error rates
  • It performs similarly to pooled t-test when variances are equal

Unless you have strong theoretical justification for equal variances, use Welch's t-test.

Question: How do I interpret the results when I fail to reject the null hypothesis? Does this mean the groups are equal?

Answer: This is a crucial distinction in statistical inference:

Failing to Reject H₀ means:

  • We don't have sufficient evidence to conclude the groups are different
  • The observed difference could be due to random sampling variation
  • We cannot conclude there's a significant difference

It does NOT mean:

  • The groups are definitely equal
  • There is no difference between the groups
  • We have proven the null hypothesis is true

Analogy: In a court trial, "not guilty" doesn't mean "innocent" - it means there wasn't enough evidence to prove guilt beyond reasonable doubt.

Alternative Interpretations:

  • The sample size might be too small to detect a real difference
  • The true difference might be smaller than what the test can detect
  • There might be high variability masking the difference

Always frame your conclusion in terms of "insufficient evidence to conclude a difference" rather than "the groups are equal."