Sub topic 3
Planning the data you need
This chapter covers the data collection plan for verifying a suspected root cause. It assumes you know basic Lean Six Sigma vocabulary (DMAIC, defect, output Y, input X), have used a fishbone diagram or 5 Whys, and can read means, medians, standard deviations, histograms and run charts. By the end you will be able to write a plan that a colleague could execute without asking you what you meant.
Why a plan comes before the data
You now have a hypothesis and a prediction about what the data should show if the cause is real. The next step is to decide which data would confirm or refute it. Many teams skip this step and export whatever the system already holds. That data was collected for another purpose. It often lacks the factor you suspect, has the wrong time span, or mixes conditions you need to separate.
A data collection plan links the question to the numbers. It fixes in advance what you measure, how, on which units, how many, and who does it. Fixing these choices before you see results also protects you from picking the subset of data that happens to agree with your suspicion.
The plan has to answer one question: what comparison will the data let me make? If the answer is "none", the data cannot verify the cause, however much of it you have.
The elements of a plan
A usable plan covers seven elements.
- The question. Restate the hypothesis in one sentence, for example "Shift B produces a higher defect rate than shift A."
- The Y measure. The process output you expect to change.
- The X measures. The suspected cause, plus any other factors you want to record so you can separate them later.
- Operational definitions. Exact wording for what counts as a defect, when a cycle starts and stops, and which units of what type are in scope.
- Sampling approach and size. Which units you collect, how you select them, and how many.
- Collection logistics. Who collects, from which system or instrument, at what moment, and in what format.
- Analysis intent. The chart and test you plan to use, chosen before collection.
A table is a convenient way to hold the plan.
| Element | Example entry |
|---|---|
| Question | Does shift B produce a higher defect rate than shift A? |
| Y measure | Defective or good, per unit, from final inspection |
| X measures | Shift (A or B), machine ID, operator ID, material lot |
| Operational definition | Defect means any unit failing the final inspection checklist, version 3 |
| Sampling | All units from both shifts over 4 weeks |
| Logistics | Inspector records result on the tablet form at the end of the line |
| Analysis intent | Defect rate by shift, then a chi-square test at alpha = 0.05 |
Choosing the type of data
The type of the Y measure decides which analysis you can run later, so decide it now.
- Continuous data are measured on a scale, such as cycle time in minutes or a diameter in millimetres. They carry more information per observation, so they usually need fewer units to detect a difference.
- Discrete count or attribute data are classifications or counts, such as defective or good, or the number of scratches per panel. They carry less information per observation, so they need larger samples.
If you can measure a quantity instead of only classifying it, prefer the quantity. A "pass or fail" on a width check discards how close each unit was to the limit. A recorded width keeps it. You can always convert a measurement to pass or fail afterwards, but you cannot go the other way.
The X also has a type. Shift is a category. Oven temperature is continuous. A categorical X leads to group comparisons (t-test, ANOVA, chi-square), and a continuous X leads to correlation and regression, both covered in later chapters.
Record the factors you will need to stratify by
Later chapters stratify the data, which means splitting it by a factor to compare groups. You can only stratify by factors you recorded. When you plan collection, list the "who, what, where, when" fields that could plausibly matter, and add them as columns even if you do not suspect them yet.
Typical fields are:
- Time stamp, shift, and day of week
- Machine, line, or cell
- Operator or team
- Material supplier and lot
- Product type or variant
- Measurement device and inspector
Recording these has two benefits. It lets you check whether another factor explains the pattern, which matters when you separate correlation from causation. It also lets you spot the case where your suspected factor changes together with another, such as shift B always running the older machine.
The cost of an extra field is small at collection time and large if you need it later and must re-collect.
Retrospective and prospective data
You have two sources, and each has its own risks.
| Source | What it is | Strength | Main risk |
|---|---|---|---|
| Retrospective | Existing records, such as MES, ERP, QA logs | Fast and cheap, large volume | Missing factors, inconsistent definitions, changes in the process over the period |
| Prospective | New data collected for this question | You control definitions, factors, and timing | Takes time, and people may behave differently when observed |
Use retrospective data to explore and to decide whether a prospective study is worth the effort. Prefer prospective data when the existing records lack the X you need, or when you will rely on the result for a costly decision. Whichever source you use, check the records for the problems covered in the next chapter before analysing them.
Sampling: which units, and how many
You rarely measure everything. The sample must represent the process conditions you want to draw conclusions about.
Common approaches:
- Collect everything in the period when records are cheap, as with automatic inspection results.
- Random sampling gives each unit an equal chance of selection, which avoids unintended bias.
- Stratified sampling takes a fixed number from each group, such as 100 units per shift. Use it when one group is rare and would otherwise be under-represented.
- Systematic sampling takes every n-th unit. It is easy to run on the floor, but it can line up with a cycle in the process, for example every 10th unit when a tool is changed every 10 units.
Three rules keep a sample honest:
- Do not choose units because they look typical or suspicious. Selection by judgement tends to confirm the suspicion.
- Cover the full range of normal conditions, including different days, operators and material lots, unless the question is limited to one condition.
- Compare like with like. If you compare two setups, collect data from both over the same period, not one this month and one last month.
For the number of units, a precise calculation comes later, in the chapter on sample size and power. For planning, remember that the amount you need depends on three things. A smaller difference needs more data. More variation in the process needs more data. Attribute data need more units than continuous data. As a rough sense of scale for defect rates, comparing 9% with 20% needs a few hundred units, while detecting 9% against 11% needs thousands.
Collection logistics
Many plans fail at this point, because the work depends on people doing extra tasks on a busy line.
- Assign an owner for each field and a person responsible for the whole data set.
- Use a simple form. A checklist or tablet screen with drop-down values prevents free-text variants such as "Shift B", "B shift" and "second".
- Record at the point of work. Writing values down at the end of the day invites memory errors.
- Pilot the form on a small number of units first. Confirm that people interpret the fields the same way.
- Keep a log of events during collection, such as a tool change, a power cut or a new material lot. These explain outliers later.
- Protect the process. Observing is not the same as changing. If collecting the data makes operators work differently, the data will not describe normal operation.
Planning the analysis before you collect
Decide the analysis now. Write down the chart you will draw, the test you will run, the significance level, and what result would lead you to reject the suspected cause. This prevents testing many slices of the data until one shows a p-value below 0.05 and then presenting that slice as the finding.
The diagram below shows how the plan connects the hypothesis to the analysis.
A short check of the plan in code
Before collecting, you can test the plan on the pilot data. The example below checks that the pilot form produced the planned columns, that categories use consistent labels, and that both groups have data.
import pandas as pd
# Pilot data from the first collection form
pilot = pd.DataFrame({
"shift": ["A", "A", "B", "B", "B", "b", "A", "B"],
"machine": ["M1", "M1", "M2", "M2", "M2", "M2", "M1", None],
"defect": [0, 1, 1, 0, 1, 1, 0, 0],
})
required = {"shift", "machine", "defect"}
missing_columns = required - set(pilot.columns)
print("Missing columns:", missing_columns or "none")
# Labels that differ only by case or spacing show a form problem
print("Shift labels found:", sorted(pilot["shift"].unique()))
# Missing values per column
print("Missing values per column:")
print(pilot.isna().sum())
# Units per group, to confirm both groups are being sampled
print("Units per shift (labels normalised):")
print(pilot["shift"].str.strip().str.upper().value_counts())
# Does shift change together with machine? If so, they are confounded
print("Shift by machine:")
print(pd.crosstab(pilot["shift"].str.upper(), pilot["machine"]))The output reveals three problems in the pilot. The label "b" appears next to "B", one machine value is missing, and shift is almost perfectly tied to machine (shift A used M1, and shift B used M2). The last point matters most. With this data you could not tell whether the shift or the machine causes any difference. The fix is a planning one: collect data on both machines in both shifts, or add a plan to compare the machines separately.
Common errors
- Collecting first and deciding later. The data may not support the comparison you need.
- Vague definitions. "Defect" meaning different things to different inspectors makes the Y unreliable.
- Only the suspected X recorded. You cannot rule out alternatives.
- Unequal conditions. Comparing a week of the old setup in summer with a week of the new setup in winter.
- Convenience samples. Taking the first 20 units after a break, because they are easy to reach.
- Too little data for the question. A small sample can fail to detect a real difference, and a "no difference" result then means little.
- Changing the plan after seeing results. Adjust the plan only before the main collection, and record any change you make.
Exercise
A team suspects that a new adhesive lot causes bonding failures. The existing records list failure (yes or no), date, and line, but not the adhesive lot. Name two ways to change the plan so the data can test the suspicion, and one risk of using only the existing records.
Show answer
Two options: (1) add an adhesive lot field to the inspection form and collect prospective data, recording failure per unit with lot, line and date; (2) trace lot numbers from the stores or batch records and attach them to the existing failure records, if the traceability is reliable. Also record line and date so you can check whether another factor, such as a particular line, explains the pattern. The risk of using only the existing records is that they lack the X, so no comparison between lots is possible. Even with the lot added later, the lot may be tied to a line or period, which confounds the result.
Exercise
A pilot shows that all units in group "old setup" were made on Monday and all in group "new setup" on Friday. List two problems this creates for the analysis and one change to the plan.
Show answer
Problems: (1) setup is confounded with day of the week, so any difference could come from day effects such as staffing, warm-up, or material delivery; (2) a single day per group does not cover normal variation, so the result may not apply to other days. Change: collect both setups over the same period, alternating or randomising which setup runs on each day, and record day, operator and material lot.