From the free course AP Statistics on Lykke
4.9 Setting Up a Test for the Difference Between Two Population Means
Key concepts: Two-sample t-test — the procedure for comparing two population means · H₀: μ₁ − μ₂ = 0 — no difference between the populations · One-sided versus two-sided Hₐ — direction chosen before seeing data · Parameters stated in context — response variable and both populations · Randomization condition — independent random samples or random assignment · Sample-size condition — n ≥ 30, or no strong skew
When we observe a difference between two sample means—say, Brand A batteries lasting 4 hours longer on average than Brand B—we face the fundamental challenge of statistical inference: is this "signal" a reflection of a true difference in the populations, or is it merely "noise" generated by the luck of the draw in…
When we observe a difference between two sample means—say, Brand A batteries lasting 4 hours longer on average than Brand B—we face the fundamental challenge of statistical inference: is this "signal" a reflection of a true difference in the populations, or is it merely "noise" generated by the luck of the draw in random sampling? Setting up a two-sample $t$-test provides the formal framework to determine if the observed difference is statistically significant.
The Investigative Question and Method Selection
The process begins by identifying the relationship between two independent groups. Unlike paired data, where observations are linked (like "before" and "after" on the same subject), independent samples involve two distinct groups where the membership in one provides no information about the membership in the other. Under Skill 2.C, we must justify the choice of a two-sample $t$-test for the difference between two population means. We use the $t$-distribution because the population standard deviations ($\sigma_1$ and $\sigma_2$) are almost always unknown, requiring us to estimate them using sample standard deviations ($s_1$ and $s_2$).
Defining the Hypotheses (Skill 2.E)
In a significance test, we start with a "skeptical" baseline. The null hypothesis ($H_0$) typically claims there is no difference between the two population means. The alternative hypothesis ($H_a$) reflects the researcher's suspicion or the investigative question.
LO VAR-6.G: Identify the null and alternative hypotheses for a difference of two population means.
- Null Hypothesis ($H_0$): $\mu_1 - \mu_2 = 0$ (or $\mu_1 = \mu_2$)
- Alternative Hypothesis ($H_a$):
- $\mu_1 - \mu_2 > 0$ (The mean of Group 1 is greater than Group 2)
- $\mu_1 - \mu_2 < 0$ (The mean of Group 1 is less than Group 2)
- $\mu_1 - \mu_2 \neq 0$ (The means are simply different; a two-sided test)
It is critical to define the parameters $\mu_1$ and $\mu_2$ in the context of the problem. For example, "$\mu_1$ is the true mean recovery time (in days) for patients using Drug A, and $\mu_2$ is the true mean recovery time for patients using a placebo."
Verifying Conditions for Inference (Skill 4.E)
Before performing calculations, we must ensure the sampling distribution of the difference in sample means ($\bar{x}_1 - \bar{x}_2$) is approximately Normal and that our data collection was valid. Under LO VAR-6.H, we verify three primary conditions:
1. The Random Condition
The data must come from two independent random samples or from an experiment with random assignment to treatments. This allows us to generalize results to the population (in the case of samples) or make causal claims (in the case of experiments).
2. The Independence (10%) Condition
When sampling without replacement from a finite population, each sample size must be less than 10% of its respective population ($n_1 < 0.10N_1$ and $n_2 < 0.10N_2$). This ensures that the probabilities remain relatively stable between selections. Note: This condition is generally not required for randomized experiments.
3. The Normal/Large Sample Condition
We must be confident that the sampling distribution of $\bar{x}_1 - \bar{x}_2$ is approximately Normal. This is met if:
- Both population distributions are known to be Normal.
- OR Both sample sizes are large ($n_1 \ge 30$ and $n_2 \ge 30$), satisfying the Central Limit Theorem.
- OR If sample sizes are small, a graph of the sample data (like a dotplot or boxplot) shows no extreme skewness or strong outliers.
Contextual Example: Agricultural Yield
A researcher wants to know if a new organic fertilizer results in a higher mean corn yield than a standard synthetic fertilizer. They randomly assign 40 plots of land to the organic fertilizer ($n_1 = 40$) and 40 plots to the synthetic fertilizer ($n_2 = 40$).
- Hypotheses: $H_0: \mu_{org} - \mu_{syn} = 0$ vs. $H_a: \mu_{org} - \mu_{syn} > 0$.
- Random: Met; plots were randomly assigned to treatments.
- Independence: Not applicable for this experiment (random assignment, not sampling).
- Normal/Large Sample: Met; both $n_1$ and $n_2$ are $\ge 30$.
Misconception Clinic: Independent vs. Paired
A common error is confusing two independent samples with paired data. If you measure the heart rates of 20 people before and after exercise, you have one sample of 20 differences (paired). If you measure the heart rates of 20 athletes and 20 non-athletes, you have two independent samples. The two-sample $t$-test is only appropriate for the latter.
Interpretation Check
A study compares the mean test scores of students who used an AI tutor ($n_1 = 25$) versus those who used a traditional textbook ($n_2 = 22$). A boxplot of the AI group's scores shows a slight left skew but no outliers. The textbook group's scores are roughly symmetric. Can the researcher proceed with a two-sample $t$-test?
Answer: Yes. Although the sample sizes are both under 30, the lack of strong outliers or extreme skewness in the sample data allows us to assume the sampling distribution of the difference in means is approximately Normal.
