The Optical Inspector and the Base-Rate Trap
A capacitor factory in Kochi runs two production lines. Line A makes 60% of the daily output and historically has a 2% defect rate; line B makes the remaining 40% with a 5% defect rate. Units are mixed in a single bin at the end of the day, so the line of origin is not recorded. A new optical inspection machine has just been installed: trials show it flags 90% of genuinely defective units, but it also flags 10% of good units. The plant manager proposes scrapping every flagged unit at a loss of ¥40 each, arguing that the machine catches nine out of ten faults, so the flagged pile must be mostly rubbish. The quality manager disagrees and wants the numbers on paper before the scheme starts on Monday. Daily output is 10,000 units.
1. Ignoring the machine, find the overall defect rate and the probability that a defective unit came from line B. Does the manager's belief that most defects come from the bigger line hold?
Read the worked answer
Law of total probability: P(D) = 0.6 × 0.02 + 0.4 × 0.05 = 0.012 + 0.020 = 0.032, a 3.2% defect rate.
Bayes: P(B | D) = 0.020/0.032 = 0.625.
So 62.5% of all defects come from the smaller line. Line B's defect rate is 2.5 times line A's, which more than compensates for its smaller volume. On 10,000 units that is 120 defective from A and 200 from B.
The manager is comparing output volumes with defect counts. The correct comparison is rates (2% versus 5%); the base rate - the share of output - has already been accounted for by the 0.6/0.4 split.
2. Find the probability that a flagged unit is genuinely defective. Out of 10,000 units, how many good units would be scrapped per day, and what does that cost?
Read the worked answer
P(F) = P(F | D)P(D) + P(F | G)P(G) = 0.9 × 0.032 + 0.1 × 0.968 = 0.0288 + 0.0968 = 0.1256.
P(D | F) = 0.0288/0.1256 = 0.2293, about 22.9%.
Per 10,000 units: 320 defective, of which 288 are flagged; 9,680 good, of which 968 are flagged. Total flagged 1,256, of which 968 - 77% - are good. Scrap cost 1,256 × ¥40 = ¥50,240 per day, of which ¥38,720 is thrown away on sound units.
Judgement: the 90% figure is a sensitivity, and sensitivity alone is worthless when the defect rate is only 3.2%. With a 10% false-alarm rate the flagged pile is mostly good product, so the manager's inference is exactly backwards. Scrapping everything flagged destroys far more value than the 32 escaped defects.
3. What false-alarm rate would be needed for the flagged pile to be at least half defective? Separately, evaluate a two-stage scheme in which flagged units pass through a second, identical, independent machine and only units flagged twice are scrapped.
Read the worked answer
Let f be the false-alarm rate. Requiring P(D | F) ≥ 0.5: 0.0288/(0.0288 + 0.968f) ≥ 0.5, so 0.968f ≤ 0.0288, f ≤ 0.02975.
The machine would need a false-alarm rate of about 3.0% or better (specificity ≥ 97%), three times better than the current 10%. That is a specification problem, not something to fix with scrap.
Two-stage: P(D and both flags) = 0.032 × 0.81 = 0.02592; P(G and both flags) = 0.968 × 0.01 = 0.00968. Then P(D | both) = 0.02592/0.0356 = 0.728, so only about 27% of the double-flagged units are good, down from 77%. Per 10,000 units, 259 defective and 97 good units are scrapped, i.e. 356 units instead of 1,256.
Judgement: independence is the assumption that makes this work, so the second machine must not share a lamp, camera or calibration with the first; if it does, the two flags are correlated and the purity gain is overstated.