Probability Distribution Function and Shape
The Exponential Distribution
A random variable X has an exponential distribution if and only if its probability density is given by
for x > 0
f ( x ) =
0 elsewhere
where > 0.
The following code will draw the density function for the Exp( ) distribution for = 1, but you are encouraged to try other values of .
> restart;
> with(plots):
> theta:=1;
> f(x):=ExponentialPDF(theta,x);
> plot(f(x),x=0..3, title="Exp(1) PDF");
To see the effect of on the shape of the Exp( ) distribution, the following animation will draw a series of probability density functions as varies from 0.1 to 2.1 by increments of 0.1. What happens as increases?
> theta[0]:=0.1; theta_step:=0.1;
> for n from 0 to 20 do
> density[n]:=plot(ExponentialPDF(theta[0]+n*theta_step,x),x=0..4):
> num:=convert(evalf(theta[0]+n*theta_step,3),string):
> tracker[n]:=textplot([3,6,`theta is `.num],color=blue);
> P[n]:=display({density[n],tracker[n]}):
> od:
> display([seq(P[n],n=0..20)],insequence=true,title="Increasing theta for PDF");
>
This next bit of code will animate the CDF for a Exp( ). What happens to the CDF as theta increases from 0.1 to 2.1?
Note that the plot range is the same as above, x=0..4. If you'd like, you can experiment with different values of .
> theta[0]:=0.1; theta_step:=0.1;
> for n from 0 to 20 do
> density[n]:=plot(ExponentialCDF(theta[0]+n*theta_step,x),x=0..4):
> num:=convert(evalf(theta[0]+n*theta_step,3),string):
> tracker[n]:=textplot([3,0.8,`theta is `.num],color=blue);
> P[n]:=display({density[n],tracker[n]}):
> od:
> display([seq(P[n],n=0..20)],insequence=true,title="Increasing theta for CDF");