Sample Probability Calculations
We can calculate probabilities for the Gamma( ) 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 Gamma(2,3) appears below, but feel free to plot it for different values of and .
> restart: with(plots):
> alpha:=2; beta:=3;
> plot(GammaCDF(alpha,beta,x),x=0..20, title="CDF for Gamma(2,3)");
> f:=x->GammaPDF(alpha,beta,x);
> F:=x->GammaCDF(alpha,beta,x);
> a:=plot(f(x),x=0..20):
> b:=plot(f(x),x=0..5,color=yellow,filled=true):
> display([a,b]);
Find the value of the yellow shaded area, the area under the Gamma(2,3) density curve to the left of 5.
> evalf(F(5));
The value of this area can also be found by using the integration command.
> evalf(int(f(x),x=0..5));
> a:=plot(f(x),x=0..20):
> b:=plot(f(x),x=6..10,color=yellow,filled=true):
> display([a,b]);
Find the value of the yellow shaded area, the area under the Gamma(2,3) density curve between 6 and 10.
Using the CDF, we find the area to the left of 10 and then subtract the area to the left of 6.
> area1:=F(10);
> area2:=F(6);
> area_between:=area1-area2;
Using the integration command, we simply integrate the GammaPDF from 6 to 10.
> evalf(int(f(x),x=6..10));
> a:=plot(f(x),x=0..20,labels=[" "," "]):
> b:=plot(f(x),x=8..20,color=yellow,filled=true,labels=[" "," "]):
> c:=textplot([8,-.01,"x"],color=blue):
> d:=textplot([10,0.02,".25"],color=black):
> display([a,b,c,d]);
Find the value of x . x is known as the third quartile for the Gamma(2, 3) distribution.
Find the value of x, which has .75 area to the left of it. Maple requires a search range of x values in order to solve the equation. We chose to use x=0..20.
> fsolve(F(x)=.75,x=0..20);