Topic 8: Inferences Based on Two Samples: Confidence Intervals & Tests of
Hypotheses
Introduction
In many real-world situations, we are interested not in the characteristics of a
single population, but in comparing two populations. For example, a manager may
wish to compare the average productivity between two departments, or a
researcher may want to test whether the proportion of customers satisfied with two
different products is the same. This chapter extends the principles of inference to
two-sample scenarios, introducing methods for constructing confidence intervals
and performing hypothesis tests for differences between population means and
proportions. The methods discussed rely on data obtained from two independent
samples or from paired samples. By analyzing these samples, we can draw
conclusions about whether observed differences are statistically significant or
simply due to random variation.
Key Concepts
Concept Description
Independent Samples Two unrelated groups (e.g., male vs female shoppers)
Same subjects measured twice (before & after, or matched
Paired Samples
pairs)
Confidence Interval Range where the difference between means or proportions
(CI) likely lies
Hypothesis Test Determine if a statistical difference exists between groups
Confidence Intervals for Two Means
Case A: Independent Samples (σ unknown)
Formula (equal variances not assumed):
Example 1: Online Store A vs Store B
Group Mean Sale ($) Std Dev Sample Size
A 72 5.6 40
B 69 6.2 36
Construct a 95% confidence interval for the difference in mean sales.
Interpretation: We are 95% confident the true difference is between –0.17 and
6.17. The interval includes 0 → no significant difference.
Paired Sample CI (Before–After)
Formula:
Example 2: Training Program Impact
A sample of 8 employees took a skills test before and after a training course:
Employee Before After
1 60 66
2 64 65
... ... ...
1. Compute differences d=After−Befored
2. Find , and build the 95% CI
Two-Sample Hypothesis Testing
Example 3: Comparing Two Training Methods
Claim: Method A leads to better scores than Method B.
Group Mean s n
A 82 5.2 30
B 78 6.1 28
H₀: μ₁ = μ₂
H₁: μ₁ > μ₂ (one-tailed test)
Test statistic:
df ≈ 27, critical t at α = 0.05 (one-tailed) ≈ 1.70
Since 2.59 > 1.70 → Reject H₀
Conclusion: Method A is significantly better.
Confidence Intervals for Proportions
Formula:
Example 4: Email Campaign Success
Group A: 60/100 clicked (60%)
Group B: 72/120 clicked (60%)
Construct a 95% CI for the difference in proportions.
Interpretation: No significant difference in click rates.
Example 5: Comparing Daily Sales Revenue
Store Mean Daily Revenue ($) Std Dev Sample Size
A 1,250 150 30
B 1,100 170 30
Task:
1. Construct a 95% CI for the difference in daily revenue.
2. Test if Store A significantly outperforms Store B.
Solution Outline:
Use two-sample t-test
Pooled standard error:
Example 6: Paired Samples - Exam Scores Before/After Tutoring
Student Before After
1 68 72
2 70 76
3 65 69
4 71 74
5 66 73
Steps:
1. Compute differences d=After−Before
2.
3.
Interpretation: Significant improvement in scores due to tutoring.
8.1 Comparing Two Population Means: Independent Samples (σ Known)
When the population standard deviations are known, and two independent
random samples are drawn from normally distributed populations, the difference
between sample means x̄ ₁ - x̄ ₂ can be used to estimate the difference between the
population means μ₁ - μ₂.
Confidence Interval:
Test Statistic:
This method assumes known population variances and is rarely used in practice
since population standard deviations are usually unknown.
8.2 Comparing Two Population Means: Independent Samples (σ Unknown)
When the population standard deviations are unknown, we estimate them using
the sample standard deviations s₁ and s₂. The test statistic then follows a t-
distribution. There are two cases to consider:
Case 1: Equal population variances assumed
Pooled variance:
Test Statistic:
Degrees of Freedom: df = n₁ + n₂ - 2
Case 2: Unequal population variances (Welch’s t-test)
Degrees of freedom are approximated using the Welch–Satterthwaite equation.
Statistical software is often used for this case.
8.3 Comparing Two Population Means: Matched-Pairs (Dependent Samples)
In a matched-pairs design, the data consist of paired observations, such as
before-and-after measurements on the same subjects or matched subjects in two
groups. The analysis focuses on the differences within pairs.
Let d = x₁ - x₂ denote the difference for each pair.
Test Statistic:
Where:
- d̄ is the mean of the differences
- sd is the standard deviation of the differences
- μd is typically 0 under the null hypothesis
- n is the number of pairs
This is a one-sample t-test applied to the difference scores.
8.4 Comparing Two Population Proportions
Suppose we have two independent samples of sizes n₁ and n₂, with sample
proportions p̂ ₁ and p̂ ₂, representing the proportion of successes in each group.
Confidence Interval:
Hypothesis Test:
To test:
H₀: p₁ = p₂ vs Hₐ: p₁ ≠ p₂
Use the pooled proportion:
Test Statistic:
8.5 Interpretation of Confidence Intervals
A confidence interval for the difference in means or proportions gives a range
of plausible values for the true difference between two populations. If the interval
contains 0, there is no statistically significant difference at the given confidence
level. If 0 is not included, we have evidence of a significant difference.
Direction and magnitude of the difference must also be interpreted in the
context of the problem. A statistically significant result may not always be
practically important.
8.6 Assumptions and Conditions
For valid inference, certain assumptions must be satisfied:
- Samples must be random and independent.
- For tests of means: populations should be approximately normal or sample sizes
should be large (n ≥ 30).
- For tests of proportions: each sample should have at least 5 successes and 5
failures.
- For matched pairs: differences should be approximately normally distributed if
the sample size is small.
Violations of assumptions may require the use of nonparametric methods or
resampling techniques.
Summary
This chapter extended inferential methods to situations involving two samples.
Whether comparing means or proportions, independent or paired samples,
confidence intervals and hypothesis tests help assess whether observed differences
are statistically significant. The tools developed here are widely used in comparing
treatment effects, evaluating marketing strategies, analyzing product performance,
and making data-driven business decisions. Understanding when and how to apply
two-sample inference methods is essential for anyone involved in comparative
analysis, experimentation, or decision-making based on sample data. Mastery of
these concepts prepares students for more complex multivariate analysis and
advanced statistical modeling.