Mary, John and Victor are programmers in a company. They work together to code for a project. Mary has written 60% of the code while John has written 30% and Victor remaining 10%. Their work was then evaluated. Mary's code contained only 3% of errors, John has 7% errors and Victor has 5% of errors.
How many percent of the code is wrong? my answer is the total errors which is 15%
When a bug was found, what is the probability that the bug was caused by Mary, John or Victor? 1. Probability of bug found given that it was caused by Mary? 2. Probability of a bug found given that it was caused by John? 3. Probability of a bug found given that it was caused by Victor?
I am not sure how to plug in the numbers. Thanks
First of all, I think that when they say 'John has 7% errors', they mean '7% of John's work contains errors', rather than '7% of all work is erroneous, thanks to John'.
If that is what is meant, then you can't just add those percentages of errors and add them up; what if they all make errors in 50% of their work? Then 150% of al the work would contain errors?!?
So instead, you have to say that Mary's errors results in 0.6*0.03=0.018 i.e. 1.8% of al the work contains errors caused by Mary. Same for the others, and then add them up. So for John you get 2.1%, and for Victor 0.5%, totaling 4.4%. (As opposed to 15%!)
And now you can figure out the probability that some error was caused by any particular person: Mary causes 1.8/4.4 of all the errors, John 2.1/4.4, and Victor 0.5/4.4.
Formally:
$E$ : work is erroneous
$M$: Mary did work (also define $J$ and $V$)
$P(M)=0.6$
$P(J)=0.3$
$P(V)=0.1$
$P(E|M)=0.03$
$P(E|J)=0.07$
$P(E|V)=0.05$
$P(E)=P(E|M)*P(M)+P(E|J)*P(J)+P(E|V)*P(V)=...$ (just plug in)
And then use Bayesian:
$P(M|E)=P(E|M)*P(M)/P(E)$ so this os the probability that if somecod was erroneous, it was caused by Mary.
Similar for the others.