Sample Probability Calculations

We can calculate probabilities for the Gamma( [Maple Math] ) 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 [Maple Math] and [Maple Math] .

> restart: with(plots):

> alpha:=2; beta:=3;

[Maple Math]

[Maple Math]

> plot(GammaCDF(alpha,beta,x),x=0..20, title="CDF for Gamma(2,3)");

[Maple Plot]

> f:=x->GammaPDF(alpha,beta,x);

[Maple Math]

> F:=x->GammaCDF(alpha,beta,x);

[Maple Math]

> a:=plot(f(x),x=0..20):

> b:=plot(f(x),x=0..5,color=yellow,filled=true):

> display([a,b]);

[Maple Plot]

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));

[Maple Math]

The value of this area can also be found by using the integration command.

> evalf(int(f(x),x=0..5));

[Maple Math]

> 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.

[Maple Plot]

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);

[Maple Math]

> area2:=F(6);

[Maple Math]

> area_between:=area1-area2;

[Maple Math]

Using the integration command, we simply integrate the GammaPDF from 6 to 10.

> evalf(int(f(x),x=6..10));

[Maple Math]

> 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.

[Maple Plot]

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);

[Maple Math]