13. Inference for Paired Means

Math 115

Yurk and Martin

A Different Kind of Comparison

Previously, we compared two independent groups (different subjects).

Sometimes data come in pairs — two measurements on the same unit.

Examples of paired data:

  • Blood pressure before and after taking medication (same patients)
  • Prices of the same textbook at Amazon vs. bookstore
  • Reaction time with left hand vs. right hand (same people)

Paired Test Design Methods

For a paired design, response values come in pairs, with one response value in the pair for first group and one for the second group.

  • Paired design using matching—the pairs come from matching similar individuals to create groups of two
  • Paired design using repeated measures—the pairs come from measuring the same individual twice, once under each condition
  • Cause-and-effect can be determined if the assignment of the individuals to the two groups or the order of the conditions is random

Is It Paired? Quick Examples

Scenario Paired or Independent?
Compare test scores of tutored vs. non-tutored students Independent
Compare weight before and after a diet program Paired repeated measures
Compare salaries of men vs. women at a company Independent
Compare prices of same product at two stores Paired repeated measures
Compare test results for two study strategies, matching students by pretesting Paired using matching

Key question: Is there a natural pairing between observations or can we define a pairing with matching?

Why Does Pairing Matter?

Pairing controls for individual differences.

  • Each subject serves as their own control
  • Removes subject-to-subject variability
  • Often results in more powerful tests

Example: Testing a new blood pressure medication

  • Paired design: Measure same patients before and after → differences remove variation between patients
  • Independent design: Compare different people → must account for natural differences between individuals

The Key Insight

With paired data:

  1. Compute the difference for each pair
  2. Analyze the differences as a single sample

This reduces the two-sample problem to a one-sample problem!

We already know how to do this (Inference for a Single Mean).

Statistics and Parameters for Paired Data

Statistic (sample) Parameter (population)
Mean difference \(\bar{x}_d\) \(\mu_d\)
SD of differences \(s_d\) \(\sigma_d\)

Statistic of interest: \(\bar{x}_d\) (sample mean of differences)

Goal: Make inferences about \(\mu_d\) (population mean difference)

Connection to Single Mean Scenario

One Mean Paired Data
Data Single measurements Differences
Statistic \(\bar{x}\) \(\bar{x}_d\)
Parameter \(\mu\) \(\mu_d\)
SE \(s/\sqrt{n}\) \(s_d/\sqrt{n}\)
df \(n - 1\) \(n_{pairs} - 1\)

Same formulas, just applied to differences!

Textbook Prices

Will you save money buying textbooks from Amazon instead of the UCLA bookstore?

  • Data: 68 textbooks with prices at both locations
  • This is PAIRED: Same book measured at two stores
  • Variable: price_diff = UCLA price − Amazon price

Research question: On average, do UCLA bookstore prices differ from Amazon prices?

EDA: Textbook Price Differences

n \(\bar{x}_d\) \(s_d\)
68 $3.58 $13.42

On average, UCLA bookstore prices are $3.58 higher than Amazon.

Hypotheses for Textbook Prices

Let \(\mu_d\) = mean price difference (UCLA − Amazon) for all textbooks

Hypotheses:

  • \(H_0: \mu_d = 0\) (no difference in prices on average)
  • \(H_A: \mu_d \neq 0\) (prices differ on average)

This is a two-sided test.

Hypothesis Test Using Random Permutation

  • We can use randomization to simulate variability in the statistic under the null hypothesis
  • The price is independent of group assignment
  • To simulate independence between price and bookseller, we randomly reassign the book prices for each book
  • We can think of the randomization as flipping a coin for each book to determine which of the two assignments will occur in the randomized sample

Randomizing for Textbook Prices

  • Here are the data for the first book
subject course_num bookstore_new amazon_new price_diff
American Indian Studies M10 47.97 47.45 0.52
  • Random reassignment results in one of two possible outcomes: original prices or swapped prices
subject course_num bookstore_new amazon_new price_diff
American Indian Studies M10 47.97 47.45 0.52

Or

subject course_num bookstore_new amazon_new price_diff
American Indian Studies M10 47.45 47.97 -0.52

Textbook Paired Data Null Distribution

  • We can simulate a true null hypothesis by randomly swapping the prices of the books

Conclusion: Hypothesis Test

Results:

  • P-value = 0.0148`
  • Using α = 0.05: P-value < 0.05

Decision: Reject \(H_0\)

Conclusion: The data provide convincing evidence that, on average, UCLA bookstore prices differ from Amazon prices for textbooks.

Checking Conditions for Mathematical Model

Independence:

  • Random sample of textbooks ✓
  • Each textbook is independent of others ✓

Normality:

  • n = 68 ≥ 30 ✓
  • The data are skewed and there are outliers

We will proceed cautiously with using the t-distribution, but randomization would be preferred

Test Statistic

Degrees of freedom: \(df = n - 1 = 68 - 1 = 67\)

Standard error:

\[SE = \frac{s_d}{\sqrt{n}} = \frac{13.42}{\sqrt{68}} = 1.63\]

T-statistic:

\[T = \frac{\bar{x}_d - 0}{SE} = \frac{3.58 - 0}{1.63} = 2.2\]

Calculating the P-value

Use a t-distribution (df = 67).

P-value = 0.0312 (from Jamovi)

Conclusion: Hypothesis Test

Results:

  • T = 2.2
  • P-value = 0.0312
  • Using α = 0.05: P-value < 0.05

Decision: Reject \(H_0\)

Conclusion: The data provide convincing evidence that, on average, UCLA bookstore prices differ from Amazon prices for textbooks. However, we should be cautious given the skew and outliers present in the data. The randomization results are similar and verify this result.

Boostrap CI for Paired Data

  • We can calculate bootstrap percentile CI using the same approach as in the single mean case
  • We resample price differences (UCLA - Amazon) from the sample with replacement to simulate the variability in the statistic

Mathematical Model CI for Mean Difference

Given: \(\bar{x}_d = 3.58\), \(SE = 1.63\), \(df = 67\)

Critical value: \(t^*_{67} = 1.996\) (from Jamovi)

95% CI:

\[3.58 \pm 1.996 \times 1.63 = (0.33, 6.83)\]

Interpreting the CI

95% CI: ($0.33, $6.83)

Interpretation: We are 95% confident that the mean price difference (UCLA − Amazon) for all textbooks is between $0.33 and $6.83.

Does CI include 0? No

This is consistent with our hypothesis test—we rejected \(H_0\), and 0 is not in the CI. However, the results are different than the randomization which is more reliable for the highly skewed data.

When to Use Paired Analysis

Use paired analysis when there is a natural pairing:

  • Same subjects measured twice: before/after, pre/post
  • Same item under two conditions: two stores, two methods
  • Matched pairs: twins, matched controls

Key insight: If you can match each observation in one group with exactly one observation in the other group, the data are paired.

Summary

Paired data → Compute differences → Analyze as one sample

Component Formula
Standard Error \(SE = \frac{s_d}{\sqrt{n}}\)
Degrees of freedom \(df = n_{pairs} - 1\)
T-statistic \(T = \frac{\bar{x}_d - 0}{SE}\)
CI \(\bar{x}_d \pm t^*_{df} \times SE\)

Conditions: Independence of pairs + Normality of differences

Same as Topic 11, just applied to differences!

References