ABD 3e Chapter 12
In a one-sample t-test, we asked whether a sample mean differs from a known or hypothesized population mean.
Often, however, we do not have a known population mean.
Instead, we have two samples, each representing a different group.
Because these are samples, their means will naturally differ due to random sampling variation.
The key question:
Is the difference between the sample means small enough to be explained by sampling variation if both groups come from populations with the same mean?
Or is the difference too large to be plausibly explained by chance alone?
To answer this question, we test whether the two populations have the same mean.
Different statistical models are used depending on the relationship between the two samples:
Examples:
Examples:
The best estimate of the difference between two means is the difference between the two sample means:
\[ \bar{Y}_1 - \bar{Y}_2 \]
Standard error:
\[ \operatorname{SE}_{(\bar{Y}_1 - \bar{Y}_2)} = \sqrt{\frac{s_1^2}{n_1}+\frac{s_2^2}{n_2}} \]
Where:
If the populations are normally distributed (or sample sizes are large), the standardized difference has a \(t\) distribution with \(df\) degrees of freedom:
\[ t=\frac{(\bar{Y}_1 - \bar{Y}_2)-(\mu_1-\mu_2)}{\operatorname{SE}_{(\bar{Y}_1 - \bar{Y}_2)}} \]
with a total degrees of freedom equal to
\[ df=df_1+df_2=n_1+n_2-2 \]
Thus, the confidence interval for \(\bar{Y}_1 - \bar{Y}_2\) would be:
\[ (\bar{Y}_1 - \bar{Y}_2) \pm t_{\alpha/2,df} \times \operatorname{SE}_{(\bar{Y}_1 - \bar{Y}_2)} \]
dplyr::summarize()t.test()
The test evaluates whether the difference between population means is zero.
\[ H_0: \mu_1 = \mu_2 \]
\[ H_A: \mu_1 \ne \mu_2 \]
Test statistic:
\[ t=\frac{\bar{Y}_1 - \bar{Y}_2}{\operatorname{SE}_{(\bar{Y}_1 - \bar{Y}_2)}} \]
where:
\[ \operatorname{SE}_{(\bar{Y}_1 - \bar{Y}_2)} = \sqrt{\frac{s_1^2}{n_1}+\frac{s_2^2}{n_2}} \]
The degrees of freedom are estimated using the Welch–Satterthwaite formula and computed automatically by statistical software.
The two groups are independent random samples from their populations.
The response variable is numerical.
The variable is approximately normally distributed in each population (or sample sizes are large).
Note
Another variation of the two-sample \(t\)-test assumes that the variances of the two populations are equal (the pooled-variance t-test).
Welch’s test does not assume equal variances, and it maintains the correct Type I error rate when the group variances or sample sizes differ.
Because Welch’s test also performs well when variances are equal, most modern statistical software uses Welch’s test by default (including t.test() in R).
\[ d_i = (\text{first measurement of unit }i)-\\ (\text{second measurement of unit }i) \]
\[ \bar{d} \pm t_{\alpha/2,df} \times \operatorname{SE}_{\bar{d}} \]
where:
\[ \operatorname{SE}_{\bar{d}} = \frac{s_d}{\sqrt{n}} \]
The test evaluates whether the mean difference between paired observations differs from a specified value (usually zero).
\[ H_0: \mu_d=0 \]
\[ H_A: \mu_d \ne 0 \]
Steps:
\[ t=\frac{\bar{d} - \mu_{d_0}}{\operatorname{SE}_{\bar{d}}} \]
Same as the assumptions for a one-sample 𝑡-test:
The sampling units are randomly sampled from the population
The paired differences have a normal distribution in populations
Important
The analysis makes no assumptions about the distribution of either of the two measurements made on each sampling unit, only their differences.
Make comparisons between groups directly, not indirectly.
Common mistake: compare each group to the same reference value and then draw conclusions about the difference between groups.
Example:
This does not imply that the two groups differ from each other.
Instead, test or compare the difference between their means directly
Comparing two means and confidence intervals visually yields the same results as a hypothesis test (t-test) in cases (a) and (b) below. In case (c) you would need to do the t-test to tell if the means are different.
Sometimes you want to compare the variances of two populations
Estimation is one option:
Estimate the variances
Estimate the confidence limits
Plot
Hypothesis testing is another option:
\[ H_0: \sigma_1^2 = \sigma_2^2 \]
\[ H_A: \sigma_1^2 \ne \sigma_2^2 \]
Calculate test statistic \[F=s_1^2/s_2^2\]
Is near 1 if variances are equal
Has an \(F\)-distribution with \[df_1=n_1-1\] \[df_2=n_2-1\]
Assumes normality
More robust to violations of the assumption of normality
Most commonly used test, for this reason
Can be applied to > 2 groups, e.g. \[H_0:\sigma_1^2=\sigma_2^2=\sigma_3^2\]
Note
These tests are for exploratory analysis, not required before Welch’s \(t\)-test

BIOL 275 Biostatistics | Spring 2026