College Statistics • Hypothesis Testing

t-Test for a Mean — Hypothesis Test for a Mean (t-test)

How to test claims about a population mean when the population standard deviation is unknown.

College Statistics subject emblem with a scatter plot, summation notation, and frequency columns.
Inside this lesson 10 sections 5 questions 8 figures

SECTION 1

Historical Context & Motivation

Statistical inference took a decisive turn in the early twentieth century when researchers confronted a practical problem: how do you draw reliable conclusions about a population mean when your sample is small and the population variance is unknown? Classical methods rooted in the normal distribution required knowledge of the population standard deviation σ, a quantity rarely available in practice. The resolution of this problem produced one of the most widely used statistical procedures in science—the one-sample t-test—and reshaped the way experimentalists analyze data across biology, psychology, engineering, and economics.

1908 • Student's t-Distribution

William Sealy Gosset, a chemist at Guinness Brewery in Dublin, published a landmark paper under the pseudonym "Student" in Biometrika. He derived the sampling distribution of the ratio (x̄ − μ) / (s / √n), showing it differs substantially from the standard normal when n is small.

1925 • Fisher's Formal Framework

R. A. Fisher rigorously proved Gosset's result, coined the term degrees of freedom, and published comprehensive t-distribution tables in Statistical Methods for Research Workers, making the t-test accessible to experimentalists worldwide.

1933 • Neyman–Pearson Hypothesis Testing

Jerzy Neyman and Egon Pearson formalized the decision-theoretic framework of null and alternative hypotheses, Type I and Type II errors, and power—concepts that provide the logical scaffolding for the modern t-test.

1970s–Present • Software & Modern Practice

With the advent of statistical computing software (SAS, SPSS, R, Python), the t-test became a routine one-command procedure. Contemporary practice supplements the test with effect sizes, confidence intervals, and checks on assumptions via diagnostic plots.

The central question the one-sample t-test answers is deceptively simple: given a sample of n observations from a population with unknown σ, is there sufficient evidence to conclude that the true population mean μ differs from a hypothesized value μ₀? By replacing σ with the sample standard deviation s and accounting for the extra uncertainty this substitution introduces, the t-test extends the logic of z-tests to the situations researchers actually face—small to moderate samples with estimated variability.

SECTION 2

Core Principles & Definitions

Before computing a single test statistic, it is essential to understand the conceptual architecture that supports the one-sample t-test. Several foundational ideas work in concert: the formulation of competing hypotheses, the selection of a significance level, the construction of a test statistic whose distribution is known under H₀, and a decision rule that controls the probability of a false alarm. The following grid distills these ideas.

1

Null & Alternative Hypotheses

The null hypothesis H₀ asserts that the population mean equals a specified value μ₀. The alternative hypothesis Hₐ specifies the direction of departure: two-tailed (μ ≠ μ₀), left-tailed (μ < μ₀), or right-tailed (μ > μ₀).
2

The t-Statistic

The test statistic t = (x̄ − μ₀) / (s / √n) measures how many estimated standard errors the sample mean lies from the hypothesized value. Under H₀, this ratio follows Student's t-distribution with n − 1 degrees of freedom.
3

Degrees of Freedom

With n observations used to compute s, one degree of freedom is consumed by x̄, leaving df = n − 1. Fewer degrees of freedom produce heavier tails, reflecting greater uncertainty in estimating σ.
4

Significance Level (α)

The significance level α (commonly 0.05) is the maximum tolerable probability of committing a Type I error—rejecting H₀ when it is actually true. The critical value(s) and rejection region are determined by α and the direction of Hₐ.
5

p-Value Decision Rule

The p-value is the probability, under H₀, of obtaining a test statistic at least as extreme as the one observed. If p ≤ α, the data are statistically significant and we reject H₀; otherwise, we fail to reject.
✦

KEY TAKEAWAY

Think of the t-test as a courtroom trial. The null hypothesis is the presumption of innocence—the population mean equals μ₀ unless the evidence says otherwise. The t-statistic is the strength of the prosecution's case, measured in units of uncertainty (standard errors). The significance level α sets the burden of proof: how compelling must the evidence be before the jury (the analyst) delivers a guilty verdict (rejects H₀)? A small p-value means the evidence is strong enough to overcome the presumption.

SECTION 3

Visual Explanation — The t-Distribution & Rejection Regions

Two-Tailed t-Test: Rejection Regions (α = 0.05, df = 14)0t = 0 (μ = μ₀)−t*+t*α/2α/2Fail to Reject H₀Reject H₀Reject H₀t-distribution (df = 14)≈ −2.145≈ +2.145
The bell-shaped curve represents Student's t-distribution with df = 14. The two shaded red rejection regions in the tails each contain α/2 = 0.025 of the probability. If the computed t-statistic falls beyond the critical values ±t* ≈ ±2.145, we reject H₀. The central non-rejection region contains 1 − α = 0.95 of the area. Notice that as df increases, the t-distribution approaches the standard normal, and the critical values converge to ±1.96.

The diagram above illustrates the logic of a two-tailed t-test. When the computed t-statistic lands in either tail beyond the critical values, the observed sample mean is sufficiently far from μ₀ that such a result would be very unlikely under the null hypothesis. For a one-tailed test—where the alternative specifies a single direction—the entire α area is placed in one tail, making the critical value less extreme but limiting the test to detecting departures in only that direction. The choice between one-tailed and two-tailed tests should be determined by the research question before the data are examined, never in response to the observed results.

SECTION 4

Mathematical Framework

The mathematical backbone of the one-sample t-test rests on the sampling distribution of the mean when the population standard deviation must be estimated from the data. We present the key formulas, connect them to the underlying distributional theory, and clarify the assumptions that make the procedure valid.

TEST STATISTIC

t=(xˉ−μ0)/(s/√n)t = (x̄ − μ₀) / (s / √n)

where x̄ = sample mean, μ₀ = hypothesized population mean, s = sample standard deviation, n = sample size. The denominator s / √n is the estimated standard error of the mean.

SAMPLE STANDARD DEVIATION

s=√[Σ(xi−xˉ)2/(n−1)]s = √[ Σ(xᵢ − x̄)² / (n − 1) ]

The division by n − 1 (Bessel's correction) produces an unbiased estimator of σ². Using n − 1 also determines the degrees of freedom of the resulting t-distribution.

DEGREES OF FREEDOM

df=n−1df = n − 1

Under H₀ and the assumption of normality, the test statistic t follows a Student's t-distribution with df = n − 1. As n → ∞, the t-distribution converges to the standard normal N(0, 1).

Assumptions

  • ✓ Random sampling: The observations are a simple random sample from the population of interest, ensuring independence.
  • ✓ Normality: The population distribution is approximately normal, or n is large enough (typically n ≥ 30) for the Central Limit Theorem to provide an adequate approximation.
  • ✓ Unknown σ: The population standard deviation is not known and must be estimated by s. If σ were known, a z-test would be appropriate instead.
⚠

Robustness Note

The t-test is reasonably robust to mild departures from normality, especially when the sample size exceeds 30. However, it is sensitive to extreme outliers and heavy skewness in small samples. Always inspect a histogram, boxplot, or normal probability plot before relying on the t-test. For severely non-normal data with small n, consider the Wilcoxon signed-rank test as a nonparametric alternative.

SECTION 5

Step-by-Step Testing Procedure

Performing a one-sample t-test follows a structured procedure that mirrors the general Neyman–Pearson framework for hypothesis testing. The flowchart below maps the decision points, and the detailed breakdown that follows explains each stage.

One-Sample t-Test Procedure Flowchart1. State H₀ and Hₐ2. Choose α (e.g., 0.05)3. Check Assumptions4. Compute t and df5. Find p-value or critical valuep ≤ α ?YesReject H₀NoFail to Reject
The flowchart shows the six-step procedure for conducting a one-sample t-test. Each colored box represents a stage: formulate hypotheses (violet), set significance level (cyan), verify assumptions (pink), compute the test statistic (amber), determine the p-value (emerald), and make a decision via the diamond decision node.

Detailed Breakdown of Each Step

StepActionKey Details
1State H₀ and HₐH₀: μ = μ₀. Choose Hₐ: μ ≠ μ₀ (two-tailed), μ < μ₀ (left-tailed), or μ > μ₀ (right-tailed) based on the research question.
2Select αCommon choices: 0.01, 0.05, or 0.10. Lower α reduces Type I error risk but increases Type II error risk.
3Verify assumptionsConfirm random sampling, check normality via histogram/QQ plot (or n ≥ 30), and ensure σ is unknown.
4Compute t and dft = (x̄ − μ₀) / (s / √n), df = n − 1.
5Determine p-valueUse a t-table or software. For two-tailed: p = 2 × P(T > |t|). For one-tailed: p = P(T > t) or P(T < t).
6Decision & conclusionIf p ≤ α → reject H₀ (evidence supports Hₐ). If p > α → fail to reject H₀ (insufficient evidence). State conclusion in context.

Summary of the one-sample t-test procedure

SECTION 6

Worked Example

A nutritionist claims that the mean daily caloric intake of college students at a particular university is 2,100 calories. A health researcher doubts this claim and collects a random sample of n = 20 students. The sample yields a mean of x̄ = 2,240 calories with a sample standard deviation of s = 280 calories. At the α = 0.05 significance level, is there sufficient evidence to conclude that the true mean caloric intake differs from 2,100?

Two-Tailed One-Sample t-Test

  1. 1

    Step 1 — State the Hypotheses

    Since the researcher wants to determine if the true mean differs from 2,100 (without specifying a direction), we set up a two-tailed test. H₀: μ = 2100 and Hₐ: μ ≠ 2100.
  2. 2

    Step 2 — Set Significance Level & Determine df

    α = 0.05. The degrees of freedom are df = n − 1 = 20 − 1 = 19. For a two-tailed test at α = 0.05 with 19 df, the critical values from the t-table are approximately ±2.093.
    df = 19, t* = ±2.093
  3. 3

    Step 3 — Check Assumptions

    The sample is random; n = 20 is moderate, so we require approximate normality of the population. We assume the researcher verified this via a histogram or normal probability plot (no extreme outliers or severe skewness were noted). The population σ is unknown, confirming the t-test (rather than a z-test) is appropriate.
  4. 4

    Step 4 — Compute the Test Statistic

    The standard error is SE = s / √n = 280 / √20 = 280 / 4.472 ≈ 62.61. The t-statistic is t = (x̄ − μ₀) / SE = (2240 − 2100) / 62.61 = 140 / 62.61 ≈ 2.236.
    t ≈ 2.236
  5. 5

    Step 5 — Determine the p-Value

    Using a t-distribution table or software with df = 19, P(T > 2.236) ≈ 0.019. For a two-tailed test, the p-value = 2 × 0.019 = 0.038.
    p ≈ 0.038
  6. 6

    Step 6 — Decision and Conclusion

    Since p ≈ 0.038 < α = 0.05, we reject the null hypothesis. Equivalently, the test statistic t ≈ 2.236 exceeds the critical value t* = 2.093 in the right tail. There is sufficient evidence at the 5% significance level to conclude that the mean daily caloric intake of college students at this university differs from 2,100 calories. The data suggest the true mean is higher, with a point estimate of 2,240 calories.
    Reject H₀ — evidence that μ ≠ 2100

SECTION 7

t-Test vs. z-Test — Strengths & Limitations

Students often wonder when to use the t-test versus the z-test. The distinction is practical, not philosophical: both test the same type of hypothesis about a population mean, but they differ in what they assume about σ and, consequently, in the reference distribution they use. The table below summarizes the key comparisons, followed by a broader discussion of the t-test's strengths and limitations.

FeatureOne-Sample z-TestOne-Sample t-Test
Population σKnownUnknown (estimated by s)
Reference distributionStandard normal N(0, 1)Student's t with df = n − 1
Tail heavinessFixed, thin tailsHeavier tails for small df; approaches z as n → ∞
Critical values (α = 0.05, two-tailed)±1.960 alwaysLarger; e.g., ±2.262 (df = 9), ±2.045 (df = 29)
Practical useRare (σ seldom known)Very common in applied research
Sample size sensitivityUnaffected by n for the distribution shapeRequires normality check for small n; robust for large n

Comparison of the one-sample z-test and one-sample t-test

💡

PRACTICAL INSIGHT

In virtually every real-world application, you will use the t-test rather than the z-test, because population standard deviations are almost never truly known. The z-test appears in textbooks primarily as a pedagogical stepping stone—it introduces the logic of hypothesis testing in a simpler setting before the additional complexity of estimating σ is introduced. Once you master the t-test, the z-test becomes a special case: just substitute σ for s and use the standard normal distribution.

Limitations of the t-Test

  • Sensitivity to outliers: Because x̄ and s are both influenced by extreme values, a single outlier can distort the t-statistic and lead to incorrect conclusions.
  • Normality assumption: For small samples (n < 15), the test is unreliable if the population is strongly skewed or heavy-tailed.
  • Statistical vs. practical significance: A very large sample can yield a tiny p-value even when the difference x̄ − μ₀ is trivially small. Always report confidence intervals and effect sizes alongside the p-value.

SECTION 8

Connections to Advanced Theory

The one-sample t-test is the simplest member of a large family of t-based procedures. Understanding it deeply prepares you for more complex settings—comparing two means, analyzing paired data, and conducting regression inference. The table below maps the one-sample t-test to its more advanced relatives, showing how the same underlying logic extends to richer designs.

ConceptOne-Sample t-TestAdvanced Extension
Number of groups1 (sample vs. hypothesized μ₀)2 (independent-samples t-test) or k (one-way ANOVA with F-test)
Paired dataNot applicablePaired t-test: apply one-sample t to the differences dᵢ = x₁ᵢ − x₂ᵢ
RegressionTests H₀: μ = μ₀Tests H₀: β = 0 for individual regression coefficients; t = b/SE(b)
Nonparametric analogAssumes normality (or large n)Wilcoxon signed-rank test: rank-based, no normality assumption
Bayesian versionFrequentist p-value decisionBayesian t-test: computes Bayes factor comparing H₀ to Hₐ

How the one-sample t-test connects to advanced methods

A particularly elegant connection exists between the one-sample t-test and the confidence interval for a mean. A two-tailed t-test at level α rejects H₀: μ = μ₀ if and only if the corresponding (1 − α) × 100% confidence interval x̄ ± t* × (s / √n) does not contain μ₀. This duality provides a powerful interpretive link: the confidence interval shows not just whether to reject, but the entire range of plausible values for μ given the data. In advanced coursework and research practice, reporting a confidence interval alongside the p-value is considered best practice because it conveys both statistical significance and the magnitude of the effect.

💡

Looking Ahead

In subsequent courses, you will encounter the two-sample t-test (comparing means of two independent groups), the paired t-test (pre/post designs), and analysis of variance (ANOVA), which generalizes the t-test to three or more groups. The F-statistic in one-way ANOVA is, in fact, the square of the t-statistic when there are only two groups (F = t²). Mastering the one-sample t-test gives you the conceptual and computational foundation for all of these extensions.

SECTION 9

Practice Problems

Question 1: CONCEPTUAL

Explain why we use a t-distribution rather than a standard normal distribution when performing a hypothesis test for a population mean with an unknown population standard deviation. In your explanation, describe what happens to the t-distribution as the sample size increases.
Show answer
When σ is unknown and must be estimated by s, the resulting test statistic t = (x̄ − μ₀) / (s / √n) incorporates two sources of randomness: the variability of x̄ and the variability of s. This additional uncertainty produces a distribution with heavier tails than the standard normal, meaning extreme values are more probable. The t-distribution with df = n − 1 captures this extra spread. As n increases, s becomes a more precise estimator of σ, so the additional tail weight diminishes. In the limit as n → ∞ (or equivalently df → ∞), the t-distribution converges to the standard normal N(0, 1). For practical purposes, when n exceeds approximately 30, the t and z critical values are quite close, though statisticians still prefer the t-distribution because it remains more accurate.

Question 2: BASIC CALCULATION

A manufacturer claims that the mean weight of its cereal boxes is 368 grams. A quality inspector randomly selects n = 25 boxes and finds x̄ = 364 g with s = 10 g. At α = 0.05, test whether the mean weight is less than 368 grams (left-tailed test). State your hypotheses, compute the test statistic, and determine the p-value.
Show answer
H₀: μ = 368 g; Hₐ: μ < 368 g (left-tailed). The standard error is SE = s / √n = 10 / √25 = 10 / 5 = 2.0 g. The test statistic is t = (364 − 368) / 2.0 = −4 / 2.0 = −2.0. With df = 25 − 1 = 24, we find the left-tail p-value: P(T < −2.0) ≈ 0.028. Since p ≈ 0.028 < α = 0.05, we reject H₀. There is sufficient evidence at the 5% level to conclude that the mean weight of cereal boxes is less than 368 grams. The critical value from the t-table is t* ≈ −1.711, and since −2.0 < −1.711, this confirms the rejection.

Question 3: INTERMEDIATE

A psychologist tests whether the mean reaction time for a stimulus is different from 250 milliseconds. She collects data from n = 16 participants and obtains x̄ = 262 ms with s = 20 ms. Conduct a two-tailed t-test at α = 0.01. Additionally, construct the 99% confidence interval for μ and verify that the hypothesis test result is consistent with the confidence interval.
Show answer
H₀: μ = 250 ms; Hₐ: μ ≠ 250 ms. SE = 20 / √16 = 20 / 4 = 5 ms. The test statistic is t = (262 − 250) / 5 = 12 / 5 = 2.4. With df = 15, the two-tailed p-value is 2 × P(T > 2.4) ≈ 2 × 0.015 = 0.030. Since p ≈ 0.030 > α = 0.01, we fail to reject H₀. The critical value for a two-tailed test at α = 0.01 with df = 15 is t* ≈ ±2.947, and |2.4| < 2.947 confirms the failure to reject. The 99% confidence interval is x̄ ± t* × SE = 262 ± 2.947 × 5 = 262 ± 14.74, giving (247.26, 276.74). Since μ₀ = 250 falls within this interval, the confidence interval is consistent with the test decision—we cannot exclude 250 as a plausible value for μ at the 1% level.

Question 4: APPLIED

An environmental agency claims that the mean dissolved oxygen level in a lake is 6.5 mg/L, which is considered healthy for aquatic life. An environmental scientist collects water samples at n = 12 randomly selected locations and measures dissolved oxygen levels (in mg/L): 5.9, 6.1, 6.3, 5.8, 6.0, 5.7, 6.4, 6.2, 5.6, 6.1, 5.9, 6.0. Test at α = 0.05 whether the mean dissolved oxygen level is below 6.5 mg/L. Discuss the practical significance of your findings.
Show answer
First, compute sample statistics: x̄ = (5.9 + 6.1 + 6.3 + 5.8 + 6.0 + 5.7 + 6.4 + 6.2 + 5.6 + 6.1 + 5.9 + 6.0) / 12 = 72.0 / 12 = 6.0 mg/L. The sample standard deviation s ≈ 0.237 mg/L (computed from the deviations from the mean). H₀: μ = 6.5; Hₐ: μ < 6.5 (left-tailed). SE = 0.237 / √12 ≈ 0.0684. t = (6.0 − 6.5) / 0.0684 = −0.5 / 0.0684 ≈ −7.31. With df = 11, P(T < −7.31) is extremely small (p < 0.0001). We reject H₀ at α = 0.05. There is overwhelming evidence that the mean dissolved oxygen level is below 6.5 mg/L. Practically, the estimated mean of 6.0 mg/L represents a deficit of 0.5 mg/L—while still above critically low thresholds (~4 mg/L), this reduction could stress sensitive species and warrants further monitoring and investigation into potential pollution sources.

Question 5: CRITICAL THINKING

A researcher conducts a one-sample t-test with n = 400 and obtains t = 2.10 with p = 0.036, rejecting H₀: μ = 50 at α = 0.05. The sample mean is x̄ = 50.3 with s = 2.86. Critically evaluate this result. Is the finding practically meaningful? Compute Cohen's d and the 95% confidence interval to support your argument. Discuss the distinction between statistical significance and practical significance.
Show answer
While the test is statistically significant (p = 0.036 < 0.05), the sample mean of 50.3 departs from μ₀ = 50 by only 0.3 units. Cohen's d = (x̄ − μ₀) / s = 0.3 / 2.86 ≈ 0.105, which is classified as a negligible to small effect (Cohen's benchmarks: small = 0.2, medium = 0.5, large = 0.8). The 95% confidence interval is x̄ ± t* × (s / √n) = 50.3 ± 1.966 × (2.86 / 20) = 50.3 ± 0.281, yielding (50.02, 50.58). This interval barely excludes 50 and shows the true mean likely lies very close to 50. The large sample size (n = 400) gave the test enormous power to detect even trivially small deviations. This example illustrates that statistical significance does not imply practical significance. With large samples, nearly any non-zero difference becomes detectable. Researchers should always supplement p-values with effect sizes and confidence intervals to assess whether the detected difference matters in context.

SUMMARY

Summary

Summary

The one-sample t-test is a hypothesis testing procedure used to determine whether a population mean μ differs from a hypothesized value μ₀ when the population standard deviation σ is unknown. The test statistic t = (x̄ − μ₀) / (s / √n) follows Student's t-distribution with df = n − 1 under the null hypothesis, accounting for the additional uncertainty introduced by estimating σ with the sample standard deviation s. Developed by William Gosset in 1908 and formalized by R. A. Fisher, the t-test remains one of the most widely applied statistical procedures across the sciences.

The procedure follows a structured sequence: state H₀ and Hₐ, select a significance level α, verify assumptions (random sampling, approximate normality), compute the t-statistic, obtain the p-value, and make a decision—reject H₀ if p ≤ α, fail to reject otherwise. Key considerations include the distinction between statistical and practical significance, the duality between hypothesis tests and confidence intervals, and the robustness of the test to moderate normality violations when n is sufficiently large. The one-sample t-test serves as the foundational building block for the paired t-test, two-sample t-test, and regression inference.

Varsity Tutors • College Statistics • t-Test for a Mean — Hypothesis Test for a Mean (t-test)