01 / 21
1
2

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.

Biostatistics

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

0
-3
3
-1.5
1.5
Normal (z)
t (df = 3)
heavier tail
heavier tail

Key Vocabulary

\(\bar{x}\) (Sample Mean)
The average of your observed data points.
\(\mu_0\) (Hypothesized Mean)
The value you test against in a one-sample test.
\(s\) (Sample SD)
Estimates \(\sigma\) when the population SD is unknown.
\(df\) (Degrees of Freedom)
Controls the shape of the \(t\)-distribution: \(n - 1\) or \(n_1 + n_2 - 2\).

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
\(\mu_0\)
\(\bar{x}\)
gap?
Two-Sample
\(\bar{x}_1\)
\(\bar{x}_2\)
gap?

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

1
Random sampling: Data are drawn randomly from the population(s).
2
Independence: Observations within and between groups are independent.
3
Normality: The population(s) are approximately normal, or \(n\) is large enough (Central Limit Theorem).
4
Equal variances (two-sample pooled): \(s_1^2 \approx s_2^2\). If violated, use the Welch \(t\)-test instead.

Step-by-Step Procedure

1
State hypotheses: Write \(H_0\) (e.g., \(\mu = \mu_0\)) and \(H_a\) (one- or two-tailed).
2
Choose \(\alpha\): Typically \(0.05\). This sets your significance threshold.
3
Check assumptions: Normality, independence, equal variances (if pooled).
4
Compute \(t\): Plug into the one-sample or two-sample formula.
5
Find the \(p\)-value (or compare \(|t|\) to \(t_{\text{crit}}\) from the table).
6
Decide: If \(p \le \alpha\), reject \(H_0\). Otherwise, fail to reject.

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

0
\(-t_{\text{crit}}\)
\(+t_{\text{crit}}\)
\(t = 2.59\)
Fail to reject
Reject
Reject

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

✕ Using \(z\) Instead of \(t\)
When \(\sigma\) is unknown and you use \(s\), you must use the \(t\)-distribution, not \(z\).
✕ Wrong Degrees of Freedom
One-sample: \(df = n-1\). Two-sample pooled: \(df = n_1+n_2-2\). Mixing these up changes the critical value.
✕ Ignoring Assumptions
Using a pooled two-sample test when variances are clearly unequal inflates Type I error. Check first.

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?