1
$\begingroup$

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

  • 0
    I´m little bit confused about the names. Who write the code ? Alice, Bob and Carol or Mary, John and Victor ?2017-01-28
  • 0
    wsorry, it was just mary john and victor2017-01-28

2 Answers 2

1

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.

  • 0
    thank you. i had a similar intuition. i think i just need to add confidence to my maths!2017-01-28
  • 0
    intuitively i wonder why Victor had the lease probability as he did only 10% of the work and half of it was erroneous but the probability that if a bug was found was caused by Victor remains the lowest... hmmmm2017-01-28
1

You can assume 7% error of John as 0.07*0.3= 0.021 and similarly for others. Mary's as 0.03*0.6= 0.018 and Victor's as 0.05*0.1 = 0.005. so total % of error in coding is 0.021+0.018+0.005= 0.044 = 4.4%

Probability that bug was caused by John = 0.021/0.044 = 0.477 And similarly for others.