Sample Probability Calculations

We can calculate probabilities for the Beta( [Maple Math] ) distribution using either the probability density function (PDF) or the cumulative distribution function (CDF). We will denote the PDF by f and the CDF by F . The graph of the CDF for the Beta(3,4) distribution appears below, but you are encouraged to plot it for different values of [Maple Math] and [Maple Math] .

> f:=(alpha,beta,x)->GAMMA(alpha+beta)/(GAMMA(alpha)*GAMMA(beta))*x^(alpha-1)*(1-x)^(beta-1);

[Maple Math]

> F:=(alpha,beta,x)->int(f(alpha,beta,t),t=0..x);

[Maple Math]

> alpha:=3; beta:=4;

[Maple Math]

[Maple Math]

> plot(F(alpha,beta,x),x=0..1, title="Cumulative Distribution Function for Beta(3,4)");

[Maple Plot]

> a:=plot(f(alpha,beta,x),x=0..1):

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

> display([a,b]);

[Maple Plot]

Find the value of the yellow shaded area, the area under the Beta(3,4) density curve to the left of 0.4

> evalf(F(alpha,beta,0.4));

[Maple Math]

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

> evalf(int(f(alpha,beta,x),x=0..0.4));

[Maple Math]

> a:=plot(f(alpha,beta,x),x=0..1):

> b:=plot(f(alpha,beta,x),x=0.4..0.6,color=yellow,filled=true):

> display([a,b]);

Find the value of the yellow shaded area, the area under the Beta(3,4) density curve between 0.4 and 0.6.

[Maple Plot]

Using the CDF, we can easily find the shaded area by finding the area to the left of 0.6 and then subtracting the area to the left of 0.4.

> area:=evalf(F(alpha,beta,0.6)-F(alpha,beta,0.4));

[Maple Math]

Or, using the integration command, we can simply integrate the Beta(3,4) PDF from 0.4 to 0.6.

> evalf(int(f(alpha,beta,x),x=0.4..0.6));

[Maple Math]

> a:=plot(f(alpha,beta,x),x=0..1,labels=[" "," "]):

> b:=plot(f(alpha,beta,x),x=0.7..1,color=yellow,filled=true,labels=[" "," "]):

> c:=textplot([0.7,-.04,"x"],color=blue):

> d:=textplot([0.75,0.2,".070"],color=black):

> display([a,b,c,d]);

[Maple Plot]

Find the value of x, which has .070 area to the right of it. The 3rd argument of the function call (0..1) tells Maple to look for a solution between 0 and 1.

> fsolve(F(alpha,beta,x)=.93,x,0..1);

[Maple Math]

>