One-sample t-test, step by step

By Jude Wallis · Updated

A one-sample t-test has four steps. State hypotheses about the population mean $\mu$, check the random, 10%, and sample data conditions, compute $t = (\bar{x} - \mu_0)/(s/\sqrt{n})$ with $df = n - 1$, then turn $t$ into a p-value and write a conclusion in context.

AP Statistics: Unit 4 (topics 4.4 Setting Up a Test for a Population Mean or Population Mean Difference, 4.5 Carrying Out a Test for a Population Mean or Population Mean Difference). The one-sample t-test sits in Unit 4 of the Fall 2026 AP Statistics course, where topic 4.4 covers the hypotheses and the three conditions and topic 4.5 gives the statistic with degrees of freedom n - 1.

The four steps, in order

A one-sample t-test asks one question: is the population mean different from some claimed value? Four steps answer it, and every graded response follows the same order.

  1. State the parameter and the hypotheses about μ\mu (mu, the population mean).
  2. Check three conditions: random, 10%, and sample data.
  3. Compute the test statistic t=xˉμ0s/nt = \frac{\bar{x} - \mu_0}{s/\sqrt{n}} with df=n1df = n - 1.
  4. Conclude by comparing the p-value to α\alpha (alpha, the significance level) and answering in the context of the problem.

One example runs through all four steps. A seed supplier states that each packet holds a mean of 50 seeds. A gardener opens a random sample of n=25n = 25 packets from a shipment of several thousand and counts xˉ=52.3\bar{x} = 52.3 seeds (x-bar, the sample mean) with sample standard deviation s=6.1s = 6.1 seeds. A dotplot of the 25 counts shows no strong skewness and no outliers. Does the true mean differ from 50 seeds?

By the end you will have SE=1.22SE = 1.22, t=1.885t = 1.885, df=24df = 24, and p=0.0716p = 0.0716, and you will fail to reject the supplier's claim at α=0.05\alpha = 0.05.

Step 1: state the parameter and the hypotheses about mu

Define the parameter in words before you write symbols: let μ\mu be the true mean number of seeds per packet in the shipment. Naming the population out loud stops you from writing hypotheses about the sample, the most common way this step goes wrong.

The null hypothesis always sets μ\mu equal to the claimed value, written μ0\mu_0 (mu-nought, the hypothesized mean). The alternative says what you suspect instead:

H0:μ=50Ha:μ50H_0: \mu = 50 \qquad H_a: \mu \neq 50

This alternative is two-sided because the question asks whether the mean differs from 50, with no direction named in advance. Had the gardener suspected short-filled packets beforehand, the alternative would be Ha:μ<50H_a: \mu < 50 and the p-value would use one tail.

Hypotheses are statements about parameters, never about statistics. Writing H0:xˉ=50H_0: \bar{x} = 50 is wrong, because xˉ\bar{x} is a number you already measured and there is nothing left to test about it.

Step 2: check the three conditions

The t procedure needs three conditions, and you get credit only when you tie each one to the numbers in the problem rather than reciting the list.

Random. The data must come from a random sample or a randomized experiment. Here the 25 packets were randomly selected from the shipment, so this is met. Without randomness the sampling distribution of xˉ\bar{x} is not centered where the theory assumes, and no later arithmetic repairs that.

10%. When you sample without replacement, the population must be at least 10 times the sample size, so removing one packet barely changes the chances for the next. The shipment holds several thousand packets and 10×25=25010 \times 25 = 250, so this is met.

Sample data. Either the population is stated to be approximately normal, or n30n \ge 30, or, for n<30n < 30, the sample data show no strong skewness and no outliers. Here n=25n = 25 is below 30, so you lean on the third route: the dotplot of the 25 counts shows no strong skewness and no outliers, so the t procedure is reasonable.

That third condition is where the reasoning lives. The t procedure assumes the sampling distribution of xˉ\bar{x} is close to normal. A large sample delivers that through the central limit theorem whatever the population looks like; a small sample does not, so you inspect the data instead.

Step 3: compute the t statistic and the degrees of freedom

The test statistic measures how many standard errors the sample mean sits from the hypothesized mean:

t=xˉμ0s/n,df=n1t = \frac{\bar{x} - \mu_0}{s/\sqrt{n}}, \qquad df = n - 1

Build the standard error first, since that denominator is where most slips happen:

SE=sn=6.125=6.15=1.22SE = \frac{s}{\sqrt{n}} = \frac{6.1}{\sqrt{25}} = \frac{6.1}{5} = 1.22

Then the numerator is the plain distance between the two means, 52.350=2.352.3 - 50 = 2.3 seeds, and the statistic is that distance measured in standard errors:

t=2.31.22=1.885t = \frac{2.3}{1.22} = 1.885

The degrees of freedom are df=n1=251=24df = n - 1 = 25 - 1 = 24. You subtract 1 because ss was computed using xˉ\bar{x}, which pins down one of the 25 deviations once you know the other 24. That is the same n1n - 1 from the formula for ss, explained in why you divide by n - 1 and what degrees of freedom are.

Read the statistic in words before moving on. A value of t=1.885t = 1.885 says the sample mean of 52.3 seeds sits about 1.9 standard errors above the claimed 50: noticeably high, but not startling.

Why the statistic uses t and not z

The parallel z statistic would be (xˉμ0)/(σ/n)(\bar{x} - \mu_0)/(\sigma/\sqrt{n}), using σ\sigma (sigma, the population standard deviation). You cannot compute it, because σ\sigma is unknown. If you knew the spread of every packet in the shipment, you would have far less reason to be sampling packets in the first place.

So you estimate σ\sigma with s=6.1s = 6.1 seeds, computed from the same 25 packets that gave you xˉ\bar{x}. That puts an estimate in the denominator, and an estimated denominator wobbles from sample to sample the way a fixed σ\sigma never would, so the statistic lands in the far tails more often than a z-score does.

The t distribution is the exact correction when the population is normal, and a good one otherwise. It is symmetric and centered at 0 like the standard normal curve, but with heavier tails, and how heavy they are depends on dfdf. At df=24df = 24 the two-sided 0.05 critical value is t=2.064t^* = 2.064 (t-star) rather than the normal curve's z=1.960z^* = 1.960 (z-star). Using z here would shrink your p-value below its true value and overstate your evidence.

As nn grows the tails thin and t closes in on z, but never quite arrives, so t stays correct for a mean at any sample size. See t-test vs z-test.

Step 4: find the p-value

The p-value is the probability of getting a test statistic at least as extreme as yours, in the direction of HaH_a, assuming H0H_0 is true. The alternative here is two-sided, so both tails count:

p=2×P(T24>1.885)=2×0.0358=0.0716p = 2 \times P(T_{24} > 1.885) = 2 \times 0.0358 = 0.0716

Technology gives this directly. On a TI-84, `T-Test` with μ0=50\mu_0 = 50, xˉ=52.3\bar{x} = 52.3, sx=6.1s_x = 6.1, n=25n = 25, and the μ0\neq \mu_0 alternative returns t=1.885t = 1.885 and p=0.0716p = 0.0716, and the one-sample t-test calculator returns the same pair.

A t-table gives bounds instead, which is enough to decide. In row df=24df = 24 the upper-tail 0.05 entry is 1.711 and the 0.025 entry is 2.064. Your t=1.885t = 1.885 falls between them, so the one-tail area is between 0.025 and 0.05, and doubling gives 0.05<p<0.100.05 < p < 0.10. That bracket contains 0.0716.

Doubling works only because the t distribution is symmetric and the alternative is two-sided. For a one-sided alternative you report a single tail.

Step 4 continued: write the conclusion in context

Compare the p-value to α\alpha, then say what that means about seeds, not about symbols. Every conclusion needs three pieces: the comparison, the decision, and the context.

Since p=0.0716>α=0.05p = 0.0716 > \alpha = 0.05, you fail to reject H0H_0. You do not have convincing evidence that the true mean number of seeds per packet differs from 50.

Three phrases matter there. Fail to reject, not accept: the test never confirms H0H_0, it only reports that the data are consistent with it. Convincing evidence, not proof. And true mean number of seeds per packet, the context the question asked about.

Notice how close this call is. At α=0.10\alpha = 0.10 the same data would lead you to reject. A p-value of 0.0716 is not a verdict of no effect; it says a sample mean this far from 50 would happen about 7 times in 100 by chance alone if the claim were true. See what a p-value means.

A confidence interval tells the same story from the other side. The 95% interval is 52.3±2.064×1.22=52.3±2.51852.3 \pm 2.064 \times 1.22 = 52.3 \pm 2.518, or (49.78,54.82)(49.78, 54.82) seeds. It contains 50, matching the decision to fail to reject at α=0.05\alpha = 0.05.

What loses points on this question

  • Writing hypotheses about xˉ\bar{x} instead of μ\mu. The sample mean is already known, so there is nothing to hypothesize about it.
  • Listing the three conditions without linking them to the problem. Say which sample was random, do the 10×n10 \times n comparison, and name what the plot of the data shows.
  • Dividing by nn instead of n\sqrt{n} in the standard error. Here that would give 6.1/25=0.2446.1/25 = 0.244 and a badly inflated tt of 9.43.
  • Using df=ndf = n. With n=25n = 25 the degrees of freedom are 24, and df=25df = 25 would shrink the p-value below the truth.
  • Reporting a one-tail area for a two-sided alternative. That gives 0.0358 here, which sits below 0.05 and flips the decision.
  • Saying you accept H0H_0, or that the mean equals 50. Failing to reject means the data do not rule out 50.
  • Skipping the context. A conclusion that stops at "fail to reject" without mentioning seeds per packet is incomplete.

Work the same four steps on fresh numbers in t-test practice.

The seed packet test, all four steps

A seed supplier states that each packet holds a mean of 50 seeds. A gardener opens a random sample of n=25n = 25 packets from a shipment of several thousand and finds xˉ=52.3\bar{x} = 52.3 seeds and s=6.1s = 6.1 seeds. A dotplot of the 25 counts shows no strong skewness and no outliers. Test at α=0.05\alpha = 0.05 whether the true mean differs from 50 seeds.

  1. State: let μ\mu be the true mean number of seeds per packet in the shipment. H0:μ=50H_0: \mu = 50 against Ha:μ50H_a: \mu \neq 50, tested at α=0.05\alpha = 0.05.

  2. Check random: the 25 packets were randomly selected from the shipment.

  3. Check 10%: the shipment holds several thousand packets, which is more than 10×25=25010 \times 25 = 250.

  4. Check sample data: n=25<30n = 25 < 30, and the dotplot of the 25 counts shows no strong skewness and no outliers, so a one-sample t procedure applies.

  5. Standard error: SE=sn=6.125=6.15=1.22SE = \frac{s}{\sqrt{n}} = \frac{6.1}{\sqrt{25}} = \frac{6.1}{5} = 1.22 seeds.

  6. Numerator: xˉμ0=52.350=2.3\bar{x} - \mu_0 = 52.3 - 50 = 2.3 seeds.

  7. Test statistic: t=2.31.22=1.885t = \frac{2.3}{1.22} = 1.885.

  8. Degrees of freedom: df=n1=251=24df = n - 1 = 25 - 1 = 24.

  9. One-tail area from technology: P(T24>1.885)=0.0358P(T_{24} > 1.885) = 0.0358.

  10. Two-sided p-value: p=2×0.0358=0.0716p = 2 \times 0.0358 = 0.0716.

  11. Table check: in row 24, t=1.885t = 1.885 falls between the 0.05 entry 1.711 and the 0.025 entry 2.064, so the one-tail area is between 0.025 and 0.05 and 0.05<p<0.100.05 < p < 0.10, which contains 0.0716.

  12. Decide: p=0.0716>α=0.05p = 0.0716 > \alpha = 0.05, so fail to reject H0H_0.

SE=1.22SE = 1.22, t=1.885t = 1.885, df=24df = 24, and p=0.0716p = 0.0716. Since 0.0716>0.050.0716 > 0.05, fail to reject H0H_0. There is not convincing evidence that the true mean number of seeds per packet differs from 50. The matching 95% interval, 52.3±2.064×1.22=(49.78,54.82)52.3 \pm 2.064 \times 1.22 = (49.78, 54.82) seeds, contains 50 and agrees with that decision.

A one-sided version, where the p-value is not doubled

A cafe's automatic dispenser is set to pour a mean of 355 mL per cup. A manager suspects it is under-pouring and measures a random sample of n=16n = 16 cups from a morning's service, getting xˉ=351.5\bar{x} = 351.5 mL and s=7.0s = 7.0 mL. A boxplot of the 16 volumes shows no strong skewness and no outliers. Test at α=0.05\alpha = 0.05 whether the true mean pour for that morning's service is below 355 mL.

  1. State: let μ\mu be the true mean volume poured per cup across that morning's service. H0:μ=355H_0: \mu = 355 against Ha:μ<355H_a: \mu < 355, tested at α=0.05\alpha = 0.05. The direction was suspected before the data were collected, so a one-sided alternative is legitimate.

  2. Check random: the 16 cups were a random sample of the morning's pours. Check 10%: that morning's service produces far more than 10×16=16010 \times 16 = 160 cups, so the 16 sampled cups are less than 10% of the morning's pours. Check sample data: n=16<30n = 16 < 30, and the boxplot shows no strong skewness and no outliers.

  3. Standard error: SE=7.016=7.04=1.75SE = \frac{7.0}{\sqrt{16}} = \frac{7.0}{4} = 1.75 mL.

  4. Numerator: 351.5355=3.5351.5 - 355 = -3.5 mL.

  5. Test statistic: t=3.51.75=2.000t = \frac{-3.5}{1.75} = -2.000, with df=161=15df = 16 - 1 = 15.

  6. One-sided p-value: p=P(T15<2.000)=0.0320p = P(T_{15} < -2.000) = 0.0320. Do not double it, because only the low tail points in the direction of HaH_a.

  7. Table check: in row 15 the upper-tail 0.05 entry is 1.753 and the 0.025 entry is 2.131. Since 2.0002.000 lies between them, 0.025<p<0.050.025 < p < 0.05, which contains 0.0320.

  8. Decide: p=0.0320<α=0.05p = 0.0320 < \alpha = 0.05, so reject H0H_0.

SE=1.75SE = 1.75 mL, t=2.000t = -2.000, df=15df = 15, and p=0.0320p = 0.0320. Since 0.0320<0.050.0320 < 0.05, reject H0H_0. There is convincing evidence that the dispenser's true mean pour for that morning's service is below 355 mL. Doubling this p-value by mistake would give 0.0639 and reverse the decision, which is why the alternative's direction has to be settled before you read the tail.

Frequently asked questions

Do I use n or n - 1 for the degrees of freedom?

Use df=n1df = n - 1. With n=25n = 25 that is 24. The subtraction happens because ss is built from deviations around xˉ\bar{x}, and once you know xˉ\bar{x} and any 24 of the deviations, the 25th is forced. Using df=ndf = n thins the tails and reports a p-value slightly smaller than the true one.

When do I double the p-value?

Only when the alternative is two-sided, such as Ha:μ50H_a: \mu \neq 50. Then both tails count as extreme and you double the single-tail area. For Ha:μ>μ0H_a: \mu > \mu_0 or Ha:μ<μ0H_a: \mu < \mu_0 you report one tail and do not double. Choose the direction from the question before you look at the data, never after.

What if my sample is smaller than 30 and the data look skewed?

Then the sample data condition fails and the one-sample t procedure is not justified. Say so explicitly rather than running the test anyway. With n<30n < 30 you need the sample to show no strong skewness and no outliers, or a statement that the population is approximately normal.

Does a p-value of 0.0716 mean there is a 7.16% chance the supplier is right?

No. It means that if the true mean really were 50 seeds, samples of 25 packets would produce a mean at least 2.3 seeds away from 50 about 7.16% of the time. The probability is attached to the data given the null hypothesis, not to the hypothesis given the data.

Why does the 95% interval agree with the test?

Both use the same t curve at df=24df = 24 and the same standard error, so a two-sided test at α=0.05\alpha = 0.05 and a 95% interval always line up. The interval (49.78,54.82)(49.78, 54.82) contains 50, which is the same information as p=0.0716p = 0.0716 exceeding 0.05. Change either the confidence level or the alternative's direction and the correspondence can break.