1
$\begingroup$

Problem Statement

At a certain electronics factory, in a typical day’s output 10% percent of resistors are bad, and the rest are good. Good resistors have an 80% chance of passing the factory’s test, and bad resistors have a 30% chance of passing the test. Suppose the factory tests each resistor three times. If a particular resistor passes the test 2 times out of 3, what are the chances it is good?

Solution 1

First, let's define some events:

$B :=$ resistor is bad, $G :=$ resistor is good

$P :=$ resistor passes one test, $F :=$ resistor fails one test

$Q :=$ resistor passes 2 out of 3 tests

From the problem statement, we can say that $P[B] = 0.10, P[G] = 0.90, P[P|G] = 0.80, P[P|B] = 0.30$. Since the tests are independent, we can also say that $P[Q|G] = {3 \choose 2}(0.8)^2(0.2)$ and that $P[Q|B] = {3 \choose 2}(0.3)^2(0.7)$.

The quantity we seek is $P[G|Q]$. We proceed using Bayes' theorem:

$$ \begin{align} P[G|Q] &= \frac{P[Q|G]P[G]}{P[Q]}\\ &= \frac{P[Q|G]P[G]}{P[Q|G]P[G] + P[Q|B]P[B]}\\ &= \frac{{3 \choose 2}(0.8)^2(0.2)(0.9)}{{3 \choose 2}(0.8)^2(0.2){0.9} + {3 \choose 2}(0.3)^2(0.7)(0.1)}\\ &\approx 0.95 \end{align} $$

Solution 2

This solution is the same as solution 1, but we calculate $P[Q]$ differently. We can say that $P[P] = P[P|G]P[G] + P[P|B]P[B] = (0.8)(0.9) + (0.3)(0.1) = 0.75$. Since the tests are independent, $P[Q] = {3 \choose 2}(0.75)^2 (0.25)$.

We proceed using Bayes' theorem just like we did in solution 1:

$$ \begin{align} P[G|Q] &= \frac{P[Q|G]P[G]}{P[Q]}\\ &= \frac{{3 \choose 2}(0.8)^2(0.2)(0.9)}{{3 \choose 2}(0.75)^2 (0.25)}\\ &\approx 0.82 \end{align} $$


My Question

To me, both of these approaches seem right, but the answers are different. I've done the math several times, so I don't think the difference is due to an arithmetic error. Which solution is correct? Why?

$\endgroup$
  • $\begingroup$ The choice of using $P$ with two distinct meanings ("probability" and "passes the test") is confusing. $\endgroup$ – mlc Mar 13 '17 at 16:41
  • 1
    $\begingroup$ P(Q) the probability we pass the test 2 out of 3 times - the first part is what type of resistor is it. then the second part is get the probability it passes or fails based on that fact - you can't treat each test as independent, once it passes a test it is more likely to be good than it was before the test $\endgroup$ – Cato Mar 13 '17 at 16:53
  • $\begingroup$ if 1% of boys always pass a test and 99% of girls always pass a test - I can't calculate the probability of a person passing two tests as 0.5^2 = .25 - it is actually (1/2)(.99^ 2 + .01^2) = .49 That is to say the girls pass both the tests usually - just to dream up a quick sexist example $\endgroup$ – Cato Mar 13 '17 at 16:58
1
$\begingroup$

The difference in the two approaches is in how you compute $P(Q)$. The first approach is the correct one.

(Let me write $Y$ instead of $P$ for "passing the test one time".) The second approach computes $P(Y)$ and then feeds it in the binomial distribution to derive the probability of passing the test twice out of three attempts. The flaw is in the assumption that the three trials are independent: the resistor is either good or bad (and the outcomes of the trials depend on its state).

Your second approach may be re-examined as follows. Let $Q$ be the event "passing the test two times out of three". Then $P[Q] = P[Q|G]P[G] + P[Q|B]P[B]$ as in your application of the Bayes' rule.

$\endgroup$
  • $\begingroup$ So the the trials are not independent if you don't know whether the resistor is good or bad? How can that be? $\endgroup$ – SplitInfinity Mar 13 '17 at 16:59
  • $\begingroup$ See third comment to the question with an example with boys and girls. Independence has nothing to do with what you know. If the resistor is good (but you do not know it), this affects the odds for $Q$. If the first trial is a success, this increases the probability that the resistor is good and hence the odds for $Q$. $\endgroup$ – mlc Mar 13 '17 at 17:02
1
$\begingroup$

P(GOOD | Passes 2/3 times ) = P(Passes 2/3 times AND Good) / P(passes 2/3 times)

= 0.9 x 0.8 x 0.8 x 0.2 x 3 / (.9 x 0.8 x 0.8 x 0.2 x 3 + 0.1 x 0.3 x 0.3 x 0.7 x 3) = (216/625)/(216/625 + 189/10000) = 128/135 = .95

the first one

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.