Probability Distribution Function and Shape
> restart;
> with(plots):
>
The Geometric Distribution
Consider observing independent Bernoulli trials having success probability p until the first
success is observed. For example, flipping a coin until the first time a head is observed is
such an exercise. If we define a random variable X as the number of trials required to observe
the first success then X is said to have the Geometric( p ) distribution.
If X is a random variable having the Geometric( p ) distribution, then the probability distribution
function for X is
f ( k ) = P( X = k ) = , k = 1,2,3, ...
This is readily seen by noting that if Bernoulli trial number k yields the first success, then the first
k -1 trials were all failures.
The following code will draw a probability histogram for the Geometric( p ) distribution
for p= 0.5, but you are encouraged to try other values of p.
> p:=0.5;
> ProbHist(GeometricPDF(p,x),1..15,15);
>
To see the effect of p on the shape of the Geometric( p ) distribution, the following
animation will draw a series of probability histograms as p varies from 0.05 to 0.5 by
increments of 0.05
> for n from 0 to 9 do
> num:=convert(evalf(0.05+n*0.05), string):
> tracker[n]:=textplot([12,0.4,`p is `.num],color=blue):
> H[n]:=ProbHist(GeometricPDF(0.05+n*0.05,x),1..15,15):
> P[n]:=display({H[n],tracker[n]}):
> od:
> display(seq(P[n], n=0..9), insequence=true,title="p is increasing");
>