A Good Robot That Is Not So Good

You manufacture items and notice that an item is defective with probability 0.1%.

You consider purchasing a robot to help identify defective items.

The vendor claims that the robot says that
  • a defective item is defective with probability 98%, and
  • a non-defective item is non-defective with probability 99%.
Is this a good purchase?

Ultimately, you only care whether an item is defective if the robot says that it is defective.

Let D and N be the events that an item is defective and non-defective, and let RD and RN be the events that the robot says that an item is defective and non-defective.

Then, mathematically, you only care about P(D|RD) and know that
  • P(D)=0.001,
  • P(RD|D)=0.98, and
  • P(RN|N)=0.99.
It follows (using Bayes' theorem) that

P(D|RD)=P(RD|D)P(D)P(RD)=P(RD|D)P(D)P(RD|D)P(D)+P(RD|N)P(N)=P(RD|D)P(D)P(RD|D)P(D)+(1P(RN|N))(1P(D))=0.980.0010.980.001+0.010.999110.0893.

In other words, if the robot says that an item is defective, then the probability that it is defective is just under 9%.

How counter-intuitive is that?