• Nem Talált Eredményt

Geometrical distribution (optimistic)

In document PROBABILITY THEORY WITH SIMULATIONS (Pldal 75-82)

Applications: 1. Phenomenon: Red and green balls are in a box. We make draws with replacement until we draw the first red ball

Definition of the random variable:

X =how many draws are needed until the first red Parameter:

p=the probability of red at each draw

2. Phenomenon: We make experiments for an event until the first occurrence of the event.

Definition of the random variable:

X=the number of experiments needed until the first occurrence Parameter:

p=probability of the event

3. Phenomenon: An infinite sequence of independent events which have the same probability is considered.

Definition of the random variable:

X=the rank of the first occurring event in the sequence Parameter:

p=common probability value of the events The following file simulates an ’optimistic’ geometrical random variables:

Demonstration file: Geometrical random variable, optimistic: simulation with bulbs 120-06-00

72

Part II. Discrete distributions 73

Weight function (probability function):

p(x) = (1−p)x−1p ifx=1,2, . . . Demonstration file: Geometrical distribution, pessimistic, optimistic 120-10-40

Proof of the formula of the weight function. In order to find an expression for p(x), we need to study the event "X=x" which means that "the first red ball occurs at the xth draw", which means that the 1st draw is green, and the 2nd draw is green, and the 3rd draw is green, nd so on the(x−1)th draw is green, and thexth draw is red. The probability of this is equal to(1−p)x−1p, which is the formula of the weight function.

Proof of the normalization property.

x

p(x) =

x=1

(1−p)x−1p= p

1−(1−p) = p p=1

We used the summation formula for infinite geometrical series verbalized as "First term divided by one minus the quotient":

n x=0

qxa= a 1−q = p

p =1 The following file shows the geometrical distribution:

The following file shows the geometrical distributions:

Demonstration file: Geometrical distributions, pessimistic, optimistic 120-10-40

Using Excel. In Excel, there is no a special function associated to this distribution. However, using the power function POWER (in Hungarian: HATVÁNY and multiplication, it is easy to construct a formula for this distribution:

(1−p)x−1p=POWER(1-p;x-1)*p

Remark. The terms pessimisticand optimisticare justified by the attitude that drawing a red ball at any draw may be interpreted as a success, drawing a green ball at any draw may be interpreted as a failure. Now, a person interested in the number of draws until the first successcan be regarded as an optimistic person compared to someone else who is interested in thenumber of failuresbefore the first success.

Vetier András, BME tankonyvtar.ttk.bme.hu

Section 18

*** Negative binomial distribution (pes-simistic)

Applications: 1. Phenomenon: Red and green balls are in a box. We make draws with replacement until we draw therth red.

Definition of the random variable:

X=how many green balls are drawn before therth red ball Parameters:

r=the number of times we want to pick red p=the probability of drawing red at each draw

2. Phenomenon: We make experiments for an event until therth occurrence of the event (until therth "success").

Definition of the random variable:

X =the number of non-occurrences before therth occurrence or, with the other terminology,

X=the number of failures before therth success Parameters:

r=the number of times we want to pick red p=the probability of the event

3. Phenomenon: An infinite sequence of independent events which have the same probability is considered.

Definition of the random variable:

X =the number of non-occurrences before therth occurrence 74

Part II. Discrete distributions 75

or, with the other terminology,

X =the number of failures before therth success Parameters:

r=the number of times we want occurrence p=common probability value of the events

Demonstration file: Negative binomial random variable, pessimistic: simulation with bulbs 120-09-00

Weight function (probability function):

p(x) = The following file shows the pessimistic negative binomial distribution:

Demonstration file: Negative binomial distribution, pessimistic 120-10-45

Proof of the combinatorial form. In order to find an expression for p(x), we need to study the event "X=x" which means that "before the rth red ball, we draw exactlyx green balls".

This means that among the firstx+r−1 draws there are exactlyxgreen balls, and the(x+r)th draw is a red. The probability that among the first x+r−1 draws there are exactlyxgreen balls is equal to

x+r−1 x

(1−p)xpr−1

and probability that the (x+r)th draw is a red is equal to p. The product of these two expressions yields the combinatorial form of the weight function.

Proof of the analytical form. We derive it from the combinatorial form. We expand the binomial coefficient into a fraction of products, and we get that

x+r−1

Vetier András, BME tankonyvtar.ttk.bme.hu

76 PROBABILITY THEORY WITH SIMULATIONS (−r) (−r−1)) . . . (−r−(x−2)) (−r−(x−1))

x! (−1)x=

−r x

(−1)x

If both the leftmost and the rightmost side of this equality are multiplied by pr(1−p)x, we get the combinatorial form on the left side and the analytical form on the right side.

Remark. Since the analytical form of the weight function contains the negative number−r in the upper position of the binomial coefficient, the name "negative binomial with parameter r" is used for this distribution.

Proof of the normalization property.

x

p(x) =

x=0

==1 We used the summation formula

The following file simulates a ’pessimistic’ negative binomial random variable.

Using Excel. In Excel, the function NEGBINOMDIST(in Hungarian: NEGBINOM.ELOSZL) is gives the individual terms of this distribution:

x+r−1 r−1

pr(1−p)x=NEGBINOMDIST(x;r;p)

This Excel function does not offer aTRUE-option to calculate the summarized probabilities.

The summarized probability

k

i=0

i+r−1 r−1

pr(1−p)i

can be calculated, obviously, by summation. However, using a trivial relation between negative binomial and binomial distribution, the summarized probability can be directly calculated by the Excel formula1-BINOMDIST(r-1;k;p;TRUE)

tankonyvtar.ttk.bme.hu Vetier András, BME

Section 19

*** Negative binomial distribution (opti-mistic)

Applications: 1. Phenomenon: Red and green balls are in a box. We make draws with replacement until we draw therth red.

Definition of the random variable:

X=how many draws are needed until therth red Parameters:

r=the number of times we want to pick red p=the probability of drawing red at each draw

2. Phenomenon: We make experiments for an event until therth occurrence of the event.

Definition of the random variable:

X=the number of experiments needed until therth occurrence Parameters:

r=the number of times we want occurrence p=probability of the event

3. Phenomenon: An infinite sequence of independent events which have the same probability is considered.

Definition of the random variable:

X =the rank of therth occurring event in the sequence Parameters:

r=the number of times we want occurrence p=common probability value of the events

77

78 PROBABILITY THEORY WITH SIMULATIONS

The following file simulates an "optimistic" negative binomial random variables:

Demonstration file: Negative binomial random variable, optimistic: simulated with bulbs 120-08-00

Weight function (probability function):

p(x) =

x−1 x−r

pr(1−p)x−r ifx=r,r+1,r+2, . . .

The following file shows the negative binomial distributions, both pessimistic and optimistic:

Demonstration file: Negative binomial distributions: pessimistic, optimistic 120-10-50

Using Excel. In Excel, the functionNEGBINOMDIST(in Hungarian: NEGBINOM.ELOSZL) can be used for this distribution. However, keep in mind that the function NEGBINOMDIST is directly associated to the pessimistic negative binomial distribution, so for the optimistic negative binomial distribution we have to use the functionNEGBINOMDISTwith the following parameter-setting:

x−1 r−1

pr(1−p)x−r=NEGBINOMDIST(x-r;r;p)

tankonyvtar.ttk.bme.hu Vetier András, BME

Section 20

In document PROBABILITY THEORY WITH SIMULATIONS (Pldal 75-82)