Testing a Fill-Volume Target
A quality-control team needs to know whether a filling process is centered on the volume printed on its containers. A sample will vary from bottle to bottle, even when the process is correctly centered. The question is whether the observed sample mean is far enough from the target, relative to that variation, to provide evidence that the process mean differs from the target.
When the population standard deviation is unknown and the question concerns one population mean, a one-sample t test compares the sample mean with the target using the sample standard deviation. Because the question is whether the mean differs in either direction, the test is two-sided.
The denominator, \(s/\sqrt{n}\), is the estimated standard error of the sample mean. The statistic measures the sample mean’s distance from the target in estimated standard-error units. A large positive or negative value is evidence against the null hypothesis in a two-sided test.
Assumptions Before Calculating
A t test is not justified simply because a formula can be evaluated. The observations should be a random or otherwise representative sample from the process of interest, and they should be independent. For example, measurements taken from separate filling events should not be treated as independent if the sampling scheme creates strong dependence, such as repeatedly measuring the same container.
The population distribution of fill volumes should be approximately normal when the sample is small, or the sample should be large enough for the sampling distribution of \(\bar{x}\) to be reasonably close to normal. For a small sample, inspect the data for strong skewness and outliers. The t procedure is generally robust to modest departures from normality, but that does not make severe skewness or influential outliers harmless.
In a quality-control setting, the sample should also represent the process and time period the conclusion is intended to describe. A process that changes during sampling may not have a single stable mean that the test meaningfully assesses. These considerations are part of the study design and data assessment, not calculations that can be repaired after the fact.
Worked Example: Testing a 500 mL Label Target
Hypothetical data: A team randomly selects 20 containers from a stable filling process. The label target is 500 mL. The observed volumes are approximately symmetric with no extreme outliers. The deviations from the sample mean are one observation at each of \(-8\) and \(+8\) mL, one at each of \(-7\) and \(+7\) mL, and likewise one at each of \(-6,-5,-3,-2,-1,+1,+2,+3,+5,+6\) mL. There are three observations at each of \(-4\) and \(+4\) mL. The sample mean is 502.5 mL. Test at \(\alpha=0.05\) whether the population mean differs from 500 mL.
Check the conditions. The 20 containers were randomly selected, and the separate filling events are treated as independent. The sample’s distribution is roughly symmetric, with no extreme outliers, so there is no obvious small-sample shape problem. The team’s conclusion will apply to the process represented by this sample, assuming it remained stable during sampling.
State the hypotheses. Let \(\mu\) be the process’s mean fill volume, in milliliters. Because the question asks whether the mean differs from the target in either direction, \(H_0:\mu=500\text{ mL}\) and \(H_a:\mu\ne500\text{ mL}\).
Calculate the sample standard deviation. The deviations from the sample mean sum to zero. Their sum of squared deviations is \(2(8^2)+2(7^2)+2(6^2)+2(5^2)+6(4^2)+2(3^2)+2(2^2)+2(1^2)=472\text{ mL}^2\). The \(6(4^2)\) term accounts for the six observations whose deviations have magnitude 4 mL. Thus,
Calculate the standard error and test statistic. Substituting \(\bar{x}=502.5\text{ mL}\), \(\mu_0=500\text{ mL}\), \(s\approx4.984\text{ mL}\), and \(n=20\) gives
The degrees of freedom are \(df=20-1=19\). For a two-sided test, the p-value is \(P(|T|\ge 2.243)\) when \(T\) follows a t distribution with 19 degrees of freedom. Using a t calculator gives \(p\approx0.037\).
Make the decision and interpret it. Since \(0.037<0.05\), reject \(H_0\) at the 5% significance level. These sample data provide statistically significant evidence that the mean fill volume for the process differs from 500 mL. The observed sample mean is above the target, but the test’s alternative was two-sided; the result is evidence of a difference, not proof that the population mean is exactly 502.5 mL.
Why the t Statistic Has This Form
The statistic expresses the difference between the observed mean and the null value relative to the amount of sampling variation expected under the null. Its t reference distribution accounts for the fact that the population standard deviation \(\sigma\) is unknown and must be estimated by \(s\).
A short justification explains why the degrees of freedom are \(n-1\). If the observations are independent draws from a normal population with mean \(\mu\) and standard deviation \(\sigma\), then under \(H_0\), the standardized sample mean \(Z=(\bar{x}-\mu_0)/(\sigma/\sqrt{n})\) has a standard normal distribution. For such a sample, \((n-1)s^2/\sigma^2\) has a chi-square distribution with \(n-1\) degrees of freedom and is independent of \(Z\). Therefore,
has a t distribution with \(n-1\) degrees of freedom. The subtraction of one degree of freedom reflects that the deviations are calculated from \(\bar{x}\), which is itself estimated from the sample. For nonnormal populations, the exact t-distribution result need not hold; the conditions and robustness considerations above guide whether the approximation is adequate.
Two More Target-Mean Decisions
Worked Example: A Sample Mean Close to the Target
Hypothetical data: A team independently samples 16 containers from a stable process targeting 250 mL. The observations are approximately symmetric without outliers, with \(\bar{x}=251.2\text{ mL}\) and \(s=3.2\text{ mL}\). Test \(H_0:\mu=250\text{ mL}\) against \(H_a:\mu\ne250\text{ mL}\) at \(\alpha=0.05\).
The random, independent sample and the lack of strong skewness or outliers support the procedure. The standard error is \(3.2/\sqrt{16}=0.8\text{ mL}\), so
The two-sided p-value is approximately \(0.154\). Since \(0.154>0.05\), do not reject \(H_0\). The sample does not provide sufficient evidence at the 5% level that the process mean differs from 250 mL. This is not proof that the mean equals 250 mL; the data may simply be too imprecise to detect a difference.
Worked Example: A Difference in Milligrams
Hypothetical data: A laboratory checks a dispensing process with a target mean of 1000 mg. A random sample of 25 independent dispenses has \(\bar{x}=1003.0\text{ mg}\) and \(s=5.0\text{ mg}\). The sample has no severe skewness or outliers. At the 5% level, test whether the process mean differs from 1000 mg.
The hypotheses are \(H_0:\mu=1000\text{ mg}\) and \(H_a:\mu\ne1000\text{ mg}\). The sample standard error is \(5.0/\sqrt{25}=1.0\text{ mg}\). Thus,
The two-sided p-value is approximately \(0.0062\). Since \(0.0062<0.05\), reject \(H_0\). The data provide evidence that the mean amount dispensed differs from 1000 mg; the sample mean is 3.0 mg above the target. This conclusion concerns the process mean and does not imply that every dispense is above target.
Interpreting the Result Carefully
The p-value is calculated assuming the null hypothesis and the model conditions are true. It is the probability of obtaining a t statistic at least as extreme as the observed one, in either direction for this two-sided test. It is not the probability that \(H_0\) is true, nor is it the probability that the observed difference occurred “by chance” without specifying a model.
A small p-value indicates that the observed sample mean would be unusual under the null model. It does not measure the practical importance of the difference. In quality control, a statistically detectable departure from a target may be operationally minor, while a nonsignificant result may still leave meaningful departures plausible. Consider the size of the estimated difference, the measurement units, process requirements, and the uncertainty of the estimate along with the test result.
A complete report identifies the target, the direction of the alternative, the test statistic, degrees of freedom, p-value, and conclusion in context. For example: “For the hypothetical 20-container sample, a two-sided one-sample t test found evidence that the mean fill volume differs from 500 mL, \(t(19)=2.24\), \(p=0.037\). The observed mean was 502.5 mL.” Reporting the sample mean and units helps readers understand the direction and scale of the observed difference.
Check Your Understanding
Use the ideas in this tutorial to answer the following questions.
- A process targets 750 mL. Write the null and two-sided alternative hypotheses using \(\mu\).
- A sample has \(n=12\), \(\bar{x}=48.6\) g, and \(s=2.4\) g. What are the standard error and degrees of freedom for a one-sample t test?
- Why does a one-sample t test use \(n-1\) degrees of freedom?
- A test gives \(p=0.08\) at \(\alpha=0.05\). What is the appropriate conclusion, and what stronger conclusion should be avoided?
- Name two data features that should be checked before relying on a t test with a small sample.