Choose the family of distributions that best fits the described situation: You want to model the number of lines of code run until the first 'bug' is detected. The probability a line of code has a bug is 0.003 or 0.3%.

Respuesta :

Answer is : Geometric distribution

Let X be the number of lines of codes run until the first bug is detected

That is X is the random variable which is the number of trials needed to get first success. Success here is detection of bug . Success has constant probability in each trail which is p= 0.003 . That is before the first success we have    X-1 failures with probability (1-0.003)

The probability mass function of X is

P(X=x) = (1-p)x-1 p

P(X=x ) = (1-0.003)x-1 *0.003 , x= 1,2,....

This distribution is also Negative Binomial distribution  

As geometric distribution is special case of Negative Binomial Distribution

In Negative Binomial distribution , we have r success ( r\geq 1) and the random variable is the number of Bernouli trials needed to get r successes .

If we put , r= 1, that is number of success is 1

Then the given situation , that is number of lines code run(X) before the first bug follow negative binomial distribution

The probability mass function of Negative Binomial distribution is

P(X=x) = (1-p)x-r pr ,x= r , r+1 , .....

The probability mass function of X is

P(X=x, r=1 ) = (1-0.003)x-1 *0.003 , x= 1,2,....

ACCESS MORE