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 \(R_D\) and \(R_N\) be the events that the robot says that an item is defective and non-defective.
Then, mathematically, you only care about \(P(D|R_D)\) and know that
- \(P(D)=0.001\),
- \(P(R_D|D)=0.98\), and
- \(P(R_N|N)=0.99\).
It follows (using Bayes' theorem) that
$$\begin{align*}P(D|R_D)&=P(R_D|D)\frac{P(D)}{P(R_D)}\\\\&=P(R_D|D)\frac{P(D)}{P(R_D|D)P(D)+P(R_D|N)P(N)}\\\\&=P(R_D|D)\frac{P(D)}{P(R_D|D)P(D)+(1-P(R_N|N))(1-P(D))}\\\\&=0.98\frac{0.001}{0.98\cdot0.001+0.01\cdot0.999}\\\\&\approx\vphantom{\frac11}0.0893.\end{align*}$$
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?