What is the probability that the store is supplied by factory II?

810 Views Asked by At

Two factories I and II produce phones for brand ABC. Factory I produces 60% of all ABC phones, and factory II produces 40%. 10% of phones produced by factory I are defective, and 20% of those produced by factory II are defective. You know that the store where you buy your phones is supplied by one of the factories, but you do not know which one. You buy two phones, and both are defective. What is the probability that the store is supplied by factory II?

My Attempt

We are trying to find $\mathbb{P}(\text{factory II}|\text{defect})$ From the problem, we know: $$\mathbb{P}(\text{defect}|\text{factory I})=0.1$$ $$\mathbb{P}(\text{defect}|\text{factory II})=0.2$$ $$\mathbb{P}(\text{factory I})=0.6$$ $$\mathbb{P}(\text{factory II})=0.4$$

Using Bayes rule, we have

$$\mathbb{P}(\text{factory II}|\text{defect})=\frac{(0.2)(0.4)}{(0.2)(0.4)+(0.1)(0.6)}=0.5714$$

I was told that this is wrong, but I don't know where I went wrong. Can someone point me in the right direction? Thank you.

2

There are 2 best solutions below

2
On BEST ANSWER

Your work is very good, and at first glance, I thought that it was correct. Then, I re-read the problem:

You buy two phones, and both are defective.

Your work would be correct, under the alternative problem that only one phone was bought, and seen to be defective.

Instead of using, for example, $(0.1)$ and $(0.2)$ to designate the probabilities of the defects occurring under the assumption of Stores I and II, respectively, you must use $(0.1)^2$ and $(0.2)^2.$


Addendum
Responding to the comment question of James Anderson, immediately following my answer:

Good question.

In fact, despite the fact that the events that the first phone is defective and that the second phone is defective are not independent events, you can still multiply the probabilities like that.

First, I will explain why the events are not independent. Then I will explain why you can still multiply the probabilities like that.


The normal chance that a phone is defective is

$\displaystyle (0.6 \times 0.1) + (0.4 \times 0.2) = (0.14).$

From your own analysis, once the first phone is seen to be defective, the probabilities of the phone coming from Factory I, Factory II change from $(0.6), (0.4)$ respectively to $(3/7), (4/7)$ respectively.

This means that once the first phone is seen to be defective, the chance that the second phone is also defective is

$\displaystyle [(3/7) \times 0.1] + [(4/7) \times 0.2] = (11/70).$

Therefore, since $\displaystyle (11/70) \neq (0.14),$ the two events are not independent.

Note that these events are not independent, despite the presumption here that both phones came from the same Factory.


Go back to the original problem:

Let $A$ represent the event that Factory II is being used.

Let $B$ represent the event that two defective phones are found.

Let $C$ represent the event that Factory I is being used.

You want to compute $\displaystyle p(A|B) = \frac{p(AB)}{p(B)}$.

$\displaystyle p(AB) = [(0.4) \times (0.2)^2].$

The reason that you are allowed to compute $p(AB)$ in this manner, is that you are required to presume that if the phones both came from Factory II, the chance of each phone being defective is $(0.2)$. This means that if the phones both came from Factory II, you are required to presume that the events that the first and second phone are each defective are independent events.

Identical analysis is involved in computing

$\displaystyle p(CB) = [(0.6) \times (0.1)^2].$

This means that

$$\displaystyle p(B) = [(0.6) \times (0.1)^2] + [(0.4) \times (0.2)^2] = 0.022.\tag1$$


Now you have a curious situation. If you know that the 2 phones both came from Factory I, then the events of the 1st and 2nd phone being defective are independent events.

If you know that the 2 phones both came from Factory II, then the events of the 1st and 2nd phone being defective are also independent events.

However, based on the analysis at the start of this Addendum, if you know that both phones came from the same Factory, but you don't know which Factory that is, then the events of the 1st and 2nd phone being defective are not independent events. Intuitively, this is because if the first phone is seen to be defective, the relative probabilities of Factory I vs Factory II change from

$\displaystyle (0.6) ~\text{vs}~ (0.4) ~~~~~\text{to}~~~~~ (3/7) ~\text{vs}~ (4/7).$

In fact, based on the first portion of this Addendum, you can alternatively calculate

$p(B) = (0.14) \times \frac{11}{70} = 0.022$.

You get the same answer for $p(B)$ as you did in equation (1) above.

1
On

A precise model is needed in order to resolve any confusion. To this end, consider a generalization of the existing problem in which $n$ phones are sampled from the store, of which $X$ are found to be defective. We assume that the store has effectively infinite stock of phones on hand. Furthermore, let $Z$ be a Bernoulli random variable such that $Z = 1$ means that the store was stocked with phones from Factory II, and $Z = 0$ means the store was stocked with phones from Factory I. Then there is a parameter $p$ that reflects the probability that the store is stocked from Factory II; i.e., $$Z \sim \operatorname{Bernoulli}(p), \\ \Pr[Z = 1] = p.$$ Since prior to purchasing any phones, we are told that Factory I produces $60\%$ of all such phones, we have $p = 0.4$. Additionally, conditional on $Z$, $$X \mid Z \sim \operatorname{Binomial}(n, \pi_Z),$$ where $$\pi_Z = \begin{cases} 0.1, & Z = 0 \\ 0.2, & Z = 1 \end{cases}$$ describes the proportion of defective phones from each factory. Then we are asked for the posterior conditional probability $$\Pr[Z = 1 \mid X = x],$$ namely, the probability that the store was stocked with phones from Factory II given that $x$ defective phones were obtained from a sample of $n$ phones purchased from the store. Well, this is simple to compute via Bayes' theorem: $$\begin{align} \Pr[Z = 1 \mid X = x] &= \frac{\Pr[X = x \mid Z = 1]\Pr[Z = 1]}{\Pr[X = x]} \\ &= \frac{\Pr[X = x \mid Z = 1]\Pr[Z = 1]}{\Pr[X = x \mid Z = 0]\Pr[Z = 0] + \Pr[X = x \mid Z = 1]\Pr[Z = 1] } \\ &= \frac{\binom{n}{x} \pi_1^x (1-\pi_1)^{n-x} p}{\binom{n}{x} \pi_0^x (1-\pi_0)^{n-x} (1-p) + \binom{n}{x} \pi_1^x (1-\pi_1)^{n-x} p} \\ &= \frac{(0.2)^x (0.8)^{n-x} (0.4)}{(0.1)^x (0.9)^{n-x} (0.6) + (0.2)^x (0.8)^{n-x} (0.4)} \\ &= \left(\left(\frac{1}{2}\right)^x \left(\frac{9}{8}\right)^{n-x} \frac{3}{2} + 1\right)^{-1}. \end{align}$$ This gives us the general solution. The specific solution for your question corresponds to the choice $x = n = 2$; i.e., out of two phones purchased, both are defective; hence $$\Pr[Z = 1 \mid X = 2] = \left(\frac{1}{4} \cdot \frac{3}{2} + 1\right)^{-1} = \frac{8}{11} \approx 0.72727.$$


To address the question of independence of the defectiveness of the phones, it is important to understand that in the above solution, the conditional distributions for the status of the $i^{\rm th}$ phone purchased, where $i \in \{1, 2, \ldots, n\}$, are in fact IID Bernoulli, thus the number of such defective phones is binomial as stated above. In this characterization of the Bayesian model, the sample comprises the total number of phones purchased, and it is advantageous to do the calculation this way.

Alternatively, you could formulate the model as successive updates in which phones are bought one by one, and after each phone is purchased, you update the posterior probability of the store being stocked from Factory II, until you have purchased $n$ phones. This would be a Bernoulli prior as in the model above, but rather than a binomial likelihood, we are working with a Bernoulli likelihood. So at each step, $$p_{\text{new}} = \Pr[Z = 1 \mid X_i = x] = \left(\left(\frac{1}{2}\right)^x \left(\frac{9}{8}\right)^{1-x} \frac{1-p_{\text{prior}}}{p_{\text{prior}}} + 1 \right)^{-1},$$ and we only allow $X_i \in \{0,1\}$ for the $i^{\rm th}$ phone and $X_i = 1$ if that phone is defective. For $i = 1$ above, the choice of $p_{\text{prior}}$ is simply $p$, the original prior. For each subsequent phone purchased, we substitute $p_{\text{prior}} = p_{\text{new}}$. So for our original problem, the sample is $(X_1, X_2) = (1,1)$, so after the first update, we have $p_{\text{new}} = \frac{4}{7}$, and the second update gives $p_{\text{new}} = \frac{8}{11}$, as in the previous model. In this formulation, however, it becomes obvious that the unconditional posterior distributions of each $X_i$ are neither independent nor identically distributed.