One & Two-Sample
\(t\)-Tests
Learn how to test hypotheses about means using the \(t\)-distribution: when to use each test, how to compute the test statistic, and how to interpret results.
Why Do We Need \(t\)-Tests?
In biostatistics we constantly ask: "Is a sample mean significantly different from a known value, or are two groups truly different?" We rarely know the population standard deviation \(\sigma\), so we cannot use a \(z\)-test. The \(t\)-test replaces \(\sigma\) with the sample standard deviation \(s\), producing a test statistic that follows a \(t\)-distribution.
The \(t\)-Distribution vs. Normal
Key Vocabulary
The One-Sample \(t\)-Test
Tests whether a single population mean \(\mu\) equals a hypothesized value \(\mu_0\):
Where \(\bar{x}\) is the sample mean, \(\mu_0\) is the null hypothesis value, \(s\) is the sample standard deviation, and \(n\) is the sample size.
The Two-Sample \(t\)-Test
Tests whether two independent groups have the same population mean: \(\mu_1 = \mu_2\).
Degrees of freedom: \(df = n_1 + n_2 - 2\) (equal-variance version).
Visualizing Both Tests
One-Sample vs. Two-Sample
| One-Sample | Two-Sample (Independent) | |
|---|---|---|
| Question | Is \(\mu = \mu_0\)? | Is \(\mu_1 = \mu_2\)? |
| Data | One group | Two independent groups |
| Statistic | \(\frac{\bar{x} - \mu_0}{s / \sqrt{n}}\) | \(\frac{\bar{x}_1 - \bar{x}_2}{s_p \sqrt{\frac{1}{n_1} + \frac{1}{n_2}}}\) |
| df | \(n - 1\) | \(n_1 + n_2 - 2\) |
| Assumption | Data \(\sim\) Normal (or large \(n\)) | Both normal, equal variances |
Assumptions You Must Check
Step-by-Step Procedure
Example 1: One-Sample \(t\)-Test
A lab claims healthy adult body temperature is \(\mu_0 = 98.6\)°F. You measure \(n = 25\) patients and find \(\bar{x} = 98.2\), \(s = 0.8\). Is there evidence the true mean differs?
Example 2: Two-Sample \(t\)-Test
Drug A (\(n_1 = 15\), \(\bar{x}_1 = 5.2\), \(s_1 = 1.1\)) vs. Drug B (\(n_2 = 18\), \(\bar{x}_2 = 4.1\), \(s_2 = 1.3\)). Do the drugs differ in average recovery days?
Example 3: Interpreting the \(p\)-Value
When Variances Are Unequal: Welch's \(t\)
If the two groups have very different standard deviations, the pooled \(t\)-test can be misleading. Welch's \(t\)-test does not assume equal variances:
Common Mistakes
Summary Reference Table
| One-Sample \(t\) | Two-Sample Pooled \(t\) | Welch's \(t\) | |
|---|---|---|---|
| Use when | 1 group vs. known \(\mu_0\) | 2 groups, equal \(\sigma\) | 2 groups, unequal \(\sigma\) |
| Formula numerator | \(\bar{x} - \mu_0\) | \(\bar{x}_1 - \bar{x}_2\) | \(\bar{x}_1 - \bar{x}_2\) |
| Denominator uses | \(s/\sqrt{n}\) | Pooled \(s_p\) | Separate \(s_1, s_2\) |
| df | \(n - 1\) | \(n_1 + n_2 - 2\) | Satterthwaite (approx) |
Question 1 of 5
A researcher measures the cholesterol levels of 30 patients and wants to test whether their mean differs from the national average of 200 mg/dL. Which test is appropriate?
Question 2 of 5
Given \(\bar{x} = 72\), \(\mu_0 = 75\), \(s = 6\), and \(n = 36\), what is the one-sample \(t\)-statistic?
Question 3 of 5
In a two-sample pooled \(t\)-test with \(n_1 = 12\) and \(n_2 = 18\), what are the degrees of freedom?
Question 4 of 5
You obtain \(t = 1.80\) with \(df = 20\) for a two-tailed test at \(\alpha = 0.05\). The critical value is \(t_{0.025,\,20} = 2.086\). What is your conclusion?
Question 5 of 5
When should you use Welch's \(t\)-test instead of the pooled two-sample \(t\)-test?