Sample Probability Calculations
We can calculate probabilities for the Exp( ) distribution using either the probability distribution function (PDF) or the cumulative distribution function (CDF). We will denote the PDF by f and the CDF by F . The CDF for the Exp(1) appears below, but feel free to plot it for different values of .
> restart: with(plots):
> theta:=1;
> plot(ExponentialCDF(theta,x),x=0..4, title="CDF for Exp(1)");
> f:=x->ExponentialPDF(theta,x);
> F:=x->ExponentialCDF(theta,x);
> a:=plot(f(x),x=0..4):
> b:=plot(f(x),x=0..1.5,color=yellow,filled=true):
> display([a,b]);
Find the value of the yellow shaded area, the area under the Exponential(1) density curve to the left of 1.5.
> evalf(F(1.5));
The value of this area can also be found by using the integration command.
> evalf(int(f(x),x=0..1.5));
> a:=plot(f(x),x=0..4):
> b:=plot(f(x),x=2..3,color=yellow,filled=true):
> display([a,b]);
Find the value of the yellow shaded area, the area under the Exponential(1) density curve between 2 and 3.
Using the CDF, we find the area to the left of 3 and then subtract the area to the left of 2.
> area1:=F(3);
> area2:=F(2);
> area_between:=area1-area2;
Using the integration command, we simply integrate the ExponentialPDF from 2 to 3.
> evalf(int(f(x),x=2..3));
> a:=plot(f(x),x=0..4,labels=[" "," "]):
> b:=plot(f(x),x=1.38..4,color=yellow,filled=true,labels=[" "," "]):
> c:=textplot([1.35,-.04,"x"],color=blue):
> d:=textplot([2,0.08,".25"],color=black):
> display([a,b,c,d]);
Find the value of x . x is known as the third quartile for the Exp(1) distribution.
Find the value of x, which has .75 area to the left of it. We want to solve for x .
> fsolve(F(x)=.75,x);