Test Statistics and Sampling Distributions

1 Test Statistics and Sampling Distributions

Hypothesis testing is the engine of statistical inference, and at its heart lies a single computed number called the test statistic. Every time a researcher wants to decide whether an observed pattern in data is real or merely a product of chance, they compress all of the relevant sample information into this one value, then ask: "If the null hypothesis were true, how likely would it be to see a test statistic this extreme or more extreme?" Answering that question requires understanding not just how to calculate the test statistic, but also how it behaves under repeated sampling — which is precisely what a sampling distribution describes. Together, test statistics and their associated sampling distributions form the theoretical backbone of virtually every formal hypothesis test used in science, medicine, economics, psychology, and engineering.

A test statistic is a numerical summary computed from sample data that is designed to measure how far the observed data deviate from what the null hypothesis predicts. Because it is derived from a random sample, the test statistic is itself a random variable, and its behavior across all possible samples of the same size follows a predictable probability distribution — the sampling distribution. The key insight is that we do not need to actually draw millions of samples; mathematical theory tells us exactly what that distribution looks like, provided certain assumptions are met.

What Is a Test Statistic?

In the simplest terms, a test statistic converts raw sample evidence into a standardized score that can be evaluated against a known reference distribution. Rather than asking "Is our sample mean of 52 large or small?", we ask "How many standard errors away from the hypothesized mean is 52?" That reframing produces a number that lives on a universal scale, making it possible to attach a precise probability to the outcome.

Consider a concrete illustration. Suppose a manufacturer claims that the mean fill volume of soda bottles is 500 mL. You sample 40 bottles and find a mean of 497 mL with a known population standard deviation of 8 mL. The question is not simply "Is 497 less than 500?" — of course it is. The real question is whether the gap of 3 mL is large relative to the variability expected from random sampling. The test statistic answers exactly that.

Three key principles govern all test statistics:

Different research questions call for different formulas. Testing a mean requires one approach; testing a proportion, a variance, or a relationship between categorical variables requires others. The choice of formula determines which reference distribution is used for evaluation.

Sampling Distributions and Their Role

A sampling distribution is the probability distribution of a statistic — such as the sample mean, sample proportion, or sample variance — computed over all possible samples of a fixed size drawn from the same population. It is a theoretical construct, but an extraordinarily powerful one. It tells us not what one particular sample will look like, but what the full landscape of possible sample outcomes looks like.

In hypothesis testing, the sampling distribution is evaluated under the assumption that the null hypothesis is true. If that assumption holds, we know the center, spread, and shape of the distribution of the test statistic. When we observe a test statistic that falls far in the tail of that distribution — in a region with very little probability mass — we have grounds to doubt the null hypothesis.

The four sampling distributions most commonly encountered in hypothesis testing are:

The shape and parameters of these distributions depend critically on assumptions: sample size, whether the population variance is known, the underlying data type, and whether observations are independent. Violating assumptions changes the true sampling distribution, potentially invalidating p-values and conclusions.

The Z-Test Statistic

The Z-test statistic is used when the goal is to compare a sample mean (or proportion) to a hypothesized value and the population standard deviation σ is known, or when the sample is large enough (conventionally n ≥ 30) that the sample standard deviation provides a reliable estimate and the Central Limit Theorem guarantees approximate normality.

The formula for the one-sample Z-test for a mean is:

Z = (x̄ − μ₀) / (σ / √n)

where is the sample mean, μ₀ is the hypothesized population mean under H₀, σ is the known population standard deviation, and n is the sample size. The denominator σ/√n is the standard error of the mean — how much sample means vary from sample to sample due to chance alone.

Returning to the soda bottle example: x̄ = 497, μ₀ = 500, σ = 8, n = 40.

Z = (497 − 500) / (8 / √40)
  = −3 / (8 / 6.324)
  = −3 / 1.265
  ≈ −2.37

A Z-value of −2.37 means the sample mean is 2.37 standard errors below the hypothesized mean. On the standard normal distribution, this is quite far from center. The Z-value is then compared to a critical value — for a two-tailed test at α = 0.05, the critical values are ±1.96. Since −2.37 < −1.96, we reject the null hypothesis and conclude the true mean fill volume is likely less than 500 mL.

The Central Limit Theorem (CLT) is the mathematical justification for the Z-test's broad applicability. It states that for any population with finite mean and variance, the sampling distribution of the sample mean approaches a normal distribution as n increases, regardless of the shape of the original population. This means a Z-test can be validly applied even to data from skewed or non-normal populations, as long as n is sufficiently large.

The t-Test Statistic

In most real-world situations, the population standard deviation σ is unknown. When we substitute the sample standard deviation s into the standard error formula, the resulting statistic no longer follows a standard normal distribution — it follows a t-distribution with n − 1 degrees of freedom. The t-distribution is similar in shape to the normal but has heavier tails, reflecting the additional uncertainty introduced by estimating σ from the data.

The one-sample t-test statistic is:

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

where s is the sample standard deviation. Suppose a nutritionist claims a new diet reduces daily caloric intake to 1,800 kcal. A sample of 15 participants shows x̄ = 1,750 kcal and s = 120 kcal. The t-statistic is:

t = (1750 − 1800) / (120 / √15)
  = −50 / (120 / 3.873)
  = −50 / 30.98
  ≈ −1.61

With df = 15 − 1 = 14, the critical value for a two-tailed test at α = 0.05 is approximately ±2.145. Since |−1.61| < 2.145, we fail to reject H₀.

Notice that the critical value from the t-distribution (2.145) is larger than its normal counterpart (1.96) for the same α. This reflects greater uncertainty — with small samples and unknown σ, we require more extreme evidence to declare a result statistically significant.

Two-sample t-tests extend this logic to compare the means of two independent groups. The test statistic measures how different the two sample means are relative to the combined sampling variability. If groups 1 and 2 have means x̄₁ and x̄₂, sample standard deviations s₁ and s₂, and sizes n₁ and n₂, the (unpooled) two-sample t-statistic is:

t = (x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂)

The paired t-test applies when two measurements are linked — for instance, blood pressure measured before and after treatment on the same patients. Rather than treating the two groups as independent, we compute the difference dᵢ = x₁ᵢ − x₂ᵢ for each pair and then perform a one-sample t-test on those differences against a null hypothesis that the mean difference equals zero:

t = (d̄ − 0) / (s_d / √n)

By working with differences, the paired design eliminates between-subject variability that would otherwise inflate the standard error, making the test more powerful than an independent two-sample t-test when pairing is natural and appropriate.

Choosing the Right Test Statistic

Selecting the correct test statistic is not arbitrary — it depends on (1) what is being measured (means, proportions, variances, counts), (2) what is known about the population (σ known or unknown), and (3) the design of the study (one sample, two independent samples, paired, multiple groups). Applying the wrong test statistic produces a test statistic that does not follow the assumed reference distribution, leading to incorrect p-values and potentially false conclusions.

The table below provides a structured guide to common scenarios:

Research Question Conditions Test Statistic Formula Reference Distribution
Compare one sample mean to hypothesized value σ known; any n (or large n) Z = (x̄ − μ₀) / (σ/√n) Standard normal (Z)
Compare one sample mean to hypothesized value σ unknown; small or large n t = (x̄ − μ₀) / (s/√n) t with df = n − 1
Compare two independent group means σ unknown t = (x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂) t with Welch's df
Compare paired/matched measurements Differences approximately normal t = d̄ / (s_d/√n) t with df = n − 1
Test a single population proportion Large sample (np₀ ≥ 5, n(1−p₀) ≥ 5) Z = (p̂ − p₀) / √(p₀(1−p₀)/n) Standard normal (Z)
Test goodness-of-fit or independence of categorical variables Expected counts ≥ 5 per cell χ² = Σ (O − E)² / E Chi-square with appropriate df
Compare means across 3 or more groups simultaneously Normal populations, equal variances F = MS_between / MS_within F with df₁ = k−1, df₂ = N−k
Compare two population variances Normal populations F = s₁² / s₂² F with df₁ = n₁−1, df₂ = n₂−1

For testing proportions, the logic mirrors the Z-test for means. Suppose a political candidate claims 60% of voters support them. A poll of 200 voters finds 108 supporters (p̂ = 0.54). Under H₀: p = 0.60, the standard error is √(0.60 × 0.40 / 200) ≈ 0.0346, and:

Z = (0.54 − 0.60) / 0.0346 ≈ −1.73

This Z-value is then evaluated against the standard normal distribution, just like a Z-test for means.

For chi-square tests, observed cell counts (O) are compared to expected counts (E) calculated under the null hypothesis. Each discrepancy is squared (to remove sign), divided by the expected count (to standardize), and summed. Larger χ² values indicate greater discrepancy from the null model.

For ANOVA F-tests, the ratio of between-group variance to within-group variance captures whether groups differ more than chance would predict. An F-ratio near 1 is consistent with no group differences; a large F-ratio suggests at least one group mean differs.

Degrees of Freedom

Degrees of freedom (df) represent the number of independent pieces of information in a statistic — roughly, how many values are free to vary once certain constraints (like a known mean) are imposed. They are not merely a technical formality; they determine the exact shape of the t, chi-square, or F distribution used for the test.

For a one-sample t-test, df = n − 1. Why n − 1 rather than n? Because the sample mean x̄ is already computed from the data and is used when calculating s. Once x̄ is fixed and n − 1 of the data values are known, the last value is completely determined — it has no freedom to vary. Thus, effectively only n − 1 observations contribute independent information to the variance estimate.

The practical consequences of degrees of freedom are illustrated below. As df increases, the t-distribution narrows toward the standard normal:

Degrees of Freedom Critical t-value (two-tailed, α = 0.05) Compared to Z critical value (1.96)
1 12.706 Much larger — very heavy tails
5 2.571 Noticeably larger
10 2.228 Somewhat larger
20 2.086 Close to normal
30 2.042 Very close
120 1.980 Nearly identical
1.960 Equal to Z

For chi-square goodness-of-fit tests, df = k − 1 where k is the number of categories. For a chi-square test of independence in an r × c contingency table, df = (r − 1)(c − 1). For ANOVA, between-group df = k − 1 (where k is the number of groups) and within-group df = N − k (where N is the total number of observations). Using the wrong degrees of freedom means consulting the wrong row or column in a statistical table, producing incorrect critical values and invalid conclusions.

Connecting the Test Statistic to a P-Value

Once the test statistic is computed, the final inferential step is to quantify how unusual it is under the null hypothesis. This is the role of the p-value: the probability of obtaining a test statistic as extreme as or more extreme than the one observed, assuming the null hypothesis is true.

Geometrically, the p-value is an area under the sampling distribution curve. The test statistic marks a point on the horizontal axis, and the p-value is the area of the tail (or tails) beyond that point.

For the soda bottle example with Z = −2.37 and a one-tailed lower alternative (H₁: μ < 500), the p-value = P(Z < −2.37) ≈ 0.0089. This means there is approximately a 0.89% chance of observing a sample mean as low as 497 mL or lower if the true mean were actually 500 mL. Such a small probability provides strong evidence against the null hypothesis.

The decision rule is then straightforward:

It is essential to appreciate what the p-value is not. It is not the probability that the null hypothesis is true. It is not the probability that the result occurred by chance. It is solely a conditional probability: how likely is this test statistic (or one more extreme) given that H₀ is true? Misinterpreting the p-value is one of the most common errors in applied statistics.

The relationship between test statistic magnitude and p-value is monotone and inverse: as |test statistic| increases, the p-value decreases. A test statistic of 1.2 (Z-test, two-tailed) corresponds to p ≈ 0.23 — not significant at α = 0.05. A test statistic of 3.5 corresponds to p ≈ 0.0005 — extremely significant. This relationship is what allows us to say that a larger absolute test statistic provides stronger evidence against H₀.

The entire process — from research question to test statistic formula, through the appropriate sampling distribution, to a p-value, and finally to a reject/fail-to-reject decision — forms a unified logical chain. Each link depends on the ones before it: the choice of test statistic determines the sampling distribution; the sampling distribution and the observed test statistic together determine the p-value; and the p-value, compared to α, determines the conclusion. Understanding each link deeply, rather than mechanically applying formulas, is what separates skilled statistical reasoning from rote calculation.

NotesThe topic integrates all six subtopic clusters (definition of test statistics, sampling distributions, Z-test, t-test, choosing the right statistic, degrees of freedom, and p-value connection) into a single cohesive narrative. Two summary tables are included to aid comprehension without breaking the flow of explanation.