One-Sample Tests
You have a claim about the world, and you have one sample of data. A hypothesis test is the careful way to ask whether the data are surprising enough to make you doubt the claim. This chapter builds a single five step method that never changes. Then it pours three different one sample cases into it. The first is a mean when the population standard deviation is somehow known. The second is a mean when it is not, which is the far more common case and the reason Student's t distribution exists. The third is a proportion. Every formula here is the same idea in different clothes: how far is the estimate from the claim, measured in standard errors? Get comfortable with that one sentence, and the rest is bookkeeping.
By the end of this chapter you can
- State a null and an alternative hypothesis in symbols and in words, and choose one-tailed or two-tailed correctly.
- Carry out the five steps of any hypothesis test in order, without memorizing a separate recipe for each test.
- Work out and read a z-test for a mean when σ is known.
- Work out and read a t-test for a mean when σ is unknown, and explain degrees of freedom.
- Work out and read the one-proportion z-test, including why the standard error uses p0 and not p̂.
- State a p-value correctly, and say just what it is not.
- Check the assumptions each test needs, and say what happens when they fail.
- Tell statistical significance apart from practical importance, and link a test to its matching confidence interval.
Section 1The five steps of a test

One procedure, every test
People often try to memorize hypothesis testing as a pile of unrelated formulas. It is not that. There is one method, and the only thing that changes between tests is which formula you plug into step 3. Learn the skeleton once, and the whole chapter shrinks into something you can manage.
A hypothesis test begins with a claim about a population parameter. That is a fixed, unknown number describing the whole population, like the population mean μ or the population proportion p. You cannot see the parameter. You can only see a statistic worked out from a sample, such as x̄ or p̂. The test asks a single question: if the claim were true, how unusual would a sample like mine be?
| Step | What you do | What it looks like |
|---|---|---|
| 1 | State the hypotheses about the parameter: before looking at the data | H0: μ = 500 Ha: μ ≠ 500 |
| 2 | Choose the significance level α and check the conditions the test requires | α = 0.05; random sample, normal enough |
| 3 | Compute the test statistic: distance from the claim, in standard errors | z or t = (estimate − claim) ÷ SE |
| 4 | Find the p-value (or compare to the critical value) | p = 0.0124; or |z| > 1.96? |
| 5 | Decide and interpret in context: in plain words, about the original claim | “Reject H0; there is evidence the mean differs from 500.” |
Two rules govern step 1. First, the null hypothesis H0 always holds the equality. It is the “nothing unusual is happening” statement, the exact number the math needs. Second, the alternative hypothesis Ha states what you are actually looking for. It must be chosen from the research question, never from the direction the data happened to fall. Picking a one sided alternative after seeing which way the sample leaned doubles your real error rate while pretending it did not.
Reading a p-value without getting it wrong
The p-value is the probability of getting a test statistic at least as extreme as the one you saw, worked out under the assumption that the null hypothesis is true. That last part is not decoration; it is the whole meaning of the number. A small p-value says: “data like these would be rare if H0 held.” That gives grounds for doubting H0.
Say a test gives z = 2.50 with a two-tailed alternative. From the standard normal, the upper tail beyond 2.50 has an area of 0.0062. The alternative is two sided, so both tails count: p = 2 × 0.0062 = 0.0124. Compared with α = 0.05, we have 0.0124 < 0.05, so we reject H0. Compared with a stricter α = 0.01, we have 0.0124 > 0.01, and we would fail to reject. It is the same data and the same evidence; only the cutoff changed. That is worth thinking about, because it shows α is a habit you adopt, not a trait of nature.
| Statement about p = 0.0124 | Correct? | Why |
|---|---|---|
| “If H0 were true, results this extreme happen about 1.2% of the time.” | Yes | This is the definition |
| “There is a 1.2% probability that H0 is true.” | No | The p-value assumes H0; it cannot also measure its probability |
| “There is a 98.8% probability the alternative is true.” | No | Same error, wearing a hat |
| “The effect is large and important.” | No | p-values shrink with sample size; they measure evidence, not size |
| “A large p-value proves H0 is true.” | No | Absence of evidence is not evidence of absence: we say fail to reject |
Notice the awkward phrase fail to reject, chosen on purpose. We never “accept” the null. A test that comes up empty may mean the null is true. Or it may just mean the sample was too small to detect a real difference. Courts acquit for lack of evidence without declaring the defendant a saint, and statistics does the same.
Two ways to be wrong
You are deciding with uncertainty, so you can go wrong in two directions. A Type I error is rejecting a true null, which is a false alarm. Its long run rate is exactly α, which is why you choose α before you look. A Type II error is failing to reject a false null, which is a miss, with rate β. The power of a test is 1 − β, the chance of catching a real effect when one exists. Power rises with larger samples, larger true effects, less variability and a larger α.
| H0 is actually true | H0 is actually false | |
|---|---|---|
| Reject H0 | Type I error (rate α) | Correct decision (power = 1 − β) |
| Fail to reject H0 | Correct decision | Type II error (rate β) |
- Every test follows the same five steps, and only the formula in step 3 changes.
- H0 holds the equality. Ha comes from the question, never from the data.
- A p-value is P(data this extreme given H0 is true), not P(H0 is true).
- We fail to reject; we never accept. α is the Type I error rate, and power = 1 − β.
Section 2Z-test for a mean

Where the formula comes from
Take repeated random samples of size n from a population with mean μ and standard deviation σ. The sample means x̄ bounce around, but not wildly and not without a pattern. They center on μ, and they spread out with a standard deviation of σ∕√n. That amount is the standard error of the mean. The √n in the denominator is the math version of a very natural fact: bigger samples give steadier averages. Make the sample four times as big, and you halve the standard error.
Say that, on top of that, the sampling distribution of x̄ is normal. That happens either because the population is normal, or because n is large enough for the Central Limit Theorem to take over. Then standardizing gives a familiar amount:
z = ( x̄ − μ0 ) ∕ ( σ ∕ √n )
Read it out loud in plain English: how many standard errors is my sample mean away from the claimed mean? That is all a test statistic ever is. The z-test is the version you use when σ, the population standard deviation, is known ahead of time and does not have to be estimated from your data.
Be honest about how rare that is. In real research, you almost never know σ while still not knowing μ. The z-test earns its place in two ways. It is the honest tool when a factory process, a calibrated instrument or a standardized test has decades of history pinning σ down. And it is the clean stepping stone that makes the t-test in the next section easy to understand.
A worked example
A bottling line is supposed to fill bottles to a mean of 500 mL. Years of process records show that the fill standard deviation is steady at σ = 4.0 mL. A quality worker pulls a random sample of n = 25 bottles and finds a sample mean of x̄ = 498.2 mL. Is the line off target? Test at α = 0.05.
Step 1: hypotheses. The line could drift either way, and both directions matter, so the test is two-tailed:
H0: μ = 500 Ha: μ ≠ 500
Step 2: level and conditions. α = 0.05. The sample is random, σ is known from the history of the process and fill volumes from a machine are about normal. The conditions are met.
Step 3: test statistic. First find the standard error, then standardize:
SE = σ ∕ √n = 4.0 ∕ √25 = 4.0 ∕ 5 = 0.80 mL
z = (498.2 − 500) ∕ 0.80 = (−1.8) ∕ 0.80 = −2.25
The sample mean sits 2.25 standard errors below the target.
Step 4: p-value. From the standard normal table, the area below z = −2.25 is 0.0122. The alternative is two sided, so we double it:
p = 2 × 0.0122 = 0.0244
The critical value route agrees. For a two-tailed test at α = 0.05, the critical values are ±1.96, and |−2.25| = 2.25 > 1.96. So the statistic lands in the rejection region.
Step 5: decide and explain. Since 0.0244 < 0.05, reject H0. There is statistically significant evidence at the 5% level that the mean fill volume differs from 500 mL, and the sample suggests underfilling by about 1.8 mL. Now say the worker only cared about underfilling and had stated Ha: μ < 500 before collecting data. Then the p-value would be the single lower tail, 0.0122.
The confidence interval says the same thing
A two sided test at level α and a 100(1 − α)% confidence interval are two views of one calculation. The 95% interval here is
498.2 ± 1.96 × 0.80 = 498.2 ± 1.57 → (496.63, 499.77)
The claimed value 500 lies outside that interval, which is just why the test rejected. The rule holds in general. A two sided test rejects H0: μ = μ0 at level α exactly when the 100(1 − α)% interval leaves out μ0. The interval is often the more useful report, because it also tells you the believable size of the gap, which a p-value never does.
| Alternative | p-value from z | Critical value at α = 0.05 | Reject when |
|---|---|---|---|
| Ha: μ ≠ μ0 | 2 × P(Z > |z|) | ±1.96 | |z| > 1.96 |
| Ha: μ > μ0 | P(Z > z) | +1.645 | z > 1.645 |
| Ha: μ < μ0 | P(Z < z) | −1.645 | z < −1.645 |
- z = (x̄ − μ0) ∕ (σ∕√n): the estimate's distance from the claim, in standard errors.
- The standard error σ∕√n shrinks with √n, so four times the data gives half the wobble.
- Use the z-test only when σ is truly known, not estimated from the sample.
- A two sided test at α rejects exactly when the matching 100(1 − α)% confidence interval leaves out μ0.
Section 3T-test for a mean

The problem with substituting s for σ
In real work, σ is unknown, so you estimate it with the sample standard deviation s. The formula looks almost the same:
t = ( x̄ − μ0 ) ∕ ( s ∕ √n )
But something subtle has changed. The z formula had one random amount in it, x̄. The t formula has two, because s jumps around from sample to sample as well. That extra source of noise makes extreme values more common than the normal curve predicts. William Sealy Gosset worked this out around 1908, while running small batch experiments at a brewery. He published under the pen name “Student,” and so it is called Student's t distribution.
The t distribution is symmetric and bell shaped like the normal, and it is centered at zero. But it has heavier tails, meaning more probability far from the center. Heavier tails mean larger critical values, so the t-test needs more evidence before it will reject. That is not a flaw. It is the honest price of not knowing σ.
Degrees of freedom
The t distribution is not one curve but a family, labeled by degrees of freedom. For a one sample t-test, df = n − 1.
Why n − 1 instead of n? Working out s means first working out x̄ from the same data, and that costs you one piece of independent information. Here is a concrete view. If you know four deviations from the mean, the fifth is forced, because the deviations must add up to zero. That is five numbers with four of them free, so four degrees of freedom. Every degree of freedom you spend estimating something is one less left to measure variability.
As df grows, s becomes a reliable stand in for σ, the extra noise fades and the t curve comes closer and closer to the standard normal. You can see this in any table of critical values.
| df | n | Two-tailed t* at α = 0.05 | Comment |
|---|---|---|---|
| 5 | 6 | 2.571 | Much stricter than 1.96 |
| 10 | 11 | 2.228 | Still noticeably stricter |
| 15 | 16 | 2.131 | Closing in |
| 20 | 21 | 2.086 | |
| 30 | 31 | 2.042 | About 4% above the normal value |
| 60 | 61 | 2.000 | Nearly indistinguishable |
| ∞ | - | 1.960 | The standard normal itself |
A worked example
A transit planner claims that the mean one way trip to work in a city area is 30 minutes. A random sample of n = 16 workers gives x̄ = 33.4 minutes with s = 6.4 minutes. Test the claim at α = 0.05.
Step 1. H0: μ = 30 Ha: μ ≠ 30 (the claim could be wrong in either direction).
Step 2. α = 0.05. The sample is random. n = 16 is small, so we need the distribution of trip times to be about symmetric with no big outliers. Look at a dotplot or boxplot before going on.
Step 3.
SE = s ∕ √n = 6.4 ∕ √16 = 6.4 ∕ 4 = 1.60 minutes
t = (33.4 − 30) ∕ 1.60 = 3.4 ∕ 1.60 = 2.125 with df = 16 − 1 = 15
Step 4. The two-tailed critical value at df = 15 is t* = 2.131. Our statistic, 2.125, falls a hair short of it, so the two-tailed p-value is a hair above 0.05. Software gives p ≈ 0.051.
Step 5. Since 0.051 > 0.05, we fail to reject H0. At the 5% level, there is not quite enough evidence to conclude that the mean trip differs from 30 minutes. The matching 95% interval tells the same story: 33.4 ± 2.131 × 1.60 = 33.4 ± 3.41 → (29.99, 36.81), which contains 30, but only barely.
Now watch what a larger sample does. Say the same x̄ = 33.4 and s = 6.4 had come from n = 25:
SE = 6.4 ∕ √25 = 6.4 ∕ 5 = 1.28 t = 3.4 ∕ 1.28 = 2.656, df = 24, t* = 2.064, p ≈ 0.014
The estimated effect is the same, 3.4 minutes, but now we reject with room to spare. Nothing about the world changed; only how exact our measurement was. This is why “not significant” must never be reported as “no difference.” It is also why a study's sample size belongs in every conclusion you read.
- t = (x̄ − μ0) ∕ (s∕√n). Use it whenever σ is unknown, which is nearly always.
- Estimating σ with s adds noise, so the t curve has heavier tails and larger critical values than the normal.
- df = n − 1, because one degree of freedom was spent working out x̄.
- As df → ∞, the t distribution becomes the standard normal.
Section 4Test for a proportion

Counting successes
Often the variable is made of groups (categorical) instead of numbers: yes or no, faulty or fine, voted or did not. The parameter of interest is then the population proportion p. The estimate is the sample proportion p̂ = x∕n, where x is the number of successes.
The count x follows a binomial distribution. When the sample is large enough, a smooth normal curve comes very close to that lumpy binomial histogram, and that is what lets us reuse the z tools. Under H0: p = p0, the sampling distribution of p̂ is about normal, with mean p0 and standard error √( p0(1 − p0) ∕ n ). Standardizing gives the one-proportion z-test:
z = ( p̂ − p0 ) ∕ √( p0(1 − p0) ∕ n )
Note this with care: there is no t-test for a proportion. For a mean, the center and the spread are separate parameters, so estimating the spread costs you degrees of freedom. For a proportion, they are locked together. The variability p0(1 − p0) is fully set by the value p0 that the null already names. Nothing extra is being estimated, so no t fix is needed.
A worked example
A policy group claims that 60% of adults in a region support a proposed measure. An independent random sample of n = 400 adults finds 216 supporters. Does this go against the claim? Test at α = 0.05.
Step 1. H0: p = 0.60 Ha: p ≠ 0.60
Step 2. α = 0.05. Check the success/failure condition using p0: np0 = 400(0.60) = 240 ≥ 10, and n(1 − p0) = 400(0.40) = 160 ≥ 10. The sample is random, and 400 adults is far under 10% of the region's population, so the observations are close enough to independent. The conditions are met.
Step 3. Find the sample proportion and the null standard error:
p̂ = 216 ∕ 400 = 0.54
SE0 = √( 0.60 × 0.40 ∕ 400 ) = √( 0.24 ∕ 400 ) = √0.0006 = 0.02449
z = (0.54 − 0.60) ∕ 0.02449 = (−0.06) ∕ 0.02449 = −2.45
Step 4. The area below z = −2.45 is 0.00714. It is two sided, so p = 2 × 0.00714 = 0.0143.
Step 5. Since 0.0143 < 0.05, reject H0. There is statistically significant evidence that the true support rate differs from 60%, and the sample points to something closer to 54%.
The one place students reliably slip
The test and the confidence interval use different standard errors, and that is not a contradiction. A test is run in the null's world, so it uses the null's variability, p0(1 − p0). A confidence interval assumes no one value, so it must estimate variability from the data, using p̂(1 − p̂).
For our data, the 95% interval is
SE = √( 0.54 × 0.46 ∕ 400 ) = √0.000621 = 0.02492
0.54 ± 1.96 × 0.02492 = 0.54 ± 0.0488 → (0.491, 0.589)
The interval leaves out 0.60, which agrees with the rejection. Because the two standard errors differ a little, a test and interval can now and then disagree in borderline cases. That is a known quirk, not an error on your part.
| Situation | Standard error | Why |
|---|---|---|
| Hypothesis test | √( p0(1 − p0)∕n ) | Everything is computed assuming H0 is true |
| Confidence interval | √( p̂(1 − p̂)∕n ) | No null value is assumed, so estimate from the data |
| Condition to check | np0 ≥ 10 and n(1 − p0) ≥ 10 | The normal approximation to the binomial must hold |
| If the condition fails | Exact binomial test | Compute tail probabilities from the binomial directly |
- p̂ = x∕n, and the test statistic is z = (p̂ − p0) ∕ √(p0(1 − p0)∕n).
- The test's standard error uses p0, and the confidence interval's uses p̂.
- Check np0 ≥ 10 and n(1 − p0) ≥ 10. Otherwise, use the exact binomial test.
- There is no t-test for a proportion, because the null value sets the variability and nothing extra is estimated.
Section 5Assumptions

Three conditions, in order of importance
A p-value is only as trustworthy as the assumptions used to work it out. Every one sample test rests on three conditions, and they are plainly not equally forgiving.
1. Random sampling. The data must come from a random sample of the population you want to describe, or from a randomized experiment. This is the assumption that cannot be rescued. Say your sample is a convenience sample, an online poll where people picked themselves or the volunteers who happened to show up. Then x̄ estimates the wrong thing, and no amount of data fixes it. A bigger biased sample simply gives you a more exact wrong answer.
2. Independence. Each observation must carry information not already held in the others. Sampling with replacement promises it. Sampling without replacement is close enough, as long as n is no more than about 10% of the population. Clustered data break this badly. Measuring five patients from each of ten clinics is not fifty independent observations. Treating it as if it were gives a standard error that is too small and a p-value that looks too impressive.
3. Approximate normality of the sampling distribution. This is the one everyone worries about, and it is the most forgiving of the three. What must be about normal is the sampling distribution of x̄, not the raw data. The Central Limit Theorem says that as n grows, the distribution of x̄ comes closer and closer to normal, whatever the population's shape. Skewed populations just need larger samples to get there.
| Sample size | What the data must look like | How to check |
|---|---|---|
| n < 15 | Close to symmetric, no outliers, no clear skew | Dotplot or boxplot, and be conservative |
| 15 ≤ n < 40 | Mild skew acceptable; outliers still a problem | Histogram plus a normal quantile plot |
| n ≥ 40 | Even fairly skewed data are usually fine | Still plot the data; look for outliers and errors |
| Any n, proportions | np0 ≥ 10 and n(1 − p0) ≥ 10 | Arithmetic, not a plot |
Robustness, and what to do when a condition fails
A method is robust if it still works well enough when its assumptions are broken a little. The one sample t-test is famously robust to data that are not normal, once n is moderate. But it is not robust to outliers in small samples. A single mistyped value can drag both x̄ and s and flip a conclusion. And no test is robust to a sample that is not random, or to observations that depend on each other. Those failures do not just widen the uncertainty; they make it worthless.
| Test | Requires | If violated |
|---|---|---|
| z-test for μ | Random, independent, σ known, x̄ normal | If σ is estimated, use the t-test instead |
| t-test for μ | Random, independent, population not strongly skewed for small n | Increase n, or use a nonparametric test such as the sign or signed-rank test |
| One-proportion z-test | Random, independent, np0 ≥ 10 and n(1 − p0) ≥ 10 | Use the exact binomial test |
| All three | Hypotheses fixed before seeing the data | The stated α is fiction; the real error rate is higher |
The assumption nobody writes down
Beyond the math conditions sits one about method. The hypotheses, the significance level and the direction of the alternative must be settled before the data are looked at. Say you test many outcomes and report only the significant one, or switch to a one-tailed alternative after seeing which way the sample fell. Either one pushes the Type I error rate far above the α you claimed. With twenty independent tests at α = 0.05, you expect one “significant” result by chance alone, even if nothing at all is going on.
Last, remember what a test cannot tell you. Statistical significance means “probably not just noise.” It does not mean large, important or worth acting on. With n = 1,000,000, a difference of 0.02 mL in fill volume gives a standard error of 4.0/√1,000,000 = 0.004 mL and z = 5. That is wildly significant, and fully irrelevant. With n = 8, a difference that would change how patients are treated may fail to reach significance. Report the estimate and its confidence interval alongside the p-value. Judge importance on the scale of the actual measurement, such as minutes, milliliters or percentage points, not on the scale of the p-value.
- Random sampling is the unforgiving assumption, since no sample size repairs bias.
- Independence holds if you sample at random and n is under 10% of the population. Clustering breaks it.
- Normality applies to the sampling distribution of x̄, and the CLT gives it as n grows.
- Hypotheses must be fixed before the data are seen, and significance is not the same as importance.
The chapter in one breath
- Every hypothesis test is the same five steps: hypotheses, level and conditions, test statistic, p-value and a conclusion in context.
- A test statistic always answers one question: how many standard errors is the estimate from the claim?
- Use the z-test for a mean, z = (x̄ − μ0)∕(σ∕√n), only when σ is truly known.
- Use the t-test, t = (x̄ − μ0)∕(s∕√n) with df = n − 1, when σ is estimated. It has heavier tails and larger critical values.
- Use the one-proportion z-test, z = (p̂ − p0)∕√(p0(1 − p0)∕n). The test uses p0 in the SE, and the interval uses p̂.
- A p-value is the probability of data this extreme given that the null is true, never the probability that the null is true.
- We fail to reject instead of accepting. “Not significant” may only mean the sample was too small.
- Every test assumes randomness, independence and close enough to normal, and randomness is the one nothing can repair.
ReferenceWords worth knowing
A quick reference for the words in this chapter. Skim it now, and come back to it whenever a term in a results section stops making sense.
- Alpha (α), significance level
- The cutoff chosen ahead of time for how much evidence is needed to reject H0. It is also the long run rate of Type I errors. It is most often 0.05, but that is a habit, not a law.
- Alternative hypothesis (Ha)
- The statement the researcher is looking for evidence of, written with ≠, > or <. It is chosen from the research question, never from the data seen.
- Central limit theorem
- The result that the sampling distribution of x̄ comes closer and closer to a normal distribution as n grows, whatever the shape of the population.
- Critical value
- The cutoff (z* or t*) that marks the edge of the rejection region for a chosen α and alternative.
- Degrees of freedom (df)
- The number of independent pieces of information left for estimating variability. It is n − 1 for a one sample t-test, because x̄ used up one.
- Effect size
- A measure of how big a difference is, on the scale of the data or standardized. It is the question a p-value does not answer.
- Null hypothesis (H0)
- The “no effect, no difference” statement that holds the equality. It is the assumption under which the p-value is worked out.
- One-proportion z-test
- The test of H0: p = p0 using z = (p̂ − p0) ∕ √(p0(1 − p0)∕n).
- One-tailed (one-sided) test
- A test whose alternative points in a single direction, which puts the whole rejection region in one tail. It must be named before data collection.
- p-value
- The probability, assuming H0 is true, of getting a test statistic at least as extreme as the one seen.
- Power
- 1 − β: the probability of correctly rejecting a false null. It rises with a larger n, larger true effects, less variability and a larger α.
- Rejection region
- The set of test statistic values, in the tail or tails, that lead to rejecting H0 at the chosen α.
- Robustness
- A method's ability to work well enough when its assumptions are broken a little. The t-test is robust to data that are a bit off normal, but not to outliers in small samples.
- Sample proportion (p̂)
- The count of successes divided by the sample size, x∕n. It is the point estimate of the population proportion p.
- Standard error
- The standard deviation of a sampling distribution: σ∕√n for a mean with σ known, and s∕√n when it is estimated.
- Statistically significant
- Describes a result whose p-value falls below α. It means “unlikely to be noise alone,” not “large” or “important.”
- Student's t distribution
- A symmetric, bell shaped family of distributions labeled by degrees of freedom, with heavier tails than the normal. It comes closer and closer to the standard normal as df grows.
- Test statistic
- A standardized measure of how far the sample estimate lies from the null value, in standard errors. Here it is z or t.
- Two-tailed (two-sided) test
- A test whose alternative is ≠. It splits the rejection region between both tails and doubles the one tail probability to get the p-value.
- Type I error
- Rejecting a null hypothesis that is actually true: a false alarm. Its long run rate is α.
- Type II error
- Failing to reject a null hypothesis that is actually false: a miss. Its rate is β.
- z-test
- A test whose statistic is compared with the standard normal distribution. For a mean, it needs σ to be known.