Learn how a one-sample t-test checks whether a sample mean differs from a known value when the population standard deviation is unknown. For ten candy bars, the test has nine degrees of freedom—a small detail that helps make the inference fit the data.

Multiple Choice

A student weighs 10 candy bars; test whether the average weight differs from the expected value using a t-test. Which test is appropriate?

When you want to know if a sample mean differs from a known value, you use a one-sample t-test. Here you have a single sample of ten candy bars and you’re comparing the average weight to the expected mean, with the population standard deviation unknown. With n = 10, the degrees of freedom are n − 1, which is 9, so the test uses nine degrees of freedom. The test statistic is t = (x̄ − μ0) / (s/√n), reflecting how far the observed mean is from the expected mean in units of the standard error. If the population standard deviation were known, a Z-test would be used, but that’s rare in practice. It’s not a two-sample test since there aren’t two independent groups to compare, and it’s not a paired test because there’s no pairing of measurements. So the appropriate method is a one-sample t-test with nine degrees of freedom.

How to Choose the Right Inference Method

A box of candy bars seems like a simple place to start with statistics. Weigh ten bars, find their average, and compare it with the weight printed on the label. But the method you use matters: the bars are only a sample, and their weights won’t be identical. Statistical inference helps us decide whether the difference we see is meaningful or could reasonably be due to random variation.

For one sample of ten candy bars, compared with a known target weight, the usual method is a one-sample t-test. Because the population standard deviation is unknown, the test uses the sample standard deviation instead. With ten observations, it has nine degrees of freedom.

That choice becomes easier once you look at the basic structure of inference: what data you have, what you’re comparing, and what’s known about the population.

Start with the shape of the question

Inference methods help us draw conclusions about a larger group, or population, from a smaller set of observations. The method depends less on the topic—candy, plants, commute times—and more on how the data are arranged.

Begin with three questions:

  • Are you studying one group or comparing groups?

  • Are the measurements paired, or are they independent?

  • Is the population standard deviation known?

In the candy-bar example, there’s one sample: ten measured bars. Their average weight is compared with a single reference value, such as the expected mean weight. There isn’t a second group of bars, and no bar is matched with another measurement. That points to a one-sample method.

The distinction may sound small, but it changes the calculation. A two-sample method asks whether two group means differ. A paired method looks at differences within matched pairs. A one-sample method asks whether one group’s mean differs from a fixed value.

Why a one-sample t-test fits

Suppose the expected mean weight is represented by (\mu_0). The sample average is (\bar{x}), and the sample standard deviation is (s). The one-sample t statistic is:

[

t = \frac{\bar{x} - \mu_0}{s/\sqrt{n}}

]

The top of the fraction measures the gap between the observed average and the expected value. The bottom, called the standard error, estimates how much sample averages tend to vary from one sample to another.

Think of the standard error as a measure of uncertainty around the sample mean. A small gap may matter if the data are very consistent. The same gap may mean less if the bar weights vary widely. Statistics weighs those two facts together rather than judging the gap on its own.

The t statistic expresses the difference in standard-error units. If the sample mean sits far from the expected value relative to its uncertainty, the result provides stronger evidence that the population mean differs from the target. It doesn’t prove why the difference occurred, or guarantee that every bar is underweight or overweight. It speaks to the average.

Where nine degrees of freedom come from

For a one-sample t-test, the degrees of freedom are:

[

df = n - 1

]

With ten candy bars, that gives (10 - 1 = 9).

Why subtract one? The sample standard deviation is calculated using deviations from the sample mean. Once the mean is set, the deviations must add up to zero. If nine deviations are known, the tenth is constrained by the others. In a sense, one piece of freedom has been used to estimate the mean.

Degrees of freedom shape the t distribution, which is used to assess how surprising a result would be under a stated assumption about the population mean. With a small sample, the t distribution has heavier tails than the standard normal distribution. That reflects added uncertainty: estimating spread from ten observations is less precise than estimating it from hundreds.

As the sample grows, the t distribution approaches the normal distribution. The distinction doesn’t vanish as a concept, but it often becomes less pronounced in larger samples.

Why not a Z-test?

A Z-test is associated with situations where the population standard deviation, usually written as (\sigma), is known. In the candy-bar example, we typically don’t know the true spread of weights across all bars. We estimate it from the ten measured bars using (s), the sample standard deviation.

That substitution adds uncertainty, which is why the t distribution is used. If the true population standard deviation were known, a Z-based method could be appropriate for testing a mean. In many real settings, though, that exact population value isn’t available. A t-test is therefore a common choice for mean comparisons based on sample data.

There’s a useful way to remember the distinction: a Z procedure uses a known population spread, while a t procedure accounts for the fact that the spread had to be estimated. The names are easy to mix up, but the data structure and the information available usually point the way.

When two-sample and paired methods make sense

A two-sample t-test compares the means of two separate groups. Imagine weighing ten bars from one factory line and ten from another. If each bar belongs to only one group, and the observations are independent, a two-sample method may fit. The key feature is that the question concerns the difference between two group means, not a single mean against a fixed target.

A paired t-test is different. It’s used when measurements come in meaningful pairs. For example, a technician might weigh the same candy bar before and after a coating is added, or compare matched items produced under two conditions. The analysis focuses on the difference within each pair. Those paired differences form the data for a one-sample t procedure.

Pairing can reduce noise when the two observations in each pair share relevant features. But the pairs must make sense. Matching unrelated bars just to create pairs would be like comparing two people because they happen to be standing next to each other: the arrangement alone doesn’t make them a meaningful pair.

A few assumptions worth keeping in view

A one-sample t-test works best when the measurements are independent and the population is roughly normal, especially when the sample is small. Candy-bar weights often fall within a fairly narrow range, but that shouldn’t be taken for granted. A damaged package or a measurement error can create an unusual value that pulls the average around.

It’s sensible to look at the data before drawing a conclusion. A dot plot or histogram can show whether the weights cluster in a roughly balanced way or whether one value sits far from the rest. Measurement quality matters, too: a scale that hasn’t been checked can produce a neat-looking set of numbers that are all off target.

These checks don’t replace the method. They help establish whether its assumptions are reasonable. If the data are heavily skewed or contain extreme values, other approaches may be worth considering, depending on the question and the source of the unusual pattern.

Keep the method tied to the question

The most reliable way to choose an inference method is to describe the comparison in plain language first. Are you comparing one mean with a target? Two independent group means? Or the average change within matched pairs?

For ten candy bars compared with an expected mean, the structure is clear: one sample, one reference value, and an unknown population standard deviation. A one-sample t-test fits, and ten observations give it nine degrees of freedom.

That conclusion is specific, but the reasoning travels well. Start with the data structure. Check what is known about the population. Then choose a method that matches the comparison you actually want to make. Statistics can feel like a shelf full of similar-looking tools; the question itself is often the label that tells you which one to reach for.