# Conditional Probability/Bayes Theory question

On my homework, there is a problem:

A hospital receives two-fifths of its flu vaccine from Company A and the remainder from Company B. Each shipment contains a large number of vials of vaccine. From Company A, 3% of the vials are ineffective; from Company B, 2% are ineffective. A hospital test n = 15 randomly selected vials from one shipment and finds that 2 are ineffective. What is the conditional probability that this shipment came from Company A?

The given answer is $.568$. I keep getting $.5$.

I think I'm confused what to do with the $2/15$ inefficient. I didn't use that at all when I calculated, and I can't figure out when to use it.

My calculation: $$P(I) = P(A)P(I|A) + P(B)P(I|B) = (.4)(.03) + (.6)(.02) = .024$$ $$P(A|I) = [P(A)P(I|A)]/P(I) = [(.4)(.03)]/.024 =.5.$$

• What are the probabilities of getting exactly two bad vials out of 15, conditioned on the shipment coming from $A$ and $B$, respectively? – amd Jan 27 '18 at 0:09
• Would it be as simple as the bad vial probability for each batch times the two bad out of 15? So A = .03 * (2/15) B = .02 * (2/15)? – SloanTheSloth Jan 27 '18 at 0:10
• No. Think Binomial distribution. The error you’re making is in using the probability of any particular single vial being bad, which is not the event in the problem. – amd Jan 27 '18 at 0:12

• $E$ be the event that exactly $2/15$ tested vials are faulty.
• $A$ be the event that the shipment is from Company A.
• Note: This means $A^\complement$ is the event that the shipment is from Company B.
We are looking for $P(A|E)$.
\begin{aligned} P(A|E)&=\frac{P(A\cap E)}{P(E)} \\ &=\frac{P(E|A)P(A)}{P(E)} \\ &=\frac{P(E|A)P(A)}{P(E|A)P(A)+P(E|A^\complement)P(A^\complement)} \end{aligned} At this point, we will solve for both of the relevant terms. \begin{aligned} P(E|A)P(A)&=\left(\binom{15}{2}0.03^20.97^{13}\right)0.4 \\ &\approx0.02544 \end{aligned} and \begin{aligned} P(E|A^\complement)P(A^\complement)&=\left(\binom{15}{2}0.02^20.98^{13}\right)0.6 \\ &\approx0.01938. \end{aligned} This gives us a final answer of $P(A|E)=0.5676$.