Sub topic 5
Stratifying Data to Expose Differences
This chapter assumes you know basic Lean Six Sigma terms, including defect, process output \(Y\), input \(X\), and descriptive statistics. You should also be able to read a histogram or run chart. The goal here is to examine whether a suspected cause is linked to different process results.
What stratification does
Stratification means separating process data into meaningful groups before analyzing it. A stratification factor is the field used to create the groups, such as:
- Shift
- Machine
- Operator
- Supplier
- Product type
- Location
- Date or season
- Material batch
Suppose the suspected cause is an unstable machine. Instead of studying the overall defect rate, separate the records by machine. If one machine has a much higher defect rate, the data supports further investigation of that machine.
Stratification does not prove that the factor causes the result. It reveals differences that may be hidden when all records are combined.
Start with a clear comparison
Define the response before grouping the data. The response might be:
- A continuous measurement, such as cycle time in minutes
- A count, such as defects per order
- A binary result, such as defective or acceptable
Then define the groups and a fair comparison measure.
| Response type | Useful comparison | Example |
|---|---|---|
| Binary result | Defect rate | Defective units divided by total units |
| Continuous result | Mean, median, and spread | Average cycle time by machine |
| Count result | Rate or count per opportunity | Defects per 1,000 units |
Always show the number of records in each group. A group with two observations can have an extreme rate by chance and should not receive the same confidence as a group with 200 observations.
Walk through a stratification
Assume a team suspects that work shift affects defects. The data contains one row per unit, a shift label, and a defect flag where 1 means defective.
import pandas as pd
df = pd.DataFrame({
"shift": ["A", "A", "A", "B", "B", "B", "B", "A"],
"defect": [0, 1, 0, 1, 1, 0, 1, 0],
})
summary = (
df.groupby("shift")["defect"]
.agg(defect_rate="mean", units="count", defects="sum")
.reset_index()
)
summary["defect_rate_percent"] = summary["defect_rate"] * 100
print(summary)Because the defect flag contains only zero and one, its mean equals the proportion of defective units. Shift A has one defect among four units, or 25%. Shift B has three defects among four units, or 75%. This difference is worth investigating, but the sample is too small to establish a reliable shift effect.
Next, plot or compare the groups. Look for both the difference in center and the difference in spread. For continuous data, a boxplot can show whether one group has a higher median, more variation, or unusual values. For defect data, a bar chart of rates is often useful.
Avoid misleading strata
A useful stratification factor should be available before the outcome occurs or should describe a plausible process condition. Do not keep trying factors until one produces a dramatic difference. This creates a false pattern through repeated searching.
Check the data for these problems:
- Group labels are inconsistent, such as
Night,night, andN. - Some groups have very few observations.
- The observation period differs between groups.
- One group processes a different product mix.
- Records are duplicated or missing.
- The measurement system records groups differently.
Also check whether groups overlap with another factor. If all night-shift work uses one machine, a shift difference may actually be a machine difference. Record both factors so that later analysis can separate them.
Interpret the result carefully
A visible difference is evidence for a relationship, not proof of a root cause. Use stratification to answer: “Where and when does the outcome differ?” Then use an appropriate hypothesis test, additional variables, or a controlled trial to ask whether the suspected factor truly changes the process.
Exercise
A defect rate is 2% on Machine 1 and 6% on Machine 2. Machine 2 also makes a more difficult product. What should you do before concluding that Machine 2 causes more defects?
Show answer
Stratify or adjust the comparison by product type, verify the measurement and group counts, and then compare machines within the same product type.