Contents

Chapter 10: Inferences for Two Population Means

Comparing $\mu_1$ vs. $\mu_2$ — Independent & Paired Samples

Pooled t • Nonpooled t •Mann-Whitney • Paired t • Paired Wilcoxon

The Inference Roadmap — Where We Are

We finished one-mean hypothesis testing (Ch. 9). Now we compare twopopulations.

INFERENCE

One-Mean (Ch.9)

  • z-Test ✓
  • t-Test ✓
  • Wilcoxon Signed-Rank ✓
We are here!

Two-Mean (Ch.10)

Pooled tNonpooled tMann-WhitneyPaired tPaired Wilcoxon

10.1 Comparing Two Population Means

The fundamental question: Is the mean of Population 1 different from the mean of Population 2? We use two independent samples to find out.

Figure 10.1 — The Two-Sample Process

Population 1

e.g., Faculty in private institutions

Sample 1

Compute $\bar{x}_1$

vs.

Population 2

e.g., Faculty in public institutions

Sample 2

Compute $\bar{x}_2$

→

Compare

$\bar{x}_1 - \bar{x}_2$

to make a decision about $\mu_1 - \mu_2$

Key Fact 10.1: Sampling Distribution of $\bar{x}_1 - \bar{x}_2$

Suppose $x$ is normally distributed on each of two populations. For independent samples of sizes $n_1$ and $n_2$:

Three Key Properties

  • Mean: $\mu_{\bar{x}_1 - \bar{x}_2} = \mu_1 - \mu_2$
  • Std. Dev.:
    $\sigma_{\bar{x}_1 -\bar{x}_2} = \sqrt{\dfrac{\sigma_1^2}{n_1} + \dfrac{\sigma_2^2}{n_2}}$
  • Shape: $\bar{x}_1 - \bar{x}_2$ is normally distributed
Why does this matter?

This is the foundation for every two-mean inference procedure. When $H_0: \mu_1 = \mu_2$ is true, then $\mu_1 - \mu_2 = 0$, so the difference $\bar{x}_1 - \bar{x}_2$ is centered at zero. A large observed difference is unlikely by chance alone — that's the basis of our test.

Under $H_0$: $\mu_1 = \mu_2$

$\bar{x}_1 - \bar{x}_2$ centered at 0

Two Types of Two-Sample Designs

Before choosing a test, identify the sampling design. The entire analysis depends on this.

Independent Samples

The two samples are drawn completely separately from each other.Observations in Sample 1 have no natural pairing with observations in Sample 2.

Example: 32 faculty from private universities and 35 faculty from public universities — two separate groups.

Methods: Pooled t-test,Nonpooled t-test, Mann-Whitney

Paired Samples

Each observation in Sample 1 is naturally matched to exactly one observation in Sample 2 — same subject measured twice, or matched pairs.

Example: Blood pressure measured before and after a treatment on the same 20 patients.

Methods: Paired t-test, Paired Wilcoxon

This choice is not optional. Using an independent-sample method on paired data — or vice versa — produces incorrect results. Identify the design first, every time.

10.2 Key Fact 10.2: The Pooled t-Statistic

Used when we assume both populations have equal standard deviations ($\sigma_1 = \sigma_2$).

Distribution of the Pooled t-Statistic

Suppose $x$ is normally distributed on each of two populations and population standard deviations are equal. For independent samples of sizes $n_1$ and $n_2$,the variable:

$$t = \frac{(\bar{x}_1 - \bar{x}_2) - (\mu_1 - \mu_2)}{s_p \sqrt{(1/n_1) + (1/n_2)}}$$

has the $t$-distribution with$df = n_1 + n_2 - 2$

The Pooled Standard Deviation $s_p$

Because we assume $\sigma_1 = \sigma_2$, we pool both sample variances into one combined estimate:

$$s_p = \sqrt{\frac{(n_1 - 1)s_1^2 + (n_2 - 1)s_2^2}{n_1 + n_2 - 2}}$$

Weighted average of both sample variances — larger sample gets more weight.

Procedure 10.1: Pooled t-Test

Assumptions

  • Simple random samples
  • Independent samples
  • Normal populations or large samples
  • Equal population standard deviations ($\sigma_1 = \sigma_2$)

Hypotheses

Type$H_0$$H_a$
Two-tailed$\mu_1 = \mu_2$$\mu_1 \neq \mu_2$
Left-tailed$\mu_1 = \mu_2$$\mu_1 < \mu_2$
Right-tailed$\mu_1 = \mu_2$$\mu_1 > \mu_2$

The 6 Steps

  1. State $H_0$ and $H_a$.
  2. Set significance level $\alpha$.
  3. Compute $t = \dfrac{\bar{x}_1 - \bar{x}_2}{s_p \sqrt{(1/n_1)+(1/n_2)}}$
  4. P-value: Use $t$ table with $df = n_1 + n_2 -2$.
    Critical-value: Find $\pm t_{\alpha/2}$, $-t_\alpha$, or$t_\alpha$.
  5. If $P \leq \alpha$ (or stat falls in rejection region), reject $H_0$.
  6. State conclusion in context.
Note: Exact for normal populations; approximately correct for large samples from non-normal populations.

Procedure 10.2: Pooled t-Interval for $\mu_1 - \mu_2$

Confidence Interval Endpoints

For confidence level $1 - \alpha$, first find $t_{\alpha/2}$ with $df = n_1 +n_2 - 2$, then:

$$(\bar{x}_1 - \bar{x}_2) \pm t_{\alpha/2} \cdot s_p \sqrt{\frac{1}{n_1} + \frac{1}{n_2}}$$

where $s_p = \sqrt{\dfrac{(n_1-1)s_1^2 +(n_2-1)s_2^2}{n_1+n_2-2}}$

Interpreting the CI: We are $(1-\alpha)\times 100\%$ confident that the true difference $\mu_1 - \mu_2$ lies in this interval. If the interval does not contain 0, we have evidence that $\mu_1 \neq \mu_2$.
Consistency Check: The conclusion from the pooled t-test and the pooled t-interval will always agree. If the CI excludes 0, the corresponding two-tailed test at the same $\alpha$ will reject $H_0$.

10.3 Key Fact 10.3: The Nonpooled t-Statistic

Used when we do not assume equal standard deviations. The standard error uses both sample variances separately.

The Nonpooled t-Statistic

Suppose $x$ is normally distributed on two populations. For independent samples, the variable:

$$t = \frac{(\bar{x}_1 - \bar{x}_2) - (\mu_1 - \mu_2)}{\sqrt{(s_1^2 / n_1) + (s_2^2 /n_2)}}$$

has approximately a$t$-distribution with $df = \Delta$ (rounded down to nearest integer)

Welch's Degrees of Freedom $\Delta$

Always round $\Delta$ down (use floor() in R). This keeps the procedure conservative.

$$\Delta = \frac{\left[\dfrac{s_1^2}{n_1} +\dfrac{s_2^2}{n_2}\right]^2}{\dfrac{(s_1^2/n_1)^2}{n_1-1} + \dfrac{(s_2^2/n_2)^2}{n_2-1}}$$

In R:floor(delta) gives the correct $df$

Procedure 10.3 & 10.4: Nonpooled t-Test and Interval

Procedure 10.3: Nonpooled t-Test

Follows the same 6-step logic as the Pooled t-Test, but uses:

  • Test statistic: $t = \dfrac{\bar{x}_1 - \bar{x}_2}{\sqrt{(s_1^2/n_1) +(s_2^2/n_2)}}$
  • Degrees of freedom: $df = \Delta$ (Welch's formula)
  • No pooling of variances
Assumptions: Simple random samples, independent, normal populations or large samples. No assumption about equal SDs.

Procedure 10.4: Nonpooled t-Interval

For confidence level $1-\alpha$, find $t_{\alpha/2}$ with $df = \Delta$:

$$(\bar{x}_1 - \bar{x}_2) \pm t_{\alpha/2} \cdot \sqrt{\frac{s_1^2}{n_1} +\frac{s_2^2}{n_2}}$$
Always round $\Delta$ down. Using the floor of $\Delta$ makes the procedure conservative — it gives a slightly wider interval and makes it harder to reject $H_0$, which is the safe direction.

Key Fact 10.4: Pooled or Nonpooled?

If you are reasonably sure the standard deviations are nearly equal, use pooled;otherwise, use nonpooled.

Use Pooled t

  • $\sigma_1 \approx \sigma_2$ — strong prior knowledge or subject-matter reason to believe SDs are equal
  • Sample SDs are close (rough rule: ratio $s_1/s_2$ is between 0.5 and 2)
  • $df = n_1 + n_2 - 2$ (more power)

Use Nonpooled t

  • SDs appear substantially different
  • No strong reason to assume equal variances
  • $df = \Delta$ (Welch's approximation — slightly conservative)
  • When in doubt, default to nonpooled.
Practical Note: In R, t.test() with var.equal = TRUE performs the pooled test; var.equal = FALSE (the default) performs the nonpooled(Welch) test. Always comment on your choice.

10.4 The Mann-Whitney Test

A nonparametric alternative for independent samples when normality cannot be assumed. Works on same-shape distributions.

Definition 10.1: Same Shape

Distributions have the same shape if they are identical except for the location of their centers.

Procedure 10.5: Mann-Whitney

Assumptions: Simple random independent samples from same-shape populations.

Test Statistic $M$: Combine both samples, rank all observations from smallest (1) to largest. Then:

$M$ = sum of ranks for Sample 1

Complement Relation:

$M_{1-A} = n_1(n_1 + n_2 +1) - M_A$

Figure 10.9: Selecting the Right Procedure

PopulationsShapeUse
NormalSame ($\sigma_1 = \sigma_2$)Pooled t-test
NormalDifferentNonpooled t-test
Non-normalSame shapeMann-Whitney
Not both normalDifferent, large $n$Nonpooled t-test
Not both normalDifferent, small $n$Consult statistician
Key Fact 10.5: If the distributions are normal, the pooled t-test is preferred over Mann-Whitney. Mann-Whitney is for the non-normal case with same-shape distributions.

10.5 Inferences for Two Means: Paired Samples

When each observation in one sample is naturally matched to an observation in the other, we work with the paired differences $d = x_1 - x_2$.

The Big Idea

Instead of comparing two separate samples, we reduce the problem to aone-sample analysis on the differences:

$d_i = x_{1i} - x_{2i}$

Then use $\bar{d}$ (mean of differences) and $s_d$ (SD of differences) just like the one-mean tests from Chapter 9.

Key Fact 10.6: Paired t-Statistic

For paired samples of size $n$, if the paired-difference variable $d$ is normally distributed:

$$t = \frac{\bar{d} - (\mu_1 - \mu_2)}{s_d / \sqrt{n}}$$

has the $t$-distribution with$df = n - 1$

Why paired? Pairing controls for individual variation. If you measured blood pressure on the same 20 subjects before and after treatment, using an independent-sample test would inflate the error variance — pairing removes that noise.

Procedure 10.6 & 10.7: Paired t-Test and Interval

Procedure 10.6: Paired t-Test

Assumptions: Simple random paired sample; normal differences or large sample ($n \geq 30$).

The 6 Steps

  1. State $H_0: \mu_1 = \mu_2$ (i.e., $\mu_d = 0$) and $H_a$.
  2. Choose $\alpha$.
  3. Compute $\bar{d}$, $s_d$, then: $t = \dfrac{\bar{d}}{s_d / \sqrt{n}}$, with $df = n-1$
  4. Find P-value (or critical values) using $t$ table, $df = n-1$.
  5. If $P \leq \alpha$, reject $H_0$.
  6. Interpret in context.

Procedure 10.7: Paired t-Interval

For confidence level $1-\alpha$, find $t_{\alpha/2}$ with $df = n-1$:

$$\bar{d} \pm t_{\alpha/2} \cdot \frac{s_d}{\sqrt{n}}$$
Interpretation: We are $(1-\alpha)\times 100\%$ confident that the true mean difference $\mu_1 - \mu_2$ lies in this interval. If the interval contains 0, the data does not support a significant difference.
Note: Exact for normal differences; approximately correct for large $n$with non-normal differences.

10.6 Paired Wilcoxon Signed-Rank Test

When paired differences are not normally distributed but aresymmetric, use this nonparametric alternative.

Procedure 10.8

Assumptions: Simple random paired sample; symmetric differences.

Steps:

  1. Compute differences $d_i = x_{1i} - x_{2i}$.
  2. Take absolute values $|d_i|$; discard zero differences.
  3. Rank the nonzero $|d_i|$ from smallest (1) to largest.
  4. Restore signs: multiply each rank by the sign of $d_i$.
  5. Test statistic: $W = \text{sum of positive ranks}$
$W_{1-A} = \dfrac{n(n+1)}{2} -W_A$

Use Table V (Wilcoxon) or software for P-values.

Key Fact 10.7: Paired Wilcoxon vs. Paired t

DifferencesUse
Normal (or large $n$)Paired t-test
Non-normal, symmetricPaired Wilcoxon
Non-normal, asymmetric, large $n$Paired t-test (CLT)
Non-normal, asymmetric, small $n$Consult statistician
Why rank instead of use raw values? Ranks are robust to skew and extreme outliers. The test cares about the order of the differences, not their exact magnitude — just like the one-sample Wilcoxon from Ch. 9.

R Code: Pooled t-Test & Interval (Procedure 10.1 & 10.2)

Use when assuming equal population standard deviations(var.equal = TRUE).

Pooled t — R Implementation
# --- METHOD A: Raw Data ---
x1 <- c(...)    # Sample 1 observations
x2 <- c(...)    # Sample 2 observations

# Pooled t-test (var.equal = TRUE assumes sigma1 = sigma2)
result <- t.test(x1, x2, var.equal = TRUE, conf.level = 0.95,
                 alternative = "two.sided")   # or "less" / "greater"
result

# --- METHOD B: Summary Statistics ---
n1 <- ?  ;  xbar1 <- ?  ;  s1 <- ?
n2 <- ?  ;  xbar2 <- ?  ;  s2 <- ?

# Pooled SD
sp <- sqrt(((n1-1)*s1^2 + (n2-1)*s2^2) / (n1+n2-2))

# Test statistic
t_stat <- (xbar1 - xbar2) / (sp * sqrt(1/n1 + 1/n2))
df     <- n1 + n2 - 2

# P-values (choose one based on Ha)
p_two   <- 2 * (1 - pt(abs(t_stat), df))   # Ha: mu1 != mu2
p_left  <- pt(t_stat, df)                   # Ha: mu1 < mu2
p_right <- 1 - pt(t_stat, df)              # Ha: mu1 > mu2

# 95% Confidence Interval for mu1 - mu2
t_crit <- qt(0.975, df)
ci_low  <- (xbar1 - xbar2) - t_crit * sp * sqrt(1/n1 + 1/n2)
ci_high <- (xbar1 - xbar2) + t_crit * sp * sqrt(1/n1 + 1/n2)
c(ci_low, ci_high)

R Code: Nonpooled t-Test & Interval (Procedure 10.3 & 10.4)

Default in R. Do not assume equal SDs — uses Welch's $\Delta$ degrees of freedom.

Nonpooled t (Welch) — R Implementation
# --- METHOD A: Raw Data ---
x1 <- c(...)    # Sample 1
x2 <- c(...)    # Sample 2

# Nonpooled t-test (var.equal = FALSE is the R default = Welch test)
result <- t.test(x1, x2, var.equal = FALSE, conf.level = 0.95,
                 alternative = "two.sided")   # or "less" / "greater"
result

# --- METHOD B: Summary Statistics ---
n1 <- ?  ;  xbar1 <- ?  ;  s1 <- ?
n2 <- ?  ;  xbar2 <- ?  ;  s2 <- ?

# Welch degrees of freedom (Delta) — round DOWN
delta <- ((s1^2/n1 + s2^2/n2)^2) /
         ((s1^2/n1)^2/(n1-1) + (s2^2/n2)^2/(n2-1))
df <- floor(delta)

# Test statistic
t_stat <- (xbar1 - xbar2) / sqrt(s1^2/n1 + s2^2/n2)

# P-values
p_two   <- 2 * (1 - pt(abs(t_stat), df))
p_left  <- pt(t_stat, df)
p_right <- 1 - pt(t_stat, df)

# 95% CI
t_crit  <- qt(0.975, df)
margin  <- t_crit * sqrt(s1^2/n1 + s2^2/n2)
c((xbar1 - xbar2) - margin, (xbar1 - xbar2) + margin)

R Code: Paired t-Test & Interval (Procedure 10.6 & 10.7)

Use paired = TRUE when each row in x1 is matched to the corresponding row in x2.

Paired t — R Implementation
# --- METHOD A: Raw Paired Data ---
x1 <- c(...)    # Before (or Group 1), ordered by subject
x2 <- c(...)    # After  (or Group 2), same order

result <- t.test(x1, x2, paired = TRUE, conf.level = 0.95,
                 alternative = "two.sided")   # or "less" / "greater"
result

# --- METHOD B: Work With Differences Directly ---
d     <- x1 - x2          # Paired differences
dbar  <- mean(d)
sd_d  <- sd(d)
n     <- length(d)
df    <- n - 1

# Test statistic
t_stat <- dbar / (sd_d / sqrt(n))

# P-values (choose based on Ha)
p_two   <- 2 * (1 - pt(abs(t_stat), df))   # Ha: mu1 != mu2
p_left  <- pt(t_stat, df)                   # Ha: mu1 < mu2
p_right <- 1 - pt(t_stat, df)              # Ha: mu1 > mu2

# 95% Confidence Interval for mu1 - mu2
t_crit <- qt(0.975, df)
ci_low  <- dbar - t_crit * sd_d / sqrt(n)
ci_high <- dbar + t_crit * sd_d / sqrt(n)
c(ci_low, ci_high)

10.7 Table 10.15: Summary of All Procedures

Every two-mean procedure at a glance — assumptions, test statistic, and degrees of freedom.

ProcedureKey AssumptionsTest Statisticdf
Pooled t-test
Proc. 10.1
Independent, Normal/Large,
$\sigma_1 = \sigma_2$
$t = \dfrac{\bar{x}_1 - \bar{x}_2}{s_p \sqrt{1/n_1 + 1/n_2}}$$n_1 + n_2 - 2$
Nonpooled t
Proc. 10.3
Independent, Normal/Large,
$\sigma_1, \sigma_2$ unrestricted
$t = \dfrac{\bar{x}_1 - \bar{x}_2}{\sqrt{s_1^2/n_1 + s_2^2/n_2}}$$\Delta$ (Welch)
Mann-Whitney
Proc. 10.5
Independent,
Same-shape distributions
$M = \text{sum of ranks (Sample 1)}$—
Paired t-test
Proc. 10.6
Paired, Normal differences
or large $n$
$t = \dfrac{\bar{d}}{s_d / \sqrt{n}}$$n - 1$
Paired Wilcoxon
Proc. 10.8
Paired,
Symmetric differences
$W = \text{sum of positive ranks}$—

Questions?

Chapter 10 — Condensed Takeaways
  • Independent samples: Choose Pooled t ($\sigma_1=\sigma_2$), Nonpooled t(otherwise), or Mann-Whitney (non-normal, same shape).
  • Paired samples: Reduce to one-sample problem on $d_i = x_{1i} -x_{2i}$. Use Paired t (normal/large) or Paired Wilcoxon (symmetric, non-normal).
  • Degrees of freedom: Pooled → $n_1+n_2-2$; Nonpooled → $\Delta$ (floor);Paired → $n-1$.
  • Default in R:t.test(x1, x2) uses Welch (nonpooled). Add var.equal=TRUE for pooled, paired=TRUE for paired.
  • When in doubt about equal variances: Use nonpooled — it is the conservative and safer choice.