Math 115
Previously, we made inferences about a single mean from one group.
Now we extend to comparing two independent groups.
Research question: Is there a difference between the population means of two groups?
Same framework:
When comparing two means:
This is the same structure as two-proportion inference, but now the response is numerical instead of categorical.
| Statistic (sample) | Parameter (population) | |
|---|---|---|
| Group 1 mean | \(\bar{x}_1\) | \(\mu_1\) |
| Group 2 mean | \(\bar{x}_2\) | \(\mu_2\) |
| Difference | \(\bar{x}_1 - \bar{x}_2\) | \(\mu_1 - \mu_2\) |
Statistic of interest: \(\bar{x}_1 - \bar{x}_2\) (difference in sample means)
Goal: Make inferences about \(\mu_1 - \mu_2\) (difference in population means)
Do infants whose mothers smoke have different mean birth weights?
Research question: Is the mean birth weight different for babies born to mothers who smoked vs. those who did not?
| Group | n | \(\bar{x}\) | s |
|---|---|---|---|
| Nonsmoker | 867 | 7.27 | 1.23 |
| Smoker | 114 | 6.68 | 1.6 |
Point estimate:
\[\bar{x}_n - \bar{x}_s = 7.27 - 6.68 = 0.59 \text{ lbs}\]
Babies born to nonsmoking mothers weigh about 0.59 pounds more on average in our sample.
Question: Is this difference statistically significant, or could it be due to chance?
Let \(\mu_n\) = mean birth weight for all babies born to nonsmoking mothers
Let \(\mu_s\) = mean birth weight for all babies born to smoking mothers
Hypotheses:
This is a two-sided test.
Like in two proportions under the null hypothesis (\(\mu_n = \mu_s\)):
Key idea: If group doesn’t matter, we can shuffle the birth weights between the groups
A permutation randomly reassigns the response values (outcomes):
After shuffling, we calculate the difference in means
This gives us ONE value from the null distribution
Results:
Decision: Reject \(H_0\)
Conclusion: The data provide strong evidence that the mean birth weight differs between babies born to smoking and nonsmoking mothers.
Pooled Standard Deviation
When comparing two groups, we pool the variability to get a combined estimate of the common population SD.
\[s_p = \sqrt{\frac{(n_1-1)s_1^2 + (n_2-1)s_2^2}{n_1+n_2-2}}\]
For birth weights:
\[s_p = \sqrt{\frac{(867-1) \cdot 1.23^2 + (114-1) \cdot 1.6^2}{867+114-2}} = 1.28\]
The standard error for the difference in sample means:
\[SE = s_p \sqrt{\frac{1}{n_1} + \frac{1}{n_2}}\]
For birth weights:
\[SE = 1.28 \times \sqrt{\frac{1}{867} + \frac{1}{114}} = 0.128\]
The T-statistic measures how far the observed difference is from the null value in SE units:
\[T = \frac{(\bar{x}_1 - \bar{x}_2) - 0}{SE}\]
Degrees of freedom: \(df = n_1 + n_2 - 2 = 867 + 114 - 2 = 979\)
For birth weights:
\[T = \frac{0.59 - 0}{0.128} = 4.65\]
Independence:
Normality:
Equal variance:
Conditions are met for using the t-distribution.
Use Jamovi’s Model-Based Inference calculator with t-distribution (df = 979).
P-value < 0.001
Results:
Decision: Reject \(H_0\)
Conclusion: The data provide strong evidence that the mean birth weight differs between babies born to smoking and nonsmoking mothers, and agrees with the randomization results.
95% CI: (0.272, 0.909) pounds
Interpretation: We are 95% confident that the mean birth weight for babies born to nonsmoking mothers is between 0.272 and 0.909 pounds higher than for babies born to smoking mothers.
Does CI include 0? No
This is consistent with our hypothesis test—we rejected \(H_0\), and 0 is not in the CI.
When conditions are met:
\[\text{CI} = (\bar{x}_1 - \bar{x}_2) \pm t^*_{df} \times SE\]
Where:
Given: \(\bar{x}_n - \bar{x}_s = 0.593\), \(SE = 0.128\), \(df = 979\)
Critical value: \(t^*_{979} = 1.962\) (from Jamovi)
95% CI:
\[0.59 \pm 1.962 \times 0.128 = (0.342, 0.843)\]
95% CI: (0.342, 0.843) pounds
Interpretation: We are 95% confident that the mean birth weight for babies born to nonsmoking mothers is between 0.34 and 0.84 pounds higher than for babies born to smoking mothers. This is consistent with our bootstrap CI.
Does CI include 0? No
This is consistent with our hypothesis test—we rejected \(H_0\), and 0 is not in the CI.
We used Student’s t-test, which assumes equal population variances.
Alternative: Welch’s t-test
For this course, we use the equal variance version. When variances appear very different, Welch’s test is preferred.
For hypothesis testing, stronger evidence = smaller p-value = larger |T|
Recall: \(T = \frac{(\bar{x}_1 - \bar{x}_2) - 0}{SE}\) where \(SE = s_p \sqrt{\frac{1}{n_1} + \frac{1}{n_2}}\)
Three factors affect |T| (and thus p-value):
For confidence intervals: Width = \(2 \times t^* \times SE\)
Where \(SE = s_p \sqrt{\frac{1}{n_1} + \frac{1}{n_2}}\)
Three factors affect width:
Confidence level: Higher confidence → larger \(t^*\) → wider CI
Sample size: Larger \(n_1\) and \(n_2\) → smaller SE → narrower CI
Variability: Smaller \(s_1\) and \(s_2\) → smaller \(s_p\) → smaller SE → narrower CI
For comparing two independent means:
| Component | Formula |
|---|---|
| Pooled SD | \(s_p = \sqrt{\frac{(n_1-1)s_1^2 + (n_2-1)s_2^2}{n_1+n_2-2}}\) |
| Standard Error | \(SE = s_p \sqrt{\frac{1}{n_1} + \frac{1}{n_2}}\) |
| Degrees of freedom | \(df = n_1 + n_2 - 2\) |
| T-statistic | \(T = \frac{(\bar{x}_1 - \bar{x}_2) - 0}{SE}\) |
| CI | \((\bar{x}_1 - \bar{x}_2) \pm t^*_{df} \times SE\) |
Conditions: Independence + Normality + Equal variance