BIOSTATISTICS • HYPOTHESIS TESTING

One & Two-Sample t-Tests — One-sample and two-sample t-tests (independent samples)

Inferring population means from small samples when the population standard deviation is unknown.

Historical Context & Motivation

Modern biostatistics owes much of its inferential machinery to a practical problem in early twentieth-century industry: how to draw reliable conclusions about a population mean when only a handful of observations are available and the population variance is unknown. Before the development of the t-test, researchers relied on the normal (z) distribution for inference, which requires either large samples or knowledge of the population standard deviation — luxuries seldom available in biological or clinical research. The gap between what the z-test demands and what experimenters actually possess motivated a quieter revolution in statistics, one that unfolded not in a university lecture hall but in a brewery.

1908
Student's t-Distribution
William Sealy Gosset, a chemist at the Guinness Brewery in Dublin, published The Probable Error of a Mean under the pseudonym 'Student.' Working with small batches of barley, Gosset derived a distribution that accounts for the extra uncertainty introduced when the sample standard deviation is used in place of the unknown population value.
1925
Fisher's Formalization
Ronald A. Fisher refined Gosset's work, introduced the concept of degrees of freedom, and embedded the t-distribution within the broader framework of hypothesis testing and analysis of variance.
1937
Welch's Unequal-Variance Extension
Bernard L. Welch proposed an approximate t-test that relaxes the assumption of equal population variances between two groups, yielding the widely used Welch's t-test and its associated Satterthwaite approximation for degrees of freedom.
1950s–present
Ubiquity in Biomedical Research
With the rise of clinical trials, epidemiology, and genomics, the one-sample and two-sample t-tests became foundational tools for comparing treatment means, validating biomarkers, and evaluating drug efficacy across the biomedical sciences.

The central question the t-test addresses remains as relevant today as it was in 1908: given a sample of limited size from a population whose variance must be estimated, can we draw defensible conclusions about the population mean or about whether two population means differ? Answering that question requires a distribution that is heavier-tailed than the normal — one that honestly reflects our uncertainty about the spread of the data.

Core Principles & Definitions

The t-test family rests on several interconnected ideas that distinguish it from large-sample z-tests. Understanding these foundational principles is essential before diving into formulas, because the logic of hypothesis testing — formulating null and alternative hypotheses, computing a test statistic, comparing it to a reference distribution, and drawing a conclusion — is the same regardless of whether you are working with one sample or two.

1

The t-Distribution

A symmetric, bell-shaped distribution that is heavier-tailed than the standard normal. Its shape depends on degrees of freedom (df); as df increases, it converges to the z-distribution.
2

Standard Error of the Mean

The standard error (SE) quantifies sampling variability: SE = s / √n. It replaces σ / √n when the population standard deviation σ is unknown, using the sample standard deviation s instead.
3

Null & Alternative Hypotheses

The null hypothesis (H₀) posits no effect or no difference. The alternative hypothesis (H₁) claims an effect exists. Tests may be two-tailed (≠) or one-tailed (< or >).
4

Assumptions

Both one-sample and two-sample t-tests assume that the underlying data are approximately normally distributed (or n is large enough for the CLT to apply) and that observations are independent. The pooled two-sample test additionally assumes equal population variances.
5

p-Value & Decision Rule

The p-value is the probability of observing a test statistic at least as extreme as the computed value, assuming H₀ is true. If p < α (commonly 0.05), we reject H₀.
KEY TAKEAWAY
Think of the t-distribution as a 'humble' version of the normal curve. When you estimate the population variance from a small sample, you are less certain about the true spread, so the distribution compensates by assigning more probability to extreme values — its tails are fatter. As your sample grows, your estimate of variance improves, the tails slim down, and the t-distribution becomes nearly indistinguishable from the z-distribution. This is analogous to an engineer designing a bridge: with fewer soil samples, safety margins (analogous to wider tails) must be larger to account for the unknown.

Visual Explanation — The t-Distribution & Test Logic

The cyan curve represents a t-distribution with 5 degrees of freedom, while the violet curve is the standard normal (z) distribution. Notice that the t-distribution has heavier tails — more probability mass in the extremes — reflecting the additional uncertainty from estimating the population standard deviation. As the degrees of freedom increase (i.e., as the sample size grows), the t-distribution converges toward the z-distribution.

The diagram above illustrates the fundamental difference between the z- and t-distributions. In a one-sample t-test, you compute a test statistic that measures how many estimated standard errors the sample mean lies from a hypothesized population mean, and you compare that statistic to the t-distribution with n − 1 degrees of freedom. In a two-sample t-test, the logic is identical except the test statistic now measures the distance between two sample means relative to the pooled (or unpooled) standard error, and the degrees of freedom depend on both sample sizes. In both cases, if the computed t-value falls far enough into the tails — beyond a critical value determined by the chosen significance level α — you reject the null hypothesis.

Mathematical Framework

One-Sample t-Test

The one-sample t-test evaluates whether the mean of a single population differs from a specified value μ₀. It is appropriate when the population standard deviation σ is unknown and must be estimated by the sample standard deviation s.

ONE-SAMPLE t-STATISTIC
t = (x̄ − μ₀) / (s / √n)
where = sample mean, μ₀ = hypothesized population mean, s = sample standard deviation, n = sample size. Degrees of freedom: df = n − 1.

Two-Sample t-Test (Independent Samples, Equal Variances — Pooled)

When comparing the means of two independent groups and assuming that both populations share a common variance, we first compute a pooled variance that combines information from both samples, weighted by their respective degrees of freedom.

POOLED VARIANCE
s²ₚ = [(n₁ − 1)s₁² + (n₂ − 1)s₂²] / (n₁ + n₂ − 2)
where s₁² and s₂² are the sample variances for groups 1 and 2, and n₁, n₂ are the respective sample sizes.
TWO-SAMPLE t-STATISTIC (POOLED)
t = (x̄₁ − x̄₂) / √[s²ₚ × (1/n₁ + 1/n₂)]
Degrees of freedom: df = n₁ + n₂ − 2. Under H₀, the difference (x̄₁ − x̄₂) is compared to 0 (or another hypothesized difference δ₀).

Welch's t-Test (Unequal Variances)

WELCH'S t-STATISTIC
t = (x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂)
The degrees of freedom are approximated via the Satterthwaite formula: df ≈ (s₁²/n₁ + s₂²/n₂)² / [(s₁²/n₁)²/(n₁−1) + (s₂²/n₂)²/(n₂−1)]. This test does not assume equal population variances and is generally recommended as the default two-sample procedure.
💡 When to Pool?
In practice, many statisticians recommend using Welch's t-test by default because it performs well even when variances are equal, and it protects against inflated Type I error rates when they are not. The pooled test is appropriate only when you have strong a priori reasons (or Levene's test confirmation) to believe σ₁² = σ₂².

Choosing the Right t-Test — Decision Flowchart

Selecting the correct t-test variant depends on three key questions: (1) Are you comparing a single sample to a known value, or comparing two independent groups? (2) If two groups, are the samples independent or paired? (3) If independent, can you assume equal variances? The following diagram traces the decision logic.

Start at the top and follow the branches. This lesson covers the one-sample t-test (left branch) and the independent two-sample t-tests (right branch, splitting into pooled and Welch's versions). The paired t-test (green box) is addressed in a separate lesson.

Before conducting any t-test, it is good practice to inspect the data for approximate normality (e.g., Q-Q plots, Shapiro-Wilk test) and, in the two-sample case, to assess the equality of variances (e.g., Levene's test or an F-test). If the normality assumption is severely violated and the sample is small, nonparametric alternatives such as the Wilcoxon signed-rank test (one-sample) or the Mann-Whitney U test (two-sample) may be more appropriate. However, the t-test is reasonably robust to moderate departures from normality, especially when sample sizes exceed 30 or so, thanks to the Central Limit Theorem.

Worked Examples

Example A: One-Sample t-Test

A clinical dietitian hypothesizes that the mean serum cholesterol level in a patient population differs from the national average of 200 mg/dL. She draws a random sample of n = 16 patients and obtains x̄ = 214 mg/dL with s = 28 mg/dL. Test her hypothesis at α = 0.05 (two-tailed).

One-Sample t-Test — Serum Cholesterol
1
Step 1 — State HypothesesH₀: μ = 200 mg/dL (population mean equals the national average). H₁: μ ≠ 200 mg/dL (population mean differs from the national average).
2
Step 2 — Compute the Standard ErrorSE = s / √n = 28 / √16 = 28 / 4 = 7.0 mg/dL.
SE = 7.0 mg/dL
3
Step 3 — Compute the t-Statistict = (x̄ − μ₀) / SE = (214 − 200) / 7.0 = 14 / 7 = 2.00.
t = 2.00
4
Step 4 — Determine Degrees of Freedom & Critical Valuedf = n − 1 = 15. For a two-tailed test at α = 0.05, the critical values from a t-table are approximately tcrit = ±2.131.
t_crit = ±2.131
5
Step 5 — DecisionBecause |t| = 2.00 < 2.131, the test statistic does not fall in the rejection region. Additionally, the two-tailed p-value ≈ 0.064, which exceeds α = 0.05.
Fail to reject H₀. Insufficient evidence at α = 0.05 to conclude that the mean serum cholesterol in this population differs from 200 mg/dL.

Example B: Independent Two-Sample t-Test (Pooled)

A pharmacologist compares the mean reduction in systolic blood pressure (mmHg) between a new antihypertensive drug (Group 1, n₁ = 12, x̄₁ = 15.2, s₁ = 4.0) and a placebo (Group 2, n₂ = 10, x̄₂ = 10.8, s₂ = 3.6). Assume equal variances. Test at α = 0.05 (two-tailed).

Two-Sample Pooled t-Test — Blood Pressure Reduction
1
Step 1 — State HypothesesH₀: μ₁ − μ₂ = 0 (no difference in mean BP reduction). H₁: μ₁ − μ₂ ≠ 0 (the drug produces a different mean reduction than placebo).
2
Step 2 — Compute the Pooled Variances²ₚ = [(12 − 1)(4.0²) + (10 − 1)(3.6²)] / (12 + 10 − 2) = [11 × 16 + 9 × 12.96] / 20 = [176 + 116.64] / 20 = 292.64 / 20 = 14.632.
s²ₚ = 14.632, so sₚ ≈ 3.825
3
Step 3 — Compute the Standard Error of the DifferenceSE = sₚ × √(1/n₁ + 1/n₂) = 3.825 × √(1/12 + 1/10) = 3.825 × √(0.0833 + 0.1000) = 3.825 × √0.1833 = 3.825 × 0.4282 ≈ 1.638.
SE ≈ 1.638 mmHg
4
Step 4 — Compute the t-Statistict = (x̄₁ − x̄₂) / SE = (15.2 − 10.8) / 1.638 = 4.4 / 1.638 ≈ 2.686.
t ≈ 2.686
5
Step 5 — Degrees of Freedom & Decisiondf = n₁ + n₂ − 2 = 20. The critical value at α = 0.05 (two-tailed) with 20 df is ±2.086. Since |t| = 2.686 > 2.086, we reject H₀. The p-value ≈ 0.014.
Reject H₀. At α = 0.05, there is statistically significant evidence that the drug reduces systolic BP more than the placebo.

Strengths, Limitations & Common Pitfalls

Comparison of strengths and limitations of the t-test framework
AspectStrengthsLimitations
Sample sizeValid for small samples (n < 30) when normality holds; no need for large nWith very small n (e.g., n < 5), even minor deviations from normality can distort results
RobustnessModerately robust to non-normality when n is large (Central Limit Theorem)Sensitive to heavy-tailed distributions and outliers, which inflate s and reduce power
Variance assumptionWelch's variant removes the equal-variance requirementThe pooled version can produce misleading results if σ₁² ≠ σ₂²
Number of groupsSimple interpretation and widespread understandingComparing more than two groups requires ANOVA; multiple t-tests inflate Type I error
Effect communicationEasy to supplement with confidence intervals and effect sizes (Cohen's d)A significant p-value does not convey the magnitude or clinical relevance of the effect
⚠️ KEY TAKEAWAY
Statistical significance is not the same as practical significance. A t-test might detect a 2 mg/dL difference in cholesterol with p < 0.05 if the sample is large enough, yet such a tiny difference may be clinically irrelevant. Always report a confidence interval alongside your p-value, and consider calculating Cohen's d (the difference in means divided by the pooled standard deviation) to quantify the effect size. Think of it this way: the p-value tells you whether an effect likely exists, but Cohen's d tells you how large that effect is — and in biomedical research, it is the size that determines whether you change clinical practice.

Connections to Advanced Theory

The t-test is not an isolated procedure; it sits at the crossroads of several more general frameworks. Understanding how it relates to ANOVA, linear regression, and nonparametric methods will deepen your statistical reasoning and prepare you for multivariate analyses encountered in advanced biostatistics coursework.

t-Test vs. advanced statistical methods
Featuret-TestAdvanced Extension
Number of groups1 or 2 groupsANOVA (≥ 2 groups); the two-sample t-test is a special case of one-way ANOVA with k = 2 (F = t²)
Model frameworkCompares means directlyLinear regression with a single binary predictor yields the same t-statistic and p-value as the two-sample t-test
Normality requiredYes (approximately)Nonparametric alternatives: Wilcoxon rank-sum (two-sample) or signed-rank (one-sample) when normality is violated
Multiple testingSingle comparisonBonferroni, Holm, or FDR corrections needed when performing many t-tests simultaneously (e.g., genomics)
Bayesian analogFrequentist frameworkBayesian t-tests assign prior distributions to μ and σ², yielding posterior probabilities and Bayes factors

A particularly elegant connection is the equivalence between the two-sample t-test and simple linear regression. If you code group membership as a binary variable (e.g., 0 for placebo, 1 for treatment) and regress the outcome on this indicator, the slope coefficient's t-statistic is identical to the independent-samples t-statistic. This insight generalizes: once you move to ANCOVA or multiple regression, you are effectively performing adjusted t-tests that control for covariates. Mastering the t-test therefore builds the conceptual scaffolding for the general linear model.

Practice Problems

PROBLEM 1CONCEPTUAL
Explain why the t-distribution has heavier tails than the standard normal distribution. Under what conditions does the t-distribution approach the z-distribution?
PROBLEM 2BASIC CALCULATION
A researcher measures the resting heart rate (bpm) of n = 25 healthy adults and obtains x̄ = 76.4 bpm with s = 8.0 bpm. Test whether the population mean differs from the textbook value of 72 bpm at α = 0.05 (two-tailed). Compute the t-statistic and state your conclusion.
PROBLEM 3INTERMEDIATE
Two independent groups of patients receive different rehabilitation protocols after knee surgery. Group A (n₁ = 15, x̄₁ = 38 degrees, s₁ = 6) and Group B (n₂ = 18, x̄₂ = 33 degrees, s₂ = 7) are assessed on range-of-motion improvement. Assuming equal variances, conduct a pooled two-sample t-test at α = 0.05 (two-tailed). Report the pooled standard deviation, t-statistic, degrees of freedom, and your conclusion.
PROBLEM 4APPLIED
An epidemiologist compares fasting blood glucose (mg/dL) between a sample of urban residents (n₁ = 40, x̄₁ = 102, s₁ = 14) and rural residents (n₂ = 35, x̄₂ = 96, s₂ = 10). She suspects unequal variances. Perform Welch's t-test at α = 0.05 (two-tailed). Compute the Satterthwaite-approximated degrees of freedom and interpret the result in a public health context.
PROBLEM 5CRITICAL THINKING
A colleague performs 10 independent two-sample t-tests across different biomarkers, each at α = 0.05, and finds that exactly one yields p < 0.05. She claims this biomarker significantly differs between groups. Critically evaluate this claim. What is the probability of obtaining at least one false positive among 10 tests under the global null hypothesis? Propose a correction strategy and discuss how it affects statistical power.

Lesson Summary

The one-sample t-test evaluates whether a single population mean differs from a hypothesized value μ₀, using the statistic t = (x̄ − μ₀) / (s / √n) with df = n − 1. The independent two-sample t-test compares means from two separate groups; the pooled version assumes equal population variances and uses df = n₁ + n₂ − 2, while Welch's t-test relaxes this assumption by approximating df via the Satterthwaite formula. Both tests rely on the t-distribution, which is heavier-tailed than the normal and accounts for the uncertainty in estimating σ from s.

Key assumptions include approximate normality of the data (or sufficient sample size for the CLT) and independence of observations. Always report a confidence interval alongside the p-value, and consider an effect size measure such as Cohen's d. When comparing more than two groups, transition to ANOVA rather than performing multiple t-tests, which inflates the Type I error rate. The two-sample t-test is equivalent to a simple linear regression with a binary predictor, a connection that generalizes naturally to multivariable models in advanced biostatistics.

Varsity Tutors • Biostatistics • One & Two-Sample t-Tests