Sub topic 3
Type I error, Type II error, alpha, and power
This chapter assumes you can write a null and alternative hypothesis, which the previous chapter covered. It also assumes you know what a sampling distribution is, at least roughly. Here you will learn the two ways a hypothesis test can be wrong, how alpha and power control them, and why a Six Sigma team sets both before collecting data.
Why a test can be wrong
A hypothesis test works from a sample, and a sample is a partial view of the process. Two samples from the same process will differ by chance. A test therefore cannot guarantee the right answer. It can only control how often it gives a wrong one.
Reality has two possible states: the null hypothesis (H0) is true, or it is false. The test has two possible outputs: reject H0, or fail to reject H0. That gives four outcomes.
| Row | H0 is true (no real effect) | H0 is false (real effect) |
|---|---|---|
| Reject H0 | Type I error (false alarm), probability alpha | Correct decision, probability power (1 - beta) |
| Fail to reject H0 | Correct decision, probability 1 - alpha | Type II error (missed effect), probability beta |
Two of the four cells are errors, and they are different mistakes:
- A Type I error means you reject H0 when it is true. In a project, you conclude that a new supplier changed the mean, but it did not. The team then spends effort on a change that does nothing.
- A Type II error means you fail to reject H0 when it is false. The new supplier really did shift the mean, but your sample was too small or too noisy to show it. The team then drops a real root cause.
Alpha: the Type I error rate you choose
Alpha (the significance level) is the probability of a Type I error that you accept when H0 is true. You choose it before looking at the data. The usual choice is 0.05. That means that if the process really has no effect, about 1 test in 20 will still reject H0.
Alpha is a property of the testing procedure over many repetitions. It is not a statement about any single result. A study with alpha = 0.05 can still be a false alarm, and you cannot tell from the data alone which studies those are.
Beta and power: the Type II side
Beta is the probability of a Type II error. Power is 1 - beta, the probability that the test rejects H0 when a real effect of a given size exists. A common target is power = 0.80, which accepts a 20% chance of missing the effect.
Power is not one number for a test. It depends on a specific effect size, so the question is always "power to detect what?" A test with 80% power to detect a 2-unit shift may have only 30% power to detect a 0.5-unit shift.
Four quantities determine power for a given test. If you know any three of the first four below, the fourth is fixed:
- Alpha. A larger alpha raises power but also raises false alarms.
- Sample size (n). More data raises power.
- Effect size. A larger true difference is easier to detect.
- Variation (sigma). Less noise raises power.
The final quantity is power itself, and the planning step later in this tutorial solves for n.
The trade-off between the two errors
For a fixed sample size, lowering alpha raises beta. Making the test stricter about false alarms makes it more likely to miss real effects. The only way to lower both at once is to get more data or reduce variation.
Seeing both errors in a simulation
Simulation makes these rates concrete. The code below runs many Welch t-tests under two conditions. First there is no true difference, so every rejection is a Type I error. Then there is a true shift of 1.5 units with a standard deviation of 2, so the rejection rate estimates power.
import numpy as np
from scipy import stats
rng = np.random.default_rng(1)
alpha = 0.05
n = 30
trials = 5000
def reject_rate(true_shift):
rejections = 0
for _ in range(trials):
a = rng.normal(50, 2, n)
b = rng.normal(50 + true_shift, 2, n)
if stats.ttest_ind(a, b, equal_var=False).pvalue < alpha:
rejections += 1
return rejections / trials
print("Type I error rate (no true shift):", reject_rate(0.0))
print("Power (true shift = 1.5):", reject_rate(1.5))The first number comes out close to 0.05, because alpha is the false-alarm rate by construction. The second comes out around 0.8. The exact values change slightly with the random seed. In this setup roughly 1 in 5 real shifts of that size would still be missed.
Computing power directly
You do not need a simulation for standard tests. The statsmodels library computes power from the formula. The effect size here is Cohen's d, the difference in means divided by the standard deviation.
from statsmodels.stats.power import TTestIndPower
power = TTestIndPower().power(
effect_size=0.5, nobs1=30, alpha=0.05, ratio=1.0, alternative="two-sided"
)
print(power)With 30 per group and a medium effect (d = 0.5), power is only about 0.48. The test would miss a real medium-sized shift more often than it found it. The sample size chapter returns to this and shows that about 64 per group are needed for 80% power.
Choosing alpha and power for a project
The default of alpha = 0.05 and power = 0.80 is a convention, not a law. Choose them by the cost of each error.
- If a false alarm is expensive, use a smaller alpha such as 0.01. An example is a change that needs a costly tooling purchase or a revalidation of a regulated process.
- If a missed effect is expensive, aim for higher power such as 0.90 or 0.95. An example is a safety-critical defect cause, where overlooking it is worse than investigating a false lead.
- During early screening in Analyze, a team may accept a larger alpha such as 0.10 to avoid discarding candidate Xs. Confirming experiments in Improve then use stricter settings.
Whatever you pick, record it in the project charter or analysis plan before data collection. Choosing alpha after seeing the p-value invites bias, because you can always find a threshold that produces the answer you hoped for.
Common mistakes
- Reading alpha as the chance that your conclusion is wrong. Alpha is the false-alarm rate when H0 is true. It does not give the probability that a particular rejection is false. That also depends on how often real effects occur among the things you test.
- Computing "observed power" after the study. Power calculated from the observed p-value and effect adds no information beyond the p-value. Do power analysis before data collection, using an effect size that matters to the business.
- Treating the 0.05 line as a cliff. A p-value of 0.049 and one of 0.051 carry nearly the same evidence. The decision rule is a convenience for acting, not a change in the facts.
- Ignoring variation. Teams often add data when they could reduce measurement noise, for example by fixing the gauge. Lower sigma raises power as surely as a larger n does.
Exercise
A team tests whether a new fixture reduces mean cycle time. They use alpha = 0.05 and have 80% power to detect a 3-second reduction. The test gives p = 0.20. A manager says, "So the fixture does nothing." Explain what is wrong with this conclusion. Then name two ways the team could lower the Type II error rate without changing alpha.
Show answer
With p = 0.20 above alpha, the team fails to reject H0. That is not proof of no effect. It means the data did not show a difference. The test had 80% power only for a 3-second reduction, so a smaller real reduction, such as 1 second, could easily go undetected (a Type II error). The team should report a confidence interval for the difference and state which effect sizes the test could and could not detect. To lower the Type II error rate at the same alpha, they could increase the sample size, or reduce variation, for example by improving the measurement system or controlling other sources of cycle-time variation.
Exercise
A process owner wants to cut the false-alarm rate from alpha = 0.05 to alpha = 0.01 but keep the same sample size. What happens to power, and what would you tell the owner?
Show answer
Power falls, because beta rises when alpha is lowered at a fixed sample size. The test becomes stricter and so misses more real effects. Tell the owner that fewer false alarms cost more missed improvements. If both rates must stay low, the team must collect more data or reduce variation. The alpha choice should reflect whether a false alarm or a missed effect is more costly for this decision.