Sub topic 2
Writing the null and alternative hypotheses
This chapter assumes you know the DMAIC cycle, basic descriptive statistics (mean, median, standard deviation), and the difference between a sample and a population. You will turn a plain-language process question into a pair of statements that a test can evaluate. Later chapters cover errors, p-values, and the choice of test.
Why the wording comes first
In the Analyze phase you have a Y (the output you want to improve) and a list of suspected Xs (inputs that may drive it). A hypothesis test asks whether the data support a claim about an X-Y relationship or about a Y against a target. The test can only answer the question you encoded. Vague wording produces a test that is technically valid and useless.
A project question like "Is the new fixture better?" is not testable yet. You must name:
- the Y, and how it is measured
- the parameter that summarizes it (mean, median, standard deviation, proportion)
- the groups or target being compared
- the direction of interest, if any
The two statements
A hypothesis test works with a pair of competing statements about a population parameter.
- The null hypothesis (H0) is the default position: no difference, no effect, no relationship. It always contains an equality (
=,≤, or≥). - The alternative hypothesis (H1 or Ha) is what you suspect and want evidence for. It never contains equality (
≠,<, or>).
The test starts by assuming H0 is true and asks whether the sample data would be surprising under that assumption. If they are, you reject H0 in favor of H1. If they are not, you fail to reject H0.
The wording "fail to reject" matters. Failing to reject H0 does not show that H0 is true. It means the data did not give enough evidence against it. With a small sample, a real difference can easily go undetected.
Hypotheses are statements about population parameters, written with Greek letters (μ for a mean, σ for a standard deviation, π or p for a proportion). They are never statements about sample statistics. Writing "H0: x̄ = 30" is an error, because the sample mean is known and needs no testing.
Common forms
| Question | Parameter | H0 | H1 |
|---|---|---|---|
| Does mean cycle time differ from the 30-minute target? | One mean vs target | μ = 30 | μ ≠ 30 |
| Is the new supplier's mean strength higher than the old? | Two means | μ_new = μ_old | μ_new > μ_old |
| Do three lines have the same mean fill weight? | Three or more means | μ_A = μ_B = μ_C | At least one mean differs |
| Is variation lower after the change? | Two standard deviations | σ_after = σ_before | σ_after < σ_before |
| Is defect rate different between shifts? | Two proportions | p_1 = p_2 | p_1 ≠ p_2 |
For a paired design, such as the same machines measured before and after a change, define the parameter as the mean of the differences: H0: μ_d = 0.
Note that the ANOVA alternative is not "all means differ." It is "at least one differs." Rejecting H0 there tells you that a difference exists, not where it is.
One-sided and two-sided alternatives
The direction of H1 decides whether the test is two-sided or one-sided.
- A two-sided alternative (
≠) looks for a difference in either direction. Use it when a change in either direction matters, or when you have no firm basis for a direction. - A one-sided alternative (
<or>) looks for a difference in one direction only. It has more power in that direction and none in the other.
Choose the direction before you see the data, from the business question. Picking a one-sided test after noticing which way the sample mean fell is a form of cheating. It halves the p-value and inflates your false-positive rate.
A reliable rule: if the team would act on a result in the opposite direction (for example, a "worse" result would trigger a rollback), use a two-sided test.
A worked example in code
A team wants to know whether mean ticket-handling time differs from a 30-minute target. The next code runs the same data through a two-sided and a one-sided test. The alternative argument of scipy.stats.ttest_1samp encodes H1. It requires SciPy 1.6 or later.
import numpy as np
from scipy import stats
rng = np.random.default_rng(11)
handling_time = rng.normal(loc=28.5, scale=4.0, size=40) # minutes
target = 30.0
print("Sample mean =", handling_time.mean())
# H0: mu = 30 vs H1: mu != 30
two_sided = stats.ttest_1samp(handling_time, popmean=target,
alternative="two-sided")
print("Two-sided p =", two_sided.pvalue)
# H0: mu >= 30 vs H1: mu < 30
less = stats.ttest_1samp(handling_time, popmean=target,
alternative="less")
print("One-sided (less) p =", less.pvalue)
# H0: mu <= 30 vs H1: mu > 30
greater = stats.ttest_1samp(handling_time, popmean=target,
alternative="greater")
print("One-sided (greater) p =", greater.pvalue)When the sample mean falls below the target, the "less" p-value is half the two-sided value. The "greater" p-value is close to 1, because the data point the opposite way. This shows how much the choice of H1 affects the result, and why you commit to it first.
Writing hypotheses step by step
- State the practical question. Example: "Did the new fixture reduce scrap?"
- Name the Y and its data type. Scrap rate per batch, continuous, or scrapped or not per unit, discrete.
- Choose the parameter. Mean scrap rate, or proportion scrapped.
- Identify the comparison. Before versus after, a target, or several groups.
- Write H0 as no difference. μbefore = μafter.
- Write H1 in the direction that matters. μbefore > μafter if only a reduction counts as success.
- Record the significance level (alpha). It is set now, before the data are analyzed. The next chapter explains what it means.
Frequent mistakes
- Putting the hoped-for result in H0. If you want to prove the new process is better, "better" belongs in H1. A test can only reject H0, so the claim you want supported must be the alternative.
- Using sample statistics in the hypotheses. Use population parameters.
- Writing H1 after seeing the data. The direction must come from the business question.
- Reading "fail to reject" as "equal." A small, noisy sample can fail to reject a large real difference.
- Testing an unmeasurable claim. "The process is stable" is not a parameter statement. Restate it, for example as H0: σA = σB.
- Mixing parameters. A claim about means cannot be tested with a test on proportions. The parameter in the hypotheses constrains which test applies.
Exercises
Exercise
A Green Belt writes "H0: x̄ = 12.4; H1: x̄ > 12.4" for a test of whether the mean wait time exceeds the 12.4-minute service standard. Name the problem with the notation and rewrite the hypotheses correctly.
Show answer
Hypotheses must describe the population parameter, not the sample mean x̄, which is already known. The correct form is H0: μ ≤ 12.4 and H1: μ > 12.4 (using H0: μ = 12.4 is also acceptable). The alternative is one-sided because only waits longer than the standard are of concern.
Exercise
Two shifts are compared on defect proportion. After seeing that shift 2 has the higher sample proportion, an analyst proposes H1: p2 > p1 because the p-value will be smaller. Explain why this is a problem and what to use instead.
Show answer
The direction was chosen after viewing the data, which inflates the false-positive rate because the one-sided p-value is half the two-sided one. Unless the business question was specifically about shift 2 being worse before the data were collected, use the two-sided alternative H1: p1 ≠ p2 and H0: p1 = p2.