Rapid Test, Base Rate, and a Batch Decision
A factory produces electronic components in very large batches. Historical data show that 2% of components are defective. A rapid automated test is used before shipping. The test correctly flags 95% of defective components, but it also flags 10% of non-defective components. A component from a new batch tests positive. The quality manager proposes rejecting the entire batch of 500 components on the basis of this one positive result, arguing that “the test is 95% accurate, so the component is almost certainly defective.” The production engineer disagrees and asks for a calculation using the base rate. The company also wants to know how many false positives to expect in a batch of 500 if the defect rate is as stated, and whether a second independent confirmatory test with the same sensitivity and specificity would materially change the conclusion.
1. Calculate the probability that a component is defective given that it tests positive. Compare this with the manager’s claim.
Read the worked answer
Let D be “defective” and + be “tests positive”. The given information is [P(D)=0.02,\quad P(+\mid D)=0.95,\quad P(+\mid D^c)=0.10.]
First find the total positive rate: [P(+)=P(+\mid D)P(D)+P(+\mid D^c)P(D^c)] [=0.95(0.02)+0.10(0.98)=0.019+0.098=0.117.]
Then by Bayes’ theorem: [P(D\mid +)=\frac{0.019}{0.117}=\frac{19}{117}\approx0.1624.]
So a positive component is only about 16.2% likely to be defective. It is far more likely to be non-defective (about 83.8%). The manager has confused the test’s sensitivity, 95%, with the posterior probability of defect given a positive result.
2. For a batch of 500 with the stated defect rate, compute the expected numbers of true positives, false positives, and total positives. Interpret the result for the manager’s proposal.
Read the worked answer
In 500 components, expected defective and non-defective counts are [500(0.02)=10,\qquad 500(0.98)=490.]
Expected true positives: [10(0.95)=9.5.]
Expected false positives: [490(0.10)=49.]
Total expected positives: [9.5+49=58.5.]
So among the positive results, false positives outnumber true positives by roughly five to one. A single positive result is therefore weak evidence of a defective component and does not justify rejecting all 500 components. The manager’s proposal would discard many good components; a confirmatory test or a proper sampling plan is needed.
3. Suppose a positive component is retested with a second independent test having the same sensitivity and specificity. Calculate the probability it is defective given two positive results. Does this materially change the conclusion?
Read the worked answer
Assuming the two tests are independent conditional on the component’s true state, the probability of two positives is [P(++\mid D)=(0.95)^2=0.9025,] [P(++\mid D^c)=(0.10)^2=0.01.]
Then [P(D\mid ++)=\frac{0.02(0.9025)}{0.02(0.9025)+0.98(0.01)}] [=\frac{0.01805}{0.01805+0.0098} =\frac{0.01805}{0.02785}\approx0.648.]
So after two positive results, the probability of defect is about 64.8%. This is a material increase from 16.2%, but it is still not “almost certainly defective.” A third test or a different, more specific confirmatory method would be needed before rejecting the batch on one component.