12. Two Means
Math 115 - Examples for Topic 12
These worked examples demonstrate inference for comparing two independent means using the t-distribution (model-based approach), starting with the condition checks that come before any arithmetic.
Example 1: Checking Conditions from the Samples Themselves
Scenario: A courier company wants to compare package hand-off times at two depots with a pooled two-sample t-test. Before any arithmetic, look at the samples:
| Depot | n | Mean | SD |
|---|---|---|---|
| Depot A | 46 | 39.9 | 5.31 |
| Depot B | 12 | 31.7 | 3.85 |
Question: Using the histograms and the summary table, check the conditions for a pooled two-sample t-test. Should the test proceed on these data?
There are three reads to make, in order.
Read 1 — shape, per sample. Depot A is roughly symmetric. Depot B is right-skewed: the bulk of its hand-off times sit at the left, with a tail stretching right.
Read 2 — shape × size, the CLT judgment. A’s symmetry at n = 46 is no concern — and even moderate skew would be tolerable at that sample size. B’s skew at n = 12 is a real concern: small samples need to look nearly normal, and this one doesn’t.
Read 3 — spread, from the summary table. The SDs are similar in size (well within a factor of two of each other), so equal variance is reasonable.
Verdict: with Depot B’s normality condition failing, the pooled t-test should not proceed on these data. More data from Depot B (or a randomization approach) is the honest path.
Example 2: Hypothesis Test for Two Independent Means
Scenario: A fitness company wants to know if their new high-intensity interval training (HIIT) program leads to different weight loss compared to their traditional cardio program. They randomly assign 80 gym members to one of two groups:
- HIIT group: 8-week high-intensity interval training (45 members)
- Traditional group: 8-week traditional cardio program (35 members)
At the end of the 8 weeks, they record each participant’s weight loss (in pounds).
Sample results:
| Group | n | \(\bar{x}\) | s |
|---|---|---|---|
| HIIT | 45 | 12.4 lbs | 4.2 lbs |
| Traditional | 35 | 9.8 lbs | 3.9 lbs |
Research question: Is there evidence that mean weight loss differs between the two programs?
Task: Conduct a hypothesis test at the \(\alpha = 0.05\) level using the t-distribution.
Step 1: Identify the parameter and calculate the sample statistic
Let \(\mu_H\) = the true mean weight loss for all people who would do the HIIT program
Let \(\mu_T\) = the true mean weight loss for all people who would do the traditional program
Sample means:
- HIIT: \(\bar{x}_H = 12.4\) lbs
- Traditional: \(\bar{x}_T = 9.8\) lbs
- Observed difference: \(\bar{x}_H - \bar{x}_T = 12.4 - 9.8 = 2.6\) lbs
Step 2: State the hypotheses
Since we want to test whether the mean weight loss differs (in either direction), this is a two-sided test:
- \(H_0: \mu_H - \mu_T = 0\) (no difference in mean weight loss)
- \(H_A: \mu_H - \mu_T \neq 0\) (mean weight loss differs between programs)
Step 3: Check conditions for using t-distribution
These are the same three reads as Example 1.
Independence:
- Randomized experiment with independent groups ✓
Shape × size (normality):
- HIIT: n = 45 ≥ 30 ✓
- Traditional: n = 35 ≥ 30 ✓
- With both sample sizes ≥ 30, moderate skewness in the sample histograms is acceptable
Spread (equal variance):
- \(s_H = 4.2\) and \(s_T = 3.9\) are similar — well within a factor of two ✓
Assuming at most moderate skewness, conditions are met for using the t-distribution.
Step 4: Calculate the test statistic
Degrees of freedom: \(df = n_1 + n_2 - 2 = 45 + 35 - 2 = 78\)
Pooled standard deviation:
\[s_p = \sqrt{\frac{(n_1-1)s_1^2 + (n_2-1)s_2^2}{n_1+n_2-2}} = \sqrt{\frac{(45-1) \cdot 4.2^2 + (35-1) \cdot 3.9^2}{45+35-2}} = 4.072\]
Standard error:
\[SE = s_p \sqrt{\frac{1}{n_1} + \frac{1}{n_2}} = 4.072 \times \sqrt{\frac{1}{45} + \frac{1}{35}} = 0.918\]
T-statistic:
\[T = \frac{(\bar{x}_H - \bar{x}_T) - 0}{SE} = \frac{2.6 - 0}{0.918} = 2.83\]
Step 5: Calculate the p-value using Jamovi
Randomize module → Model-Based Inference
To calculate the p-value:
- Under Distribution, choose t
- Enter degrees of freedom: 78
- Check “Calculate area (p-value)”
- Enter the T-statistic: 2.83
- Select tail direction: Both (for two-sided test)
Jamovi calculates the two-sided p-value using the “double the smaller tail” method:
P-value = 0.0059
Step 6: Interpret the p-value
Interpretation: If there were truly no difference in mean weight loss between the two programs, there is approximately a 0.59% chance of observing a difference of 2.6 pounds or more extreme in random samples of this size.
Step 7: Make a decision
Using the significance level α = 0.05:
- P-value = 0.0059
- Compare: Is 0.0059 < 0.05? YES
Decision: We reject \(H_0\) at the α = 0.05 level.
Step 8: State the conclusion in context
The data provide convincing evidence that mean weight loss differs between the HIIT and traditional cardio programs (T = 2.83, df = 78, p-value = 0.0059). Since this was a randomized experiment, we can conclude that the HIIT program causes greater weight loss on average. Participants in the HIIT group lost an average of 2.6 pounds more than those in the traditional cardio group.
Example 3: Confidence Interval for Two Independent Means
Scenario: A psychologist wants to estimate the difference in reaction times between people who regularly drink coffee and those who don’t. She recruits volunteers and measures their reaction time (in milliseconds) on a cognitive task.
Sample results:
| Group | n | \(\bar{x}\) | s |
|---|---|---|---|
| Coffee drinkers | 52 | 245 ms | 38 ms |
| Non-coffee drinkers | 48 | 268 ms | 42 ms |
Research question: What is the difference in mean reaction times between regular coffee drinkers and non-coffee drinkers?
Task: Construct a 95% confidence interval for \(\mu_C - \mu_N\) using the t-distribution.
Step 1: Identify the parameter and point estimate
Let \(\mu_C\) = the true mean reaction time (in ms) for all regular coffee drinkers
Let \(\mu_N\) = the true mean reaction time (in ms) for all non-coffee drinkers
Point estimate:
\[\bar{x}_C - \bar{x}_N = 245 - 268 = -23 \text{ ms}\]
Coffee drinkers had faster (lower) reaction times by 23 ms on average in our sample.
Step 2: Check conditions for using t-distribution
Independence:
- Random sample from each population ✓
Normality:
- Coffee: n = 52 ≥ 30 ✓
- Non-coffee: n = 48 ≥ 30 ✓
Equal variance:
- \(s_C = 38\) and \(s_N = 42\) are similar ✓
Assuming at most moderate skewness, conditions are met for using the t-distribution.
Step 3: Calculate the standard error
Degrees of freedom: \(df = n_1 + n_2 - 2 = 52 + 48 - 2 = 98\)
Pooled standard deviation:
\[s_p = \sqrt{\frac{(52-1) \cdot 38^2 + (48-1) \cdot 42^2}{52+48-2}} = 39.97\]
Standard error:
\[SE = s_p \sqrt{\frac{1}{n_1} + \frac{1}{n_2}} = 39.97 \times \sqrt{\frac{1}{52} + \frac{1}{48}} = 8\]
Step 4: Find the critical value using Jamovi
Randomize module → Model-Based Inference
To find \(t^*\):
- Under Distribution, choose t
- Enter degrees of freedom: 98
- Check “Calculate CI multiplier”
- Enter confidence level: 95
Critical value: \(t^*_{98} = 1.984\)
Step 5: Calculate the confidence interval
Margin of error:
\[ME = t^*_{df} \times SE = 1.984 \times 8 = 15.88\]
Confidence interval:
\[\text{CI} = (\bar{x}_C - \bar{x}_N) \pm ME = -23 \pm 15.88\]
\[95\% \text{ CI} = (-38.9, -7.1)\]
Step 6: Interpret the confidence interval
Interpretation: We are 95% confident that the true difference in mean reaction times (coffee drinkers − non-coffee drinkers) is between -38.9 ms and -7.1 ms.
In practical terms:
- Both bounds are negative, indicating coffee drinkers have faster (lower) reaction times
- We’re confident coffee drinkers are between 7.1 and 38.9 ms faster on average
Note: This is an observational study, so we cannot conclude that coffee causes faster reaction times. There could be confounding variables.
Example 4: Factors Affecting Strength of Evidence and CI Width
These questions ask you to think about what affects the strength of evidence against the null hypothesis and confidence interval width when comparing two means.
Part A: Sample Size and Strength of Evidence
Scenario: Dr. Patel studies whether a new meditation app improves sleep quality scores (measured on a 0-100 scale) compared to no intervention. With 25 participants per group, he observes a mean sleep score of 72 in the app group and 65 in the control group. His p-value is 0.08.
Dr. Patel’s colleague, Dr. Singh, conducts an identical study with 100 participants per group. She observes the same means: 72 for the app group and 65 for the control group, with the same standard deviations.
Question: Will Dr. Singh’s p-value be larger, smaller, or about the same as Dr. Patel’s p-value of 0.08?
Dr. Singh’s p-value will be smaller (stronger evidence against \(H_0\)).
With a larger sample size, the standard error decreases, which makes the T-statistic larger. A larger T-statistic corresponds to a smaller p-value. Even though both studies observed the same 7-point difference in means, the larger study provides stronger evidence that this difference is real and not due to chance.
Part B: Sample Size and CI Width
Scenario: Using the same two studies from Part A:
- Dr. Patel: 25 participants per group
- Dr. Singh: 100 participants per group
Both construct 95% confidence intervals for the difference in mean sleep scores.
Question: Whose confidence interval will be wider?
Dr. Patel’s CI will be wider.
Larger samples lead to smaller standard errors, which produce narrower confidence intervals. Dr. Singh’s larger study will give a more precise estimate of the true difference in mean sleep scores.
Part C: Effect Size and Strength of Evidence
Scenario: Two physical therapists compare recovery times (in weeks) between a new rehabilitation protocol and standard care. Both have 40 patients per group with the same variability in recovery times.
- Therapist A: New protocol: mean 8 weeks, Standard: mean 10 weeks (2-week difference)
- Therapist B: New protocol: mean 6 weeks, Standard: mean 10 weeks (4-week difference)
Question: Which therapist’s study will provide stronger evidence against the null hypothesis?
Therapist B’s study will provide stronger evidence (smaller p-value).
A larger observed difference (effect size) leads to a larger T-statistic and thus a smaller p-value. Even with the same sample sizes and variability, observing a 4-week difference provides much stronger evidence against the null hypothesis than observing a 2-week difference.
Part D: Variability and Strength of Evidence
Scenario: Two nutritionists compare weight loss (in pounds) between a new diet program and a standard diet over 12 weeks. Both studies have 50 participants per group and observe the same mean difference: the new diet group lost 8 pounds more on average.
- Study 1: Both groups have \(s = 12\) pounds (high variability)
- Study 2: Both groups have \(s = 6\) pounds (low variability)
Question: Which study will provide stronger evidence against the null hypothesis?
Study 2 (low variability) will provide stronger evidence (smaller p-value).
Lower variability (smaller standard deviations) leads to a smaller pooled standard deviation, which produces a smaller standard error. With a smaller SE, the same observed difference of 8 pounds translates to a larger T-statistic and smaller p-value.
Part E: Confidence Level and CI Width
Scenario: A human resources manager compares starting salaries (in thousands of dollars) between two departments, sampling 60 employees from each. She finds that Department A has a mean salary of $58,000 compared to $54,000 in Department B.
She constructs both a 90% and a 99% confidence interval for the difference in mean salaries.
Question: Which interval will be wider?
The 99% CI will be wider.
Higher confidence requires a larger multiplier (\(t^*\)), which increases the margin of error. There’s a trade-off: if you want to be more confident that your interval captures the true difference, you need a wider interval.
Part F: Variability and CI Width
Scenario: Two researchers study the difference in test scores between students who use a study app and those who don’t. Both have 45 students per group.
- Researcher A: Both groups have \(s = 15\) points
- Researcher B: Both groups have \(s = 8\) points
Both observe the same difference in means (app users scored 5 points higher on average).
Question: Whose 95% confidence interval will be wider?
Researcher A’s CI will be wider.
Higher variability (larger standard deviations) leads to a larger pooled standard deviation and larger standard error. This produces a wider confidence interval. Researcher B’s study, with less variability in test scores, will produce a more precise (narrower) estimate of the true difference.