Data AnalyticsDomain analytics and business cases

Manufacturing defect rates with changing inspection volumes

PK
Pankit Kumar
Sr. Data Scientist at Parexel (a Goldman Sachs–backed company) · 20 September 2026 · 3 min read
Technically reviewed by Ishaan Sharma
In this article (5 sections)

To calculate the defective-unit proportion across batches, divide total defective units by total inspected units. Averaging batch percentages equally gives each batch the same influence regardless of how many units were inspected.

Also distinguish defective units from defect occurrences. One unit can contain several defects, so those numerators answer different questions and can produce different rates.

Inspect three unequal batches

The original synthetic inspection fixture contains disjoint inspected units:

BatchLineProductInspected unitsDefective unitsDefects
B1AStandard10057
B2AStandard1,0002025
B3BComplex5058

Batch defective-unit rates are 5%, 2% and 10%. The equal average is approximately 5.67%, but the pooled proportion is 30/1,150 ≈ 2.61%. Most inspected units came from B2, whose rate is lower.

Calculate the pooled measures

sql
SELECT SUM(inspected_units) AS inspected_units,
 SUM(defective_units) AS defective_units,
 SUM(defects) AS defects,
 1.0*SUM(defective_units)/NULLIF(SUM(inspected_units),0) AS defective_unit_proportion,
 1.0*SUM(defects)/NULLIF(SUM(inspected_units),0) AS defects_per_inspected_unit
FROM inspections;

There are forty defect occurrences across thirty defective units. Defects per inspected unit are 40/1,150 ≈ 0.0348. This is not the probability that a unit is defective, and in another dataset it could exceed one.

NIST's proportion-defective guidance describes inference for defective-item proportions under a suitable sampling model. The arithmetic here is descriptive; the fixture does not establish a sampling design for generalizing to all production.

python
from math import isclose
from build_and_verify import database

db = database()
rows = db.execute('SELECT * FROM inspections').fetchall()
db.close()
assert all(0<=r[4]<=r[3] and r[5]>=r[4] for r in rows)
inspected = sum(r[3] for r in rows)
defective = sum(r[4] for r in rows)
defects = sum(r[5] for r in rows)
pooled = defective/inspected
equal_batch_average = sum(r[4]/r[3] for r in rows)/len(rows)
weighted = sum((r[3]/inspected)*(r[4]/r[3]) for r in rows)
assert (inspected,defective,defects)==(1150,30,40)
assert isclose(pooled,weighted)
assert isclose(equal_batch_average,17/300)
assert equal_batch_average > pooled
print({'pooled_defective_proportion':pooled,
       'equal_batch_average':equal_batch_average,
       'defects_per_inspected_unit':defects/inspected})

Check whether inspected units represent production

If inspectors target suspicious batches or repeatedly inspect repaired units, the inspected population may differ from all manufactured units. A higher observed defect proportion can reflect a changed inspection strategy rather than a worse production process.

Track inspection coverage and selection rules. Define whether the denominator counts unique units, inspection attempts or defect opportunities. Reinspection after repair should not silently create a second independent manufactured unit.

For first-pass yield, preserve the first inspection outcome separately from final acceptance after rework. A final-pass measure can improve while rework effort increases.

Avoid confounding product complexity with line quality

Line A processes standard products in this fixture; line B processes complex products. Their rates differ, but the dataset cannot separate line performance from product type. A direct ranking would attribute more than the evidence supports.

Compare compatible products and inspection rules, or use an appropriate adjusted analysis when sufficient overlap and data exist. If no line processes the same product type, adjustment cannot create the missing comparison without strong assumptions.

Changing inspection volume also changes precision. A rate from fifty units is less stable than the same rate from a much larger independent sample under a comparable model. Control limits or uncertainty intervals should reflect denominator size and process assumptions, not reuse one fixed band indiscriminately.

Exercise: add a batch with 10,000 inspected units and a 1% defective rate. Recalculate the pooled and equal-batch averages. Then add a repeated inspection of an existing unit and explain why unit-level identity is needed to avoid denominator inflation.

NeuraPath's Data Analytics with Generative AI course connects weighted measures with operational interpretation. A reliable quality report states what was inspected, how defects were counted and which comparisons the data support.

Continue learning

This article is part of the Domain analytics and business cases sequence. Use the neighbouring tasks when you need the prerequisite or the next application.

PK
Pankit Kumar
Lead Instructor, NeuraPath Academy

Pankit Kumar has 10 years in Data Science & AI, building and shipping production systems in regulated pharma and clinical environments. He is a freelance trainer at Boston Institute of Analytics, AnalytixLabs and Scaler, and has taught this material to thousands of working professionals.

This article is part of our Data Analytics with Generative AI programme — 3–4 months. The full analyst stack — Excel, SQL, Power BI and Python pipelines — then a generative-AI layer you can prove is right.

Explore Data Analytics with Generative AI
Counselling is free · no obligation

Not sure which programme fits?

Tell us your background and we will map it to the right entry point — including saying so when a cheaper programme is the better fit. A counsellor replies within one working day.