4 comparing means-2

1. Introduction to statistical methods and hypothesis testing overview

This topic introduces the fundamental methodology for comparing the means of two independent populations, contrasting scenarios where population variances are assumed equal (pooled) versus unequal (unpooled), and outlining general course logistics and statistical tool selection.

1.1 Course Logistics and Statistical Tool Summary

The current focus of the course week involves hypothesis testing for two means (independent and paired) and understanding error types, power, and significance levels. A general statistical methodology table summarizes tests based on data type and assumptions, though this section primarily focuses on measurement data (means) for two independent sets 2 3.

1.2 Comparing Two Independent Population Means: Foundations

When comparing two independent populations, the interest lies in the difference between the population means, μ1−μ2\mu_1 - \mu_2, estimated by the sample mean difference, xˉ1−xˉ2\bar{x}_1 - \bar{x}_2. Assuming independence, the expectation of the difference in sample means is the difference in population means: mean(xˉ1−xˉ2)=μ1−μ2\text{mean}(\bar{x}_1 - \bar{x}_2) = \mu_1 - \mu_2 6.

To conduct formal testing, we hypothesize about the difference μ0\mu_0:

  • Null Hypothesis: H0:μ1−μ2=μ0H_0: \mu_1 - \mu_2 = \mu_0
  • Alternative Hypotheses can be one-tailed (>> or << ) or two-tailed (≠\neq) 8.

If population standard deviations (σ1,σ2\sigma_1, \sigma_2) are known, a Z-statistic is used; otherwise, a T-statistic is employed, relying on the estimated standard error, SE(xˉ1−xˉ2)SE(\bar{x}_1 - \bar{x}_2) 7.

1.3 Hypothesis Testing with Unequal Variances (Unpooled Approach)

When population variances are assumed unequal (σ1≠σ2\sigma_1 \neq \sigma_2), the standard error for the difference of means is estimated using individual sample variances (s12,s22s_1^2, s_2^2):

t=xˉ1−xˉ2−μ0s12n1+s22n2t = \frac{\bar{x}_1 - \bar{x}_2 - \mu_0}{\sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}}}

This test statistic follows an approximate t-distribution, whose degrees of freedom (n∗n^*) must be calculated, as the exact degrees of freedom are complex.

The rejection rules for the two-tailed test are: Reject H0H_0 if ∣t∣>tn∗,α/2|t| > t_{n^*, \alpha/2} or if 2×Pr{Tn∗>∣t∣}≤α2 \times \text{Pr}\{T_{n^*} > |t|\} \leq \alpha 10.

The calculation for the effective degrees of freedom (n∗n^*) when variances are unequal is given by the Welch-Satterthwaite equation, and the result must be rounded to the nearest integer.

Formula for calculating the effective degrees of freedom (n*) when comparing two populations using the Welch-Satterthwaite equation.

The confidence interval (CI) for μ1−μ2\mu_1 - \mu_2 when variances are unequal uses this calculated n∗n^*:

(xˉ1−xˉ2)±tn∗,α/2s12n1+s22n2(\bar{x}_1 - \bar{x}_2) \pm t_{n^*, \alpha/2} \sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}}

Formula for calculating the confidence interval for the difference between two population means when variances are unequal.

Degrees of Freedom Options

There are three options for determining the degrees of freedom (n∗n^*) when variances are unequal:

  1. Conservative Approach: n∗=min⁡(n1−1,n2−1)n^* = \min(n_1 - 1, n_2 - 1).
  2. Computed (Welch-Satterthwaite): Using the complex formula involving sample variances and sizes 9.

    Example: For Municipality I (n1=25,s1=30n_1=25, s_1=30) and Municipality II (n2=21,s2=18n_2=21, s_2=18), the calculated degrees of freedom resulted in approximately 40.1340.13, which is rounded to 4040. Formula for calculating the degrees of freedom (df) for a two-sample t-test when variances are unequal, shown with substituted values resulting in 40.13.

  3. Approximation: If both n1,n2>100n_1, n_2 > 100, approximate using the Normal distribution (Z-distribution).

1.4 Hypothesis Testing with Equal Variances (Pooled Approach)

If we assume the population standard deviations are equal (σ1=σ2=σ\sigma_1 = \sigma_2 = \sigma), a stronger, pooled variance estimate (sp2s_p^2) can be calculated. This leads to a pooled t-test, which follows an exact t-distribution with degrees of freedom df=n1+n2−2df = n_1 + n_2 - 215.

The pooled variance estimate is a weighted average of the sample variances: sp2=(n1−1)s12+(n2−1)s22n1+n2−2s_p^2 = \frac{(n_1 - 1)s_1^2 + (n_2 - 1)s_2^2}{n_1 + n_2 - 2}

Formula for calculating the pooled variance estimate (s_p^2) when comparing two populations using a t-test, assuming population variances are equal.

The resulting pooled t-statistic is: t=xˉ1−xˉ2−μ0sp1n1+1n2t = \frac{\bar{x}_1 - \bar{x}_2 - \mu_0}{s_p \sqrt{\frac{1}{n_1} + \frac{1}{n_2}}}

Comparison of the t-statistic formulas for unpooled (unequal SD) and pooled (equal SD) variance in a two-sample t-test.

A key difference from proportion testing is noted: pooling in means testing occurs if variances (σ\sigma's) are assumed equal, whereas in proportions, pooling often occurs if the null hypothesis (p1=p2p_1 = p_2) is assumed true 13.

The 100(1−α)%100(1-\alpha)\% Confidence Interval based on the pooled variance assumption is: xˉ1−xˉ2±tn1+n2−2,α/2⋅sp1n1+1n2\bar{x}_1 - \bar{x}_2 \pm t_{n_1+n_2-2, \alpha/2} \cdot s_p \sqrt{\frac{1}{n_1} + \frac{1}{n_2}} 14.

1.5 Application Example: Utility Company Consumption

A utility company compares electricity consumption between two municipalities (I and II) 16.

MunicipalitySample Mean (xˉ\bar{x})Standard Deviation (ss)Sample Size (nn)
I115 dollars30 dollars25
II98 dollars18 dollars21

A table summarizing descriptive statistics (mean, standard deviation, and sample size) for electricity consumption in two different municipalities.

Assumptions checked included independence, simple random sampling, and approximate normality, though histograms suggested some deviation from normality 17 18.

When testing for a difference (μ1−μ2=0\mu_1 - \mu_2 = 0) at α=0.05\alpha=0.05 using the unpooled approach (n∗=40n^*=40 calculated ):

  • The calculated t-statistic was compared against the critical value t0.025,40=2.021t_{0.025, 40} = 2.021.
  • Since the calculated tt exceeded this critical value, there was evidence of a difference in average monthly bills 23.

    Example: The calculation for the unpooled t-statistic leads to a result where the absolute value of tt is greater than 2.0212.021, leading to rejection of H0H_0 22. Formula for the t-statistic in a two-sample t-test when variances are assumed to be unequal (Welch's t-test).

If the pooled approach were used (df=25+21−2=44df = 25 + 21 - 2 = 44), the conclusion generally remains similar, though the choice of dfdf can affect tail probabilities. Given that the standard deviations (s1=30s_1=30 vs s2=18s_2=18) are quite different, the unpooled (Welch's) test is generally preferred unless prior reasons suggest equal variances exist. Formulas for calculating the pooled variance (s_p^2) and the resulting t-statistic (t) for a two-sample t-test assuming equal variances.

Tip: When choosing between pooled and unpooled two-sample t-tests, if sample sizes are large, the difference in results is often small. However, if sample variances (s12s_1^2 and s22s_2^2) are substantially different, defaulting to the unpooled (Welch's) test is more robust due to its less restrictive assumptions 26.

2. Hypothesis testing for paired means in non-independent populations

This section details the methodology for performing a Matched Pairs t-Test (or Paired t-Test), which is essential for analyzing data where two dependent measurements are taken from the same subjects, such as before-and-after scenarios or when using matched individuals, thereby accounting for inherent variability between the paired units 28.

2.1 Motivation for using paired designs

When comparing two groups, such as American and Canadian manufacturing companies, simply comparing independent random samples can be problematic due to high variance caused by unmeasured confounding factors (e.g., company size, sector). A better approach involves matching companies based on relevant statistics and then analyzing the mean of the differences between these pairs 29.

Similarly, in contexts like weight loss clinics, comparing current clients to non-clients introduces sampling bias because those who join the clinic are already motivated regarding weight loss. The paired approach eliminates this by measuring each client's weight before and after a period of attendance, creating dependent measurements for each subject 30.

2.2 The Matched Pairs t-Test procedure

The paired t-test is fundamentally an application of the one-sample t-test performed on the differences between the paired observations, not the original measurements.

The structure of the data involves nn subjects, each providing two linked measurements: "Before" (xix_i) and "After" (yiy_i), from which a difference, di=xi−yid_i = x_i - y_i, is calculated for each subject ii 31.

The formal hypothesis test setup is as follows:

  • Null Hypothesis (H0H_0): The true mean difference is zero, H0:μd=0H_0: \mu_d = 0.
  • Alternative Hypothesis (HaH_a): The true mean difference is not zero, or directional (μd≠0\mu_d \neq 0, μd>0\mu_d > 0, or μd<0\mu_d < 0).

The test statistic (tstatt_{stat}) is calculated using the sample mean difference (dˉ\bar{d}) and the standard deviation of the differences (sds_d) relative to the sample size (nn): tstat=dˉ−0sd/nt_{stat} = \frac{\bar{d} - 0}{s_d / \sqrt{n}} The associated p-value is determined using the t-distribution with degrees of freedom df=n−1df = n-1. For a two-sided test, the p-value is 2×Pr(T>∣tstat∣)2 \times \text{Pr}(T > |t_{stat}|) 32.

The slide outlines the steps and formulas for performing a Matched Pairs t-Test, including the null and alternative hypotheses, the test statistic formula, and the p-value calculation logic.

Tip: When implementing this test in statistical software, it is crucial to select the appropriate option to calculate the test on the differences between Variable 1 and Variable 2, ensuring H0:μD=0H_0: \mu_D = 0 is tested, where μD=μ1−μ2\mu_D = \mu_1 - \mu_2 39.

Configuration window for performing a Paired T-test in statistical software.

2.3 Assumptions for the Paired t-Test

The validity of the paired t-test rests on specific assumptions that must be checked:

  1. Paired Data & Independence: The data must consist of two linked observations per individual, and the individuals themselves must be randomly selected (Simple Random Sample, SRS).
  2. Population Size: The sample size (nn) should be small relative to the total population size (NN), typically n<0.1×Nn < 0.1 \times N.
  3. Normality of Differences: The histogram of the calculated differences (did_i) must be roughly Normal. It is the distribution of the differences, not the individual samples, that must satisfy this condition 35.

Example: In a learning evaluation example, the "Before" and "After" scores are paired data points from 20 students. We calculate the difference for each student (di=Post-test−Pre-testd_i = \text{Post-test} - \text{Pre-test}) and perform a one-sample t-test on these 20 difference scores 33.

For the learning evaluation example, given dˉ=1.45\bar{d}= 1.45, sd=3.203s_d = 3.203, and n=20n = 20, testing H0:μd=0H_0: \mu_d = 0 versus Ha:μd>0H_a: \mu_d > 0: tstat=1.45−03.203/20≈2.02t_{stat} = \frac{1.45 - 0}{3.203 / \sqrt{20}} \approx 2.02 Since t19,α=0.05=1.729t_{19, \alpha=0.05} = 1.729, and 2.02>1.7292.02 > 1.729, there is evidence at the 5% significance level to suggest that students' perception of learning improved after the midterm exam 34.

2.4 Application Example: Product Displays

Consider a manufacturer testing two point-of-purchase displays (A and B) across 15 randomly selected stores. Each store uses Display A for one week and Display B for another, recording sales each week. The goal is to determine if the display type impacts sales using α=0.05\alpha=0.05 36.

The observed data includes sales for A and B, and the calculated difference did_i (A - B) for 15 observations: A table displaying product counts (A and B) across 15 locations and the difference (d_i) between them for a product display example.

Summary statistics for the differences are calculated: n=15n=15, dˉ=4.13\bar{d}= 4.13, and sd=3.36s_d = 3.36 37.

For the test H0:μd=0H_0: \mu_d = 0 versus Ha:μd≠0H_a: \mu_d \neq 0 at α=0.05\alpha = 0.05: tstat=4.133.36/15≈4.77t_{stat} = \frac{4.13}{3.36 / \sqrt{15}} \approx 4.77 The critical value is t14,α/2=0.025=2.145t_{14, \alpha/2=0.025} = 2.145. Since 4.77>2.1454.77 > 2.145, the null hypothesis is strongly rejected 38.

The conclusion is supported by a confidence interval for μd\mu_d. If the 95% CI for μd\mu_d is calculated to be between 2.27 and 5.99 sales/week, the fact that 0 does not fall within this interval confirms the rejection of H0:μd=0H_0: \mu_d = 0 41.

2.5 Warning against incorrect independent testing

A critical error occurs when the researcher fails to recognize that the data is paired and mistakenly applies an independent two-sample t-Test 42.

If the summary statistics for the two samples were calculated incorrectly as independent samples (xA=23.8,sA=12.33x_A = 23.8, s_A = 12.33 and xB=20.33,sB=13.04x_B = 20.33, s_B = 13.04), a two-sample test might lead to a conclusion that fails to reject the null hypothesis (μA−μB=0\mu_A - \mu_B = 0).

This slide illustrates the calculation steps and summary statistics for an incorrect application of a two-sample t-Test when data should have been paired.

The paired t-test is more powerful because it isolates and estimates the variability between the displays while effectively controlling for the high variability within the samples (e.g., inherent sales fluctuations between different stores). Failing to account for the pairing reduces the power of the test and can lead to incorrect conclusions, as seen when the paired test rejects the null while the independent test supports it 43.

3. Summary of statistical tests and introduction to error types

This section summarizes the hypothesis tests covered for means and proportions, details the conditions for their application, and introduces the critical concepts of Type I and Type II errors in hypothesis testing.

3.1 Review of Hypothesis Tests for Means and Proportions

The foundational requirement for performing tests on means is that the sampling distribution of the sample mean, xˉ\bar{x}, must be Normal. This condition is satisfied either when the population distribution is Normal or when the sample size (nn) is large enough (Central Limit Theorem) 46.

Specific tests reviewed include:

  • One-sample z-test: Used when the population standard deviation (σ\sigma) is known. The test statistic follows a standard Normal distribution, Z∼N(0,1)Z \sim N(0, 1), calculated as: zstat=xˉ−μσ/nz_{\text{stat}} = \frac{\bar{x} - \mu}{\sigma/\sqrt{n}}
  • One-sample t-test: Used when the population standard deviation (σ\sigma) is unknown, necessitating the use of the sample standard deviation (ss).

The summary moves on to compare two samples, covering dependent and independent scenarios:

  • Paired t-test: Utilized when there are two dependent observations per subject (e.g., before-and-after measurements) to compare the mean difference.
  • Two-sample t-test: Used to compare the means of two independent populations.
  • Pooled two-sample t-test: A specific version of the two-sample t-test requiring the additional assumption that the standard deviations in both populations are equal.

The calculation of test statistics for paired and two-sample t-tests are summarized by their respective formulas: Formulas for calculating the t-statistic for paired and two-sample t-tests.

Tip: When dealing with dependent samples (paired data), the paired t-test analyzes the mean difference (dˉd̄) directly, effectively reducing the two-sample problem to a one-sample problem on the differences.

3.2 Interpretation and Caveats of Hypothesis Tests

A statistical test assesses the evidence against the null hypothesis (H0H_0), but it is crucial to understand its limitations regarding study design and practical relevance.

Key considerations when interpreting hypothesis tests:

  • The test cannot correct for a flawed study design.
  • Random sampling is a necessary prerequisite for valid inference.
  • Statistical significance (small p-value) indicates a real effect beyond sampling variation. Practical significance assesses whether this effect has a meaningful real-world impact, often supported by examining confidence intervals 51.
  • Always check for outliers, as they can unduly influence results.
  • A non-significant result must not be ignored; it might indicate a practically important difference that was missed due to measurement issues or low statistical power.
  • Researchers must guard against "searching for statistical significance" or conducting tests with inherently low power, which is defined as the probability of correctly rejecting a false null hypothesis 52.

3.3 Types of Errors in Hypothesis Testing

Hypothesis testing involves drawing conclusions based on sample data, which inherently carries the risk of making incorrect decisions regarding the true state of the population. There are two primary ways a conclusion can be wrong.

These potential errors are mapped out in the decision matrix: A decision matrix illustrating the four possible outcomes in hypothesis testing based on the true state and the decision made.

The two types of errors are formally defined:

  • Type I Error (α\alpha, False Positive): Occurs when the researcher rejects the null hypothesis (H0H_0) when it is actually true. The probability of committing this error is denoted by α\alpha (the significance level).
  • Type II Error (β\beta, False Negative): Occurs when the researcher fails to reject the null hypothesis (H0H_0) when it is actually false. The probability of this error is denoted by β\beta.

The correct decisions in hypothesis testing are:

  • Correct Decision (Accepting H0H_0): Failing to reject H0H_0 when H0H_0 is true, with probability 1−α1 - \alpha.
  • Power (1−β1 - \beta): Correctly rejecting H0H_0 when H0H_0 is false. Increasing power is a primary goal in study design 53.

Example: In a legal setting where H0H_0: A defendant is not guilty:

  • Type I Error: Convicting an innocent person (rejecting a true H0H_0).
  • Type II Error: Letting a guilty person go free (failing to reject a false H0H_0) 54.

3.4 Summary of Appropriate Statistical Tests

The selection of the appropriate test depends fundamentally on the nature of the data (Measurement vs. Categorical) and whether the assumption of Normality can be reasonably made 55.

The decision table organizes the appropriate statistical procedures based on these criteria: This table summarizes appropriate statistical tests based on data type (Measurement vs. Categorical) and the assumption of normality.

For Measurement Data under the assumption of normality:

  • One sample: One sample t-test or z-test (if population SD is known).
  • Two independent samples: Two-sample t-test (pooled or unpooled).
  • Two dependent samples: Matched pairs test.

For Categorical Data, tests focus on proportions:

  • One sample: One sample proportion test.
  • Two independent samples: Two sample proportion test (pooled or unpooled, depending on covariance assumptions).
  • Two dependent samples: Two sample proportion test with non-zero covariance, or the Binomial test. </document_content>

Common mistakes to avoid

  • Review all topics thoroughly before exams
  • Pay attention to formulas and key definitions
  • Practice with examples provided in each section
  • Don't memorize without understanding the underlying concepts

© 2026 Maeve. All rights reserved. This content is protected by copyright.

See also