Hypothesis Tests for a Mean

How a test of a population mean works and what its p-value says. The logic of a test, the z test with known standard deviation and the t test with estimated standard deviation, worked on NHANES blood pressures and Student's sleep data, one- and two-sided alternatives, why a test and a confidence interval always agree, the American Statistical Association's six principles for reading a p-value, and the common misreadings they warn against. Worked problems from the course text on blood pressure, white blood cell counts, body mass index and percentage of ideal body weight.

A test of $H_0: \mu = \mu_0$ measures the distance from the sample mean to $\mu_0$ in standard errors. With $\sigma$ known, $z = (\bar{x} - \mu_0)/(\sigma/\sqrt{n})$ is standard normal under $H_0$; with $\sigma$ estimated, $t = (\bar{x} - \mu_0)/(s/\sqrt{n})$ has the $t$ distribution with $n - 1$ degrees of freedom, exactly for a normal population. For Student's ten sleep patients $t = 4.062$ and the two-sided $p = 0.0028$, so equal effectiveness is rejected. A two-sided level-$\alpha$ test rejects exactly the values outside the $100(1-\alpha)\%$ confidence interval. The $p$-value is not the probability that $H_0$ is true, nor a measure of effect size, and a large one is not evidence for $H_0$: 25 older NHANES adults gave $p = 0.081$ against a real 10.5 mm Hg difference.

Ten patients each took two sleeping drugs, and on average they slept 1.58 hours longer with the second than with the first. Confidence Intervals for a Mean turned that number into a 95% confidence interval, 0.70 to 2.46 hours, which says how large the difference plausibly is. But ten patients is a small sample, and some of the 1.58 hours is surely chance. So a different question is often asked first: are the data consistent with the two drugs being equally effective?

A hypothesis test answers that question, and for these ten patients its answer is no. It asks whether a difference this large is the kind of thing chance alone would be expected to produce. This article is the course's home for the logic of a test and the $p$-value, and later articles build on it.

Here is the route. First we name the parts of a test. Then we work the $z$ test on NHANES blood pressures, where the truth is known, and the $t$ test on Student's sleep data. Next we treat one- and two-sided alternatives, and prove that a test and an interval are one calculation. Finally we read the $p$-value as the American Statistical Association's 2016 statement asks, and name the misreadings it warns against. The article assumes the $t$ distribution of The Chi-Squared and t Distributions.

The logic of a test

A test reasons the way a skeptic does. It runs in three moves.

  1. Suppose the uninteresting explanation is true: the drugs are equally effective, and any difference in sleep is chance.
  2. Work out what data that supposition predicts.
  3. Compare the data actually observed with the prediction.

If the observed data would be very unusual under the supposition, that is evidence against it. If they are ordinary, the supposition survives, though it has not been shown true.

The parts of this argument have names.

  • The null hypothesis $H_0$ is the statement being tested, usually that a parameter equals a particular value: $H_0: \mu = \mu_0$. For the sleep data, $\mu$ is the mean extra sleep from drug 2 over drug 1 in a population of such patients, and $\mu_0 = 0$.
  • The alternative hypothesis $H_A$ says which departures from $H_0$ the test is meant to detect: $H_A: \mu \ne \mu_0$ for departures in either direction, or $H_A: \mu > \mu_0$ or $H_A: \mu < \mu_0$ for one direction only.
  • The test statistic measures how far the data fall from what $H_0$ predicts, in units that make its distribution known when $H_0$ is true. For a mean, it is the distance from the sample mean to $\mu_0$ in standard errors.
  • The $p$-value is the probability, computed supposing $H_0$ and every other assumption of the model are true, of a test statistic at least as far from what $H_0$ predicts as the one observed.
  • The significance level $\alpha$ is the threshold, chosen before the data are seen. $H_0$ is rejected when $p \le \alpha$.
  • Equivalently, $H_0$ is rejected when the test statistic falls in the rejection region, the set of values that has probability $\alpha$ under $H_0$. Its boundaries are the critical values.

The American Statistical Association's statement on $p$-values gives the informal definition this way: "a p-value is the probability under a specified statistical model that a statistical summary of the data (e.g., the sample mean difference between two compared groups) would be equal to or more extreme than its observed value" (Wasserstein and Lazar, 2016). The NIST/SEMATECH e-Handbook of Statistical Methods (§7.1.3.1) gives the same definition in terms of the test statistic. It recommends deciding in advance how small a $p$-value will lead to rejection, which is the same thing as choosing $\alpha$.

The vocabulary of the decision is deliberately lopsided. A test either rejects $H_0$ or fails to reject it. It never accepts or proves $H_0$. Data that are consistent with $\mu = 0$ are also consistent with many values near 0, and the test was not designed to tell them apart.

Now the logic needs a statistic whose distribution under $H_0$ we can compute. The simplest case is when $\sigma$ is known.

The z test: when sigma is known

The test statistic comes from the pivot used for confidence intervals in Confidence Intervals and Coverage. Let $X_1, \dots, X_n$ be independent draws from a population with mean $\mu$ and known standard deviation $\sigma$. Then

$$Z = \frac{\bar{X} - \mu}{\sigma/\sqrt{n}}$$

has a standard normal distribution, exactly for a normal population and approximately for a large sample from any population (the sampling distribution of the mean). If $H_0: \mu = \mu_0$ is true, we can substitute $\mu_0$ for $\mu$. That gives a quantity computable from the data whose distribution is known:

$$z = \frac{\bar{x} - \mu_0}{\sigma/\sqrt{n}} \sim N(0, 1) \text{ under } H_0.$$

This is the one-sample $z$ test. For $H_A: \mu \ne \mu_0$, values of $z$ far from zero in either direction count against $H_0$. So the two-sided $p$-value adds both tails:

$$p = P(|Z| \ge |z|) = 2\left[1 - \Phi(|z|)\right],$$

where $\Phi$ is the standard normal distribution function. At level $\alpha$ the rejection region is $|z| \ge z_{1-\alpha/2}$, which is $|z| \ge 1.960$ at $\alpha = 0.05$.

A test where the answer is known

The NHANES blood pressure population of Confidence Intervals and Coverage lets us watch a test at work with the truth in view. The 5,247 adults examined in the 2017 to 2018 survey (National Center for Health Statistics, 2020) have a mean systolic blood pressure of $\mu = 126.36$ mm Hg and a standard deviation of $\sigma = 20.12$ mm Hg. That article's first random sample of 25 adults had mean $\bar{x} = 128.88$.

Example (judging the distance before computing). The distance between this sample mean and 126.36 is not unusual, and that can be seen before any calculation. The sample mean is 2.52 mm Hg above 126.36, and the standard error is $20.12/\sqrt{25} = 4.024$ mm Hg. The distance is less than one standard error, and the rejection region begins at 1.96 standard errors. The full calculation, testing $H_0: \mu = 126.36$, which here we know to be true, confirms it:

$$z = \frac{128.88 - 126.36}{20.12/\sqrt{25}} = \frac{2.52}{4.024} = 0.626, \qquad p = 2[1 - \Phi(0.626)] = 0.531.$$

The sample mean is about six tenths of a standard error from the hypothesized value. When $H_0$ is true, a distance at least that large happens in 53% of samples. There is no evidence against $H_0$, and the test does not reject it. The 95% interval from the same sample, $[120.99, 136.77]$, contains 126.36, as the section on intervals below shows it must.

In practice, of course, nobody knows $\sigma$. The next section shows what changes when it must be estimated: the statistic keeps its form, and its distribution under $H_0$ becomes Student's $t$.

The t test: when sigma is estimated

When $\sigma$ is unknown, it is replaced by the sample standard deviation $s$. The Chi-Squared and t Distributions proved the consequence: for a normal population, $(\bar{X} - \mu)/(S/\sqrt{n})$ has a $t$ distribution with $n - 1$ degrees of freedom. Under $H_0: \mu = \mu_0$,

$$t = \frac{\bar{x} - \mu_0}{s/\sqrt{n}} \sim t_{n-1} \text{ under } H_0.$$

The two-sided $p$-value is $2\,P(T_{n-1} \ge |t|)$, with rejection region $|t| \ge t_{n-1,\,1-\alpha/2}$. This is the one-sample $t$ test. The NIST handbook (§7.2.2) gives it in this form, writing $\bar{Y}$ and $N$ for $\bar{x}$ and $n$. It is the test used in practice for a mean, since $\sigma$ is rarely known.

Student's sleep data

Back to the ten sleep patients. Their differences in hours of sleep, drug 2 minus drug 1, were worked in Confidence Intervals for a Mean: $\bar{d} = 1.580$, $s_d = 1.2300$, and the estimated standard error is $s_d/\sqrt{10} = 0.3890$ hours. The test of equal effectiveness follows in four steps.

Step 1, the hypotheses. $H_0: \mu = 0$, the drugs give the same sleep on average; $H_A: \mu \ne 0$, they do not. The alternative is two-sided because, before the trial, a difference in either direction would have mattered.

Step 2, the test statistic.

$$t = \frac{\bar{d} - 0}{s_d/\sqrt{n}} = \frac{1.580}{0.3890} = 4.062,$$

with $n - 1 = 9$ degrees of freedom. The observed mean difference is about four standard errors from zero.

Step 3, the $p$-value. Under $H_0$, $t$ follows the $t$ distribution with 9 degrees of freedom, and

$$p = 2\,P(T_9 \ge 4.062) = 0.0028.$$

Step 4, the decision. At $\alpha = 0.05$ the critical value is $t_{9,\,0.975} = 2.2622$, and $4.062$ exceeds it. Equivalently, $0.0028 < 0.05$. $H_0$ is rejected. It would also be rejected at $\alpha = 0.01$, whose critical value is $t_{9,\,0.995} = 3.2498$.

What the null hypothesis predicts for Student's sleep data: the t distribution with 9 degrees of freedom. The orange tails beyond plus or minus 2.262 hold 5% of the probability and form the rejection region at alpha = 0.05. Notice how far out in the right tail the observed t of 4.06 lies. The p-value is the area beyond plus and minus 4.06, too small to see at this scale (0.0028).
What the null hypothesis predicts for Student's sleep data: the t distribution with 9 degrees of freedom. The orange tails beyond plus or minus 2.262 hold 5% of the probability and form the rejection region at alpha = 0.05. Notice how far out in the right tail the observed t of 4.06 lies. The p-value is the area beyond plus and minus 4.06, too small to see at this scale (0.0028).

The data are hard to reconcile with equal effectiveness. Suppose the drugs were equally effective and the model's assumptions held. Then a mean difference at least four standard errors from zero would occur in about 3 samples in 1,000. The confidence interval adds what the test does not: how large the difference plausibly is, 0.70 to 2.46 hours.

Example (the normal distribution in place of $t$). Ignoring the estimation of $\sigma$, and using the normal distribution with $s_d$ in its place, gives a $p$-value that is too small: $p = 2[1 - \Phi(4.062)] = 0.00005$, nearly sixty times smaller than 0.0028. The $t$ distribution's heavier tails are the price of estimating $\sigma$ from ten numbers. Ignoring them overstates the evidence, just as it understates the width of an interval.

Fisher's version

R. A. Fisher's Statistical Methods for Research Workers (1925) was a handbook written for working scientists. It used the same data as its example of the significance of the mean of a small sample (§24, Ex. 19), quoted from Student's paper. Fisher compared the statistic with his table of $t$. For 9 degrees of freedom only one value in a hundred exceeds 3.250 in absolute value by chance, so "the difference between the results is clearly significant."

He then checked the conclusion a second way. Of the nine differences that are not zero, all are positive. If the drugs were equally effective, each sign would be like a coin toss, so all nine would agree by chance only twice in $2^9 = 512$ trials. This is the sign test, developed in The Sign Test and the Wilcoxon Signed-Rank Test. Fisher preferred the $t$ test because it uses "the actual values and not merely of their signs" (Fisher, 1925, §24).

The book is also the source usually cited for the convention of 0.05. Discussing the normal distribution, Fisher wrote that the deviation for which $P = .05$ "is 1.96 or nearly 2; it is convenient to take this point as a limit in judging whether a deviation is to be considered significant or not" (Fisher, 1925, §12). The reason he gave was convenience.

So far both tests reached the right verdict. The next section shows one that does not, because the null hypothesis is false but the sample is small.

A sample where the effect is real

Adults aged 60 and over in the NHANES population, 1,923 of them, have a mean systolic pressure of 136.85 mm Hg. That is 10.49 mm Hg above the all-adult mean. Suppose a study draws 25 of them and asks whether older adults' mean differs from the all-adult value. It tests $H_0: \mu = 126.36$ against $H_A: \mu \ne 126.36$, and here we know $H_0$ is false. The script's sample (seed 1) gave $\bar{x} = 133.19$ and $s = 18.76$, so

$$t = \frac{133.19 - 126.36}{18.76/\sqrt{25}} = \frac{6.83}{3.752} = 1.820, \qquad p = 2\,P(T_{24} \ge 1.820) = 0.081.$$

The critical value is $t_{24,\,0.975} = 2.0639$, so the test does not reject $H_0$ at the 0.05 level. Yet the difference it was looking for is real and clinically meaningful.

The 95% interval, $[125.44, 140.93]$, shows why. It includes the null value, and it also includes differences of 14 mm Hg. Twenty-five people were too few to settle the question. A study that reported this result as "no difference between older adults and the general population" would be reporting the opposite of the truth. How often a study of this size misses a real difference of this size is a question about its power. Type I and Type II Errors answers it: about 31% of the time.

One-sided and two-sided tests

Sometimes only one direction of departure matters. A one-sided test puts all of $\alpha$ in one tail. The NIST handbook (§7.2.2) lists the three forms of the test for a mean:

Null hypothesis Alternative Reject $H_0$ at level $\alpha$ when $p$-value
$\mu = \mu_0$ $\mu \ne \mu_0$ $\lvert t \rvert \ge t_{n-1,\,1-\alpha/2}$ $2\,P(T_{n-1} \ge \lvert t \rvert)$
$\mu \le \mu_0$ $\mu > \mu_0$ $t \ge t_{n-1,\,1-\alpha}$ $P(T_{n-1} \ge t)$
$\mu \ge \mu_0$ $\mu < \mu_0$ $t \le -t_{n-1,\,1-\alpha}$ $P(T_{n-1} \le t)$

The $z$ test has the same table with $z$ and the normal distribution in place of $t$ and $T_{n-1}$.

The one-sided nulls are composite: $H_0: \mu \le \mu_0$ contains many values of $\mu$. The test statistic is still computed at the boundary value $\mu_0$, and that is enough. If the true mean is below $\mu_0$, the sample mean tends to fall even further from the rejection region than it would at $\mu_0$. So the chance of rejecting is at most $\alpha$. The boundary is the worst case, and controlling the error there controls it everywhere in $H_0$.

The argument is exact for a normal population. Let the true mean be $\mu \le \mu_0$, and write $T = (\bar{X} - \mu)/(S/\sqrt{n})$, which has the $t$ distribution with $n - 1$ degrees of freedom. Since $\mu \le \mu_0$, the statistic satisfies $t = (\bar{X} - \mu_0)/(S/\sqrt{n}) \le T$. So whenever $t \ge t_{n-1,\,1-\alpha}$, also $T \ge t_{n-1,\,1-\alpha}$, and

$$P\left(t \ge t_{n-1,\,1-\alpha}\right) \le P\left(T \ge t_{n-1,\,1-\alpha}\right) = \alpha,$$

with equality when $\mu = \mu_0$. For the third row of the table, let $\mu \ge \mu_0$. Then $t \ge T$, so $t \le -t_{n-1,\,1-\alpha}$ forces $T \le -t_{n-1,\,1-\alpha}$, and the chance of rejecting is again at most $P(T \le -t_{n-1,\,1-\alpha}) = \alpha$. The same argument with $\sigma$ in place of $S$, and the standard normal $Z = (\bar{X} - \mu)/(\sigma/\sqrt{n})$ in place of $T$, proves it for the one-sided $z$ tests.

Example (a one-sided $p$-value without a table). For the sleep data and the one-sided alternative $H_A: \mu > 0$, that drug 2 gives more sleep, the $p$-value is half the two-sided value: $p = P(T_9 \ge 4.062) = 0.0014$. The $t$ distribution is symmetric, and the observed $t$ lies on the side the alternative names, so the one tail holds half of the two-tailed area. This is the number that One-Sided Confidence Bounds and Sample Size found as the confidence level 0.99858 at which the lower bound reaches zero. It agrees with the 0.9985 that Student (1908) reported as the probability that drug 2 is the better soporific. Student's reading of it is not the modern one, as the section on reading a $p$-value explains.

A one-sided test is more sensitive in its chosen direction and blind in the other. (The Neyman–Pearson Lemma makes this exact for the $z$ test: the one-sided test is the most powerful test of its level against every alternative on its side, and no test is most powerful against both sides at once.) Two cautions follow.

  • The side must be chosen before the data are seen. For the older adults above, the two-sided $p$ was 0.081. A test of $H_A: \mu > 126.36$ would give $p = P(T_{24} \ge 1.820) = 0.041$, below 0.05. Choosing the one-sided test after seeing which way the sample mean fell would turn a nonsignificant result into a significant one. One-Sided Confidence Bounds and Sample Size showed by simulation that doing so doubles the error rate from 5% to 10%. A one-sided test is legitimate when the protocol specifies it in advance. The question must genuinely have one direction, such as whether a new treatment is at least as good as the standard.
  • Two-sided is not always right either. Greenland and colleagues (2016, misinterpretation 14) list "One should always use two-sided P values" among common errors. When the question of interest is one-sided, a one-sided $p$-value is the appropriate one, provided the report says so and why.

Tests and intervals are the same calculation

The sleep test rejected $\mu = 0$, and the 95% interval, 0.70 to 2.46, excludes 0. The NHANES test did not reject 126.36, and its interval contains 126.36. That is no coincidence. Here is the idea in one sentence: both come from the same pivot, and distance is symmetric, so $\mu_0$ is close to $\bar{x}$ exactly when $\bar{x}$ is close to $\mu_0$.

The formal version. The two-sided $t$ test at level $\alpha$ fails to reject $H_0: \mu = \mu_0$ exactly when $|t| < t_{n-1,\,1-\alpha/2}$, that is, when

$$-t_{n-1,\,1-\alpha/2} < \frac{\bar{x} - \mu_0}{s/\sqrt{n}} < t_{n-1,\,1-\alpha/2}.$$

Multiply through by $s/\sqrt{n}$, which is positive, and rearrange each inequality to isolate $\mu_0$:

$$\bar{x} - t_{n-1,\,1-\alpha/2}\frac{s}{\sqrt{n}} < \mu_0 < \bar{x} + t_{n-1,\,1-\alpha/2}\frac{s}{\sqrt{n}}.$$

That is exactly the statement that $\mu_0$ lies inside the $100(1-\alpha)\%$ confidence interval. So the $100(1-\alpha)\%$ interval is the set of values $\mu_0$ that a two-sided level-$\alpha$ test would not reject. A value is rejected exactly when it lies outside the interval. The NIST handbook (§7.2.2.1) states the same equivalence: the 95% interval includes the null value if, and only if, the hypothesis would not be rejected at the 5% level. The one-sided version, a test against a lower confidence bound, is derived in One-Sided Confidence Bounds and Sample Size.

The equivalence can be drawn. Compute the two-sided $p$-value for every hypothesized value $\mu_0$, not only for zero. The result is a curve that peaks at $p = 1$ when $\mu_0$ equals the sample mean and falls away on both sides.

The two-sided p-value of the t test for Student's sleep data, computed for every hypothesized mean mu0 rather than only for zero. Notice that it equals 1 at the sample mean, 1.58 hours, and crosses p = 0.05 exactly at 0.70 and 2.46, the ends of the 95% confidence interval. The null value of zero, far out on the left, has p = 0.0028.
The two-sided p-value of the t test for Student's sleep data, computed for every hypothesized mean mu0 rather than only for zero. Notice that it equals 1 at the sample mean, 1.58 hours, and crosses p = 0.05 exactly at 0.70 and 2.46, the ends of the 95% confidence interval. The null value of zero, far out on the left, has p = 0.0028.

Example (testing a mean of 2.0 hours). A two-sided test at 0.05 does not reject the hypothesis that drug 2 adds a mean of 2.0 hours. The value 2.0 lies inside the 95% interval, so the test cannot reject it. The table gives its $p$-value, 0.308.

Hypothesized mean $\mu_0$ (hours) 0 0.5 0.70 1.0 1.58 2.0 2.46 3.0
Two-sided $p$ 0.0028 0.0215 0.050 0.170 1.000 0.308 0.050 0.0053

The curve makes two points that a single test hides.

  • The value zero is not special to the data. It is one of many hypotheses, and the data are about as incompatible with a mean of 3 hours ($p = 0.0053$) as with a mean of zero.
  • The values inside the interval are not all equally compatible with the data. The value 1.58 fits perfectly and 0.70 only barely.

Greenland and colleagues (2016) recommend thinking of $p$-values this way, as a measure of the compatibility between the data and each candidate value under the model. They note that the exclusive focus on the null value obscures the close relationship between $p$-values and intervals.

A practical consequence is that an interval carries everything the test does and more. Suppose a report gives $\bar{d} = 1.58$ hours, 95% interval 0.70 to 2.46. A reader learns that a test of zero rejects at 0.05, and how large the effect plausibly is. With the 99% interval, $[0.316, 2.844]$, which excludes zero too, the reader also learns that a test at 0.01 would reject.

Reading a p-value

The $p$-value is among the most misread numbers in science. In 2016 the American Statistical Association issued, for the first time, a statement on a matter of statistical practice. It set out six principles for the use and interpretation of $p$-values, for researchers, practitioners and science writers who are not primarily statisticians (Wasserstein and Lazar, 2016). The accompanying editorial explains that the board was responding in part to concern about the reproducibility of published research. It deliberately left out alternative hypotheses, error types and power, which the next two articles of this topic take up.

The most common misreading comes before the principles.

Example (the probability of the hypothesis). A report on the sleep trial that says "$p = 0.0028$, so there is only a 0.28% chance that the two drugs are equally effective" is wrong. The $p$-value was computed by supposing the drugs are equally effective. It is a probability about the data, given that supposition, so it cannot also be the probability of the supposition. The second principle below says so directly.

Here are the six principles, with what each means for a test of a mean.

1. "P-values can indicate how incompatible the data are with a specified statistical model." The smaller the $p$-value, the greater the incompatibility of the data with the null hypothesis, if the assumptions used to compute it hold. For the sleep data the model includes $\mu = 0$. It also includes that the ten differences are independent draws from a normal population. A small $p$-value casts doubt on the model as a whole, of which the null hypothesis is one part.

2. "P-values do not measure the probability that the studied hypothesis is true, or the probability that the data were produced by random chance alone." For the sleep data, $p = 0.0028$ does not mean there is a 0.28% chance that the drugs are equally effective. Nor, read the other way, is $1 - p = 0.9972$ the probability that drug 2 is better. Student's 1908 reading of the one-sided value was "the odds are about 666 to one that 2 is the better soporific." That is exactly this inversion, and it is the first misinterpretation in Greenland and colleagues' list (2016, misinterpretation 1). Turning a $p$-value into a probability for a hypothesis needs a prior probability for the hypothesis and Bayes' theorem. It has the same structure as turning a test result into the probability of disease in Predictive Values and Bayes' Theorem.

3. "Scientific conclusions and business or policy decisions should not be based only on whether a p-value passes a specific threshold." Nothing happens at 0.05 except a convention. The older-adult sample above has $p = 0.081$. By the threshold, it is "not significant." By the interval, the mean lies between 0.9 mm Hg below and 14.6 mm Hg above the all-adult value. The interval describes what the data say. The word "nonsignificant" describes only which side of a convenient line the $p$-value fell.

4. "Proper inference requires full reporting and transparency." A $p$-value means what it says only if it was not selected for being small. Three practices make the reported $p$-value uninterpretable:

  • running several analyses and reporting the one that reached significance;
  • choosing the side of a test after looking;
  • stopping data collection as soon as $p$ dips below 0.05.

Type I and Type II Errors measures how much each practice inflates the error rate.

5. "A p-value, or statistical significance, does not measure the size of an effect or the importance of a result." The $t$ statistic is the estimated effect divided by its standard error, and the standard error shrinks like $1/\sqrt{n}$. So any nonzero difference becomes significant with enough data, and any difference can fail to be significant with too little. The script checked both directions on the NHANES population.

Situation True difference from $\mu_0$ $n$ Median $p$ Share of samples with $p < 0.05$
All adults, $H_0: \mu = 125$ 1.36 mm Hg 5,000 $1.9 \times 10^{-6}$ 0.998
Aged 60 and over, $H_0: \mu = 126.36$ 10.49 mm Hg 10 0.142 0.248

A difference of 1.36 mm Hg is too small to matter to any patient. With 5,000 people it gives a typical $p$-value of two in a million. A difference of 10.5 mm Hg is large enough to matter a great deal. With 10 people it gives a typical $p$-value of 0.14 and is detected in only a quarter of samples. The $p$-value mixes the size of the effect with the size of the study; the estimate and its interval keep them apart. Effect Sizes and Standardized Differences measures the size of a difference on scales that do not grow with the sample.

6. "By itself, a p-value does not provide a good measure of evidence regarding a model or hypothesis." In particular, a large $p$-value is not evidence for the null hypothesis. The NHANES sample of 25 from all adults gave $p = 0.53$ for $H_0: \mu = 126.36$, which happens to be true. The older-adult sample gave $p = 0.081$ for the same $H_0$, which is false. Neither number, alone, says which case it came from. Greenland and colleagues (2016, misinterpretations 4 to 6) list the forms this error takes. They run from reading a nonsignificant result as showing that the test hypothesis is true, to concluding that "no effect was observed." Their remedy is the interval: it shows at once whether the data exclude effects that would matter.

The statement closes by noting that some statisticians supplement or replace $p$-values with other approaches. Some emphasize estimation, such as confidence intervals; others use Bayesian methods and likelihood ratios. Its last sentence is the shortest summary of all six principles: "No single index should substitute for scientific reasoning."

The common misreadings, in their usual words

In reports, the errors the principles guard against usually appear in a few familiar sentences.

  • "The $p$-value is the probability that the null hypothesis is true." For the sleep data that would put equal effectiveness at 0.28%. The $p$-value assumes $H_0$; it is not a probability for $H_0$ (principle 2; Greenland et al., 2016, misinterpretation 1).
  • "$1 - p$ is the probability that the effect is real." Student's "666 to one" is this inversion (principle 2).
  • "The $p$-value is the probability that the result is due to chance alone." The calculation supposes chance alone, so it cannot measure the probability of that supposition (principle 2; misinterpretation 2).
  • "$p > 0.05$, so there is no effect." The older-adult sample had $p = 0.081$ and a real difference of 10.49 mm Hg (principle 6; misinterpretations 4 to 6).
  • "$p$ is tiny, so the effect is large or important." The 1.36 mm Hg difference had a typical $p$ of two in a million (principle 5; misinterpretation 7).
  • "$p$ is large, so the effect is small." The 10.49 mm Hg difference had a typical $p$ of 0.14 with ten people (principle 5; misinterpretation 8).
  • "We rejected at 0.05, so the chance we are wrong is 5%." This confuses a long-run error rate with a single result (misinterpretation 10), as Type I and Type II Errors shows.

Assumptions

The $t$ test inherits the assumptions of the $t$ interval:

  • independent observations from a single population;
  • for exact error rates in small samples, a normal population.

Confidence Intervals for a Mean showed that the $t$ interval tolerates moderate skewness and fails for strong skewness. The test, being the same calculation, behaves the same way.

One detail matters more for tests than for intervals. Take a right-skewed population such as blood pressure. A one-sided test of $H_A: \mu < \mu_0$ rejects a true null much more often than $\alpha$, and the opposite one-sided test much less often. The cause is that samples that miss the long tail have both a low mean and a small standard deviation. Type I and Type II Errors measures the size of the effect.

The paired design of the sleep trial reduces to a one-sample test on the differences. It is developed further in The Paired Samples t-Test. For skewed data or outliers, the sign and signed-rank tests make weaker assumptions.

The same tests, applied to the per-topic differences between two search engines, are worked in the information retrieval wiki's Significance Testing. That article sets them alongside the sign test, the Wilcoxon test, the randomization test and the bootstrap, on one example where they disagree.

Worked problems

The five problems are exercises from the course text's chapter on hypothesis testing (Pagano, Gauvreau and Mattie, 2022), restated in our words with their data and solved here. Every number is recomputed by the article's script.

Problem 1 (diastolic pressure of women with diabetes). Diastolic blood pressures of women aged 30 to 34 with diabetes have unknown mean $\mu_d$ and known standard deviation $\sigma_d = 9.1$ mm Hg. The mean for all women of that age is 74.4 mm Hg. A sample of 10 women with diabetes has mean 84 mm Hg. State the hypotheses of a two-sided test, compute the test statistic, name its distribution, find the $p$-value, and give the decision and conclusion at $\alpha = 0.05$. Would the conclusion change at $\alpha = 0.01$?

Solution. The test rejects $H_0$ at both levels: $z = 3.34$ and $p = 0.00085$. The hypotheses are $H_0: \mu_d = 74.4$ and $H_A: \mu_d \ne 74.4$. The standard deviation is known, so this is a $z$ test. The standard error is $9.1/\sqrt{10} = 2.8777$, and

$$z = \frac{84 - 74.4}{2.8777} = \frac{9.6}{2.8777} = 3.336.$$

Under $H_0$ the statistic is standard normal, exactly if the pressures are normal and approximately otherwise. The $p$-value is $2[1 - \Phi(3.336)] = 2 \times 0.000425 = 0.00085$. Since $0.00085 < 0.05$, equivalently $3.336 > 1.960$, $H_0$ is rejected. The sample mean lies more than three standard errors above 74.4, and the data indicate that the mean diastolic pressure of women with diabetes in this age group is higher than that of women in general. At $\alpha = 0.01$ the critical value is $z_{0.995} = 2.576$, and $3.336$ still exceeds it, so the conclusion is the same.

Problem 2 (white blood cell counts). Among people infected with E. canis, a tick-borne disease of dogs that people sometimes contract, white blood cell counts have unknown mean $\mu$ and unknown standard deviation. The mean count in the general population is 7,250 per mm³, and infected people are believed to have lower counts on average. A sample of 15 infected people has mean 4,476 per mm³ and standard deviation 3,204 per mm³. Carry out the one-sided test at $\alpha = 0.05$.

Solution. The test rejects $H_0$: $t = -3.35$ with 14 degrees of freedom, and $p = 0.0024$. The belief to be examined is that the mean is lower, so the hypotheses are $H_0: \mu \ge 7250$ and $H_A: \mu < 7250$. The standard deviation is estimated, so this is a $t$ test. The estimated standard error is $3204/\sqrt{15} = 827.27$, and

$$t = \frac{4476 - 7250}{827.27} = \frac{-2774}{827.27} = -3.353.$$

If the counts are normal and $\mu = 7250$, the statistic has the $t$ distribution with $15 - 1 = 14$ degrees of freedom. The alternative names the lower tail, so $p = P(T_{14} \le -3.353) = 0.0024$. The rejection region is $t \le -t_{14,\,0.95} = -1.761$, and $-3.353$ lies in it. The data indicate that infected people have a lower mean white blood cell count than the general population.

One caution belongs with the conclusion. The sample standard deviation is more than two thirds of the sample mean, and counts cannot be negative, so the population is probably skewed to the right. The Assumptions section notes that a lower-tailed $t$ test on a right-skewed population rejects a true null hypothesis more often than $\alpha$. With a statistic this far out the conclusion is unlikely to depend on that, but the $p$-value should not be read to four decimals.

Problem 3 (body mass index and diabetes). For middle-aged men who later develop diabetes, baseline body mass index is approximately normal with unknown mean $\mu$ and unknown standard deviation. A sample of 58 such men has mean 25.0 kg/m² and standard deviation 2.7 kg/m². (a) Construct a 95% confidence interval for $\mu$. (b) Test at the 0.05 level whether $\mu$ equals 24.0 kg/m², the mean for men who do not develop diabetes. (c) State the conclusion. (d) Could the result of the test have been predicted from the interval?

Solution. (a) The interval is $[24.29, 25.71]$ kg/m². The estimated standard error is $2.7/\sqrt{58} = 0.3545$. With 57 degrees of freedom, $t_{57,\,0.975} = 2.0025$, so the margin is $2.0025 \times 0.3545 = 0.710$ and the interval is $25.0 \pm 0.710$.

(b) The test rejects $H_0: \mu = 24.0$ against $H_A: \mu \ne 24.0$. The statistic is

$$t = \frac{25.0 - 24.0}{0.3545} = 2.821,$$

which under $H_0$ has the $t$ distribution with 57 degrees of freedom. The $p$-value is $2\,P(T_{57} \ge 2.821) = 0.0066$, below 0.05.

(c) The data indicate that men who later develop diabetes have a higher mean baseline body mass index than men who do not. The interval adds the size: the difference is plausibly between 0.29 and 1.71 kg/m².

(d) Yes. The 95% interval is the set of values a two-sided test at 0.05 does not reject, by the equivalence proved above. The value 24.0 lies below the interval's lower end, 24.29, so the test had to reject it.

Problem 4 (blood pressure after a coronary event). Male industrial workers in London who have never had a major coronary event have mean systolic pressure 136 mm Hg and mean diastolic pressure 84 mm Hg. A sample of 86 workers who have had such an event has mean systolic pressure 143 mm Hg with standard deviation 24.4 mm Hg, and mean diastolic pressure 87 mm Hg with standard deviation 16.0 mm Hg. Test at the 0.10 level, two-sided, whether each mean equals the value for workers without an event, and state the conclusions.

Solution. Both tests reject at the 0.10 level: $t = 2.66$ ($p = 0.0093$) for systolic pressure and $t = 1.74$ ($p = 0.086$) for diastolic. Each is a $t$ test with $86 - 1 = 85$ degrees of freedom, and the critical value is $t_{85,\,0.95} = 1.663$.

Systolic. $H_0: \mu_s = 136$ against $H_A: \mu_s \ne 136$. The standard error is $24.4/\sqrt{86} = 2.6311$, so $t = (143 - 136)/2.6311 = 2.660$ and $p = 2\,P(T_{85} \ge 2.660) = 0.0093$.

Diastolic. $H_0: \mu_d = 84$ against $H_A: \mu_d \ne 84$. The standard error is $16.0/\sqrt{86} = 1.7253$, so $t = (87 - 84)/1.7253 = 1.739$ and $p = 2\,P(T_{85} \ge 1.739) = 0.086$.

Both statistics exceed 1.663, so both null hypotheses are rejected at the 0.10 level. The data indicate that workers who have had a coronary event have higher mean systolic and diastolic pressures than those who have not. The two results are not equally strong. The systolic difference would also be significant at 0.01. The diastolic difference would not be significant at 0.05, since $0.086 > 0.05$. With 86 observations the sample mean is close to normally distributed whatever the shape of the population (the central limit theorem), and $s$ is close to $\sigma$ (Moment Generating Functions and Slutsky's Theorem proves that the substitution leaves the normal limit unchanged), so the tests do not lean heavily on the normality of blood pressures.

Problem 5 (percentage of ideal body weight). The percentages of ideal body weight of 18 randomly selected people with insulin-dependent diabetes were

107, 119, 99, 114, 120, 104, 88, 114, 124, 116, 101, 121, 152, 100, 125, 114, 95, 117.

A value of 120 means a weight 20% above ideal. Test at the 0.05 level the null hypothesis that the population mean is 100%, and state the conclusion.

Solution. The test rejects $H_0$: $t = 3.76$ with 17 degrees of freedom, and $p = 0.0016$. The hypotheses are $H_0: \mu = 100$ and $H_A: \mu \ne 100$; the problem names no direction, so the test is two-sided. The summary statistics come first.

  • The 18 values sum to 2,030, so $\bar{x} = 2030/18 = 112.78$.
  • The squared deviations from the mean sum to 3,537.11, so $s = \sqrt{3537.11/17} = \sqrt{208.07} = 14.42$.
  • The estimated standard error is $14.42/\sqrt{18} = 3.400$.

The statistic is

$$t = \frac{112.78 - 100}{3.400} = 3.758,$$

and $p = 2\,P(T_{17} \ge 3.758) = 0.0016$. The critical value is $t_{17,\,0.975} = 2.110$, which 3.758 exceeds. The data indicate that people with insulin-dependent diabetes weigh more than their ideal weight on average. The 95% interval gives the size: $112.78 \pm 2.110 \times 3.400 = [105.60, 119.95]$, a mean between about 6% and 20% above ideal. One value, 152, is far above the others. Without it the mean of the remaining 17 is 110.47 and the statistic is $t = 3.95$ with 16 degrees of freedom, larger than before: removing the value lowers the standard error (from 3.40 to 2.65) by a larger proportion than it lowers the excess over 100 (from 12.78 to 10.47). So the conclusion does not rest on that one person.

What we have learned

A test measures, in standard errors, how far the data fall from what the null hypothesis predicts. The $p$-value is the chance of a distance at least that large if the null hypothesis and the model hold: 0.0028 for the ten sleep patients, 0.53 for a true null in NHANES, 0.081 for a real difference studied with 25 people. A two-sided test rejects exactly the values outside the matching confidence interval, so the interval carries the verdict and the size of the effect. The $p$-value is not the probability that the null hypothesis is true, nor a measure of effect size.

The older-adult study left an uncomfortable fact: a test can reach the wrong verdict with no error in the arithmetic. How often that happens, in each direction, is measured in the next article, Type I and Type II Errors. What sample size makes a miss rare is in Power and Sample Size for a Test of a Mean. The same 25 adults also have diastolic pressures, and Hotelling's T-Squared Test tests their two mean pressures at once.

In Python

import numpy as np
from scipy import stats

d = np.array([1.2, 2.4, 1.3, 1.3, 0.0, 1.0, 1.8, 0.8, 4.6, 1.4])
res = stats.ttest_1samp(d, popmean=0)
print(res.statistic, res.pvalue)                  # 4.062, 0.00283
print(stats.ttest_1samp(d, 0, alternative='greater').pvalue)   # 0.00142
print(res.confidence_interval(0.95))              # about (0.700, 2.460)

# z test with known sigma: no library call needed
from statistics import NormalDist
z = (128.88 - 126.36) / (20.12 / 25 ** 0.5)
print(z, 2 * (1 - NormalDist().cdf(abs(z))))      # 0.626, 0.531

ttest_1samp reports a two-sided $p$-value unless alternative is set; the side should come from the study's question, not from the result. The library's Inferential Statistics in Python runs the same test with scipy on a sample from the NHANES adults, whose mean is known, and adds a permutation test. Inference for Proportions and Means sets ttest_1samp beside statsmodels' ttest_mean, which agree on the answer but not on missing values or on what they return. Every number in this article is computed by tools/experiments/applied-statistics/hypothesis-tests-for-a-mean.py in the site's repository, which implements the $t$ distribution directly and was checked against scipy 1.17.1.

References

  • Fisher, R. A. (1925). Statistical Methods for Research Workers. Edinburgh: Oliver and Boyd. §12 (The normal distribution) and §24 (The significance of the mean of a unique sample), Ex. 19. Online edition: Classics in the History of Psychology, York University. https://psychclassics.yorku.ca/Fisher/Methods/ record · 8 pages
  • Greenland, S., Senn, S. J., Rothman, K. J., Carlin, J. B., Poole, C., Goodman, S. N., and Altman, D. G. (2016). Statistical tests, P values, confidence intervals, and power: a guide to misinterpretations. European Journal of Epidemiology, 31(4), 337–350. record · 5 pages
  • National Center for Health Statistics (2020). National Health and Nutrition Examination Survey 2017–2018: Demographic Variables and Sample Weights (DEMO_J) and Blood Pressure (BPX_J) data files. Centers for Disease Control and Prevention. https://wwwn.cdc.gov/nchs/nhanes/continuousnhanes/default.aspx?BeginYear=2017 record · 109 pages
  • NIST/SEMATECH. e-Handbook of Statistical Methods, §7.1.3.1 (Critical values and p values), §7.2.2 (Are the data consistent with the assumed process mean?) and §7.2.2.1 (Confidence interval approach). National Institute of Standards and Technology. https://www.itl.nist.gov/div898/handbook/ record · 37 pages
  • Pagano, M., Gauvreau, K., and Mattie, H. (2022). Principles of Biostatistics (3rd ed.). CRC Press. The course text. record · 48 pages
  • Student (1908). The probable error of a mean. Biometrika, 6(1), 1–25. record · 17 pages
  • Wasserstein, R. L., and Lazar, N. A. (2016). The ASA statement on p-values: Context, process, and purpose. The American Statistician, 70(2), 129–133. https://doi.org/10.1080/00031305.2016.1154108 record · 6 pages

Reviewed: verified, 16 Nov 2026 · citations checked, 16 Nov 2026 · editorial review, 23 Nov 2026 · 13 revisions