Maple Stat
Maple Stat
Maple Stat
ALEX POTAPCHIK
1. Probability Calculations
At the most basic level, the Statistics package can be used as a reference
tool to get information about various continuous and discrete probability
density functions.
This yields
c+1
b·Γ .
c
Here is the standard deviation:
Maplesoft, Waterloo, Canada.
1
International Statistical Institute, 56th Session, 2007: Alex Potapchik
2 ALEX POTAPCHIK
bc
> eval(f, [t = 1, c = 1/6, b = 1/3]);
√ √
6
1/6 3e− 3
6
Note that Maple stores only the most important facts about any given dis-
tribution in the data base. Everything else is calculated on the fly.
In the next set of examples we will define an abstract random variable
and calculate some quantities of interest.
X
Note, that X is a perfectly valid Maple object. It can be used as an argument
to Maple functions and can appear as a part of larger expressions. Just as
a simple test, let’s compute the mean and the variance of X
a, b2 .
Here is the 5th moment of X
International Statistical Institute, 56th Session, 2007: Alex Potapchik
15 b4 a + 10 b2 a3 + a5
We can also calculate the mean of X 2 :
> Mean(X^2);
a2 + b 2
For that matter, we can also calculate the whole density function of X 2
Similarly, we compute the density of ((X − a)/b) 2 and compare the result
with the χ2 -density.
2√ √
e−1/10 t 5 2
1/10 √
π
and their sum of squares
4 ALEX POTAPCHIK
(
0 t≤0
√ −1/2 t
t3/2 √
2e .
1/6 π
0<t
Again, it may be instructive to compare the result with a χ 2 density with 5
degrees of freedom:
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0.0
0.0 0.4 0.8 1.2 1.6 2.0 2.4 2.8 3.2 3.6 4.0
6 ALEX POTAPCHIK
Alternatively, the Sample command can return a Maple procedure which can
be used to generate random samples drawn from the normal distribution.
0.25
0.2
0.15
0.1
0.05
0.0
−4 −2 0 2 4 6 8 10 12 14 16 18 20
> U := RandomVariable(Bernoulli(1/5)):
> Z := U*X+(1-U)*Y:
0.25
0.2
0.15
0.1
0.05
0.0
−4 −2 0 2 4 6 8 10 12 14 16 18 20
References
[1] Karian, Z. A., and Tanis, E. A., Probability and Statistics: Explorations with MAPLE
(2nd ed.), 1999, New York: Wiley.
[2] Rose, C., and Smith, M. D., Mathematical Statistics and Mathematica, 2001, New
York: Springer-Verlag.
[3] Tanis, E., A Review of Maple V, Release 5, The American Statistician, 53, 1999,
389-392.
[4] Monagan, M., Geddes, K., Heal, M., Labahn, G., Vorkoetter, S., McCarron, J., and
DeMarco, P., Maple 10 Programming Guide, Maplesoft, 2005.