Sub topic 9
Comparing One Sample with a Target
What this test answers
In the Analyze phase, you often need to compare a process output with a requirement or benchmark. A one-sample test answers this question:
> Is the observed sample mean different from a stated target, or could the difference be explained by sampling variation?
This chapter assumes you understand the DMAIC cycle, sample versus population, mean, standard deviation, histograms, and box plots.
Suppose a filling process should produce bottles with a mean volume of 500 ml. You collect a sample of bottles and calculate a mean of 503 ml. A one-sample hypothesis test helps decide whether the process average has shifted from 500 ml.
Set up the hypotheses
Let μ represent the true process mean. The null hypothesis, written H₀, describes the default position:
H₀: μ = 500 ml
The alternative hypothesis, written H₁, describes the change you want to detect:
- Two-sided:
H₁: μ ≠ 500 ml - Greater than:
H₁: μ > 500 ml - Less than:
H₁: μ < 500 ml
Use a two-sided alternative when either direction matters. Use a one-sided alternative only when the project question and decision process justify looking in one direction.
The usual test is a one-sample t-test. It compares the sample mean with the target while accounting for sample size and sample variation.
Check the conditions
Before using the test, check these conditions:
- The observations should be independent.
- The sample should represent the process or time period you are studying.
- The output should be continuous, such as length, weight, or cycle time.
- The data should be approximately normal, especially when the sample is small.
- Extreme outliers should be investigated rather than ignored.
The t-test is often reasonably tolerant of mild non-normality when the sample is large and does not contain severe outliers. If normality is a serious concern, consider a Wilcoxon signed-rank test or transform the data. Also report the process reason for your choice.
Run and interpret the test
import numpy as np
from scipy import stats
sample = np.array([503, 501, 504, 502, 505, 500, 503, 504, 502, 506])
target = 500
alpha = 0.05
result = stats.ttest_1samp(sample, popmean=target)
confidence_interval = stats.t.interval(
confidence=0.95,
df=len(sample) - 1,
loc=sample.mean(),
scale=stats.sem(sample),
)
print("Sample mean:", sample.mean())
print("t statistic:", result.statistic)
print("p-value:", result.pvalue)
print("95% confidence interval:", confidence_interval)
if result.pvalue < alpha:
print("Reject H0: evidence of a difference from the target.")
else:
print("Fail to reject H0: insufficient evidence of a difference.")Choose a significance level, called α, before examining the result. A common choice is 0.05. If the p-value is below α, reject H₀. Otherwise, fail to reject H₀.
Failing to reject the null does not prove that the process mean equals the target. It means the sample does not provide strong enough evidence of a difference.
Report the result in business terms
Do not report only the p-value. Include the sample mean, target, confidence interval, sample size, and practical impact. A statistically significant difference of 0.2 seconds may not matter if the process requirement allows a much wider range. Conversely, a non-significant difference may still deserve attention when the cost of being off target is high.
Exercise
A process has a target mean of 10 minutes. A sample mean is 10.4 minutes, with a p-value of 0.03 at alpha = 0.05. What is the statistical conclusion?
Show answer
Reject the null hypothesis. The sample provides evidence that the process mean differs from 10 minutes. Check the confidence interval and business impact before deciding what action to take.