Using MAPLE for

Visualization, Manipulation,

and Simulation

"A Brief Course in Mathematical Statistics"

by

Elliot A. Tanis

Robert V. Hogg

June, 2006

Prepared by

Elliot A.Tanis

Department of Mathematics
Hope College
Holland, MI  49422-9000

tanis@hope.edu

http://www.math.hope.edu/tanis

A Computer Algebra System (CAS) such as MAPLE can be used to manipulate symbols. The graphical capability of a CAS can help students visualize expressions that are manipulated symbolically. A CAS can also be used to do numerical calculations. Simulation can be incorporated in a variety of applications.

Here are several examples from the text that illustrate ways for using MAPLE for visualization, manipulation, and simulation.

The statistics package that comes with MAPLE is not complete. However, Zaven Karian has written more than 130 additional procedures to support instruction in probability and statistics. These procedures are included on this CD-ROM.

To get started, click on the following command line to load the supplementary statistics package as well as some other procedures that will be used.

NOTE: In order to read the supplementary procedures, you must specify where they are. They are in a file called "Maple Examples" on this CD-ROM. An easy way to use the supplementary procedures is to first copy the "Maple Examples" folder from the CD-ROM into a new folder on the C drive. The programs are set up assuming that they have been copied into a folder where "Tanis-Hogg" is the name of the folder. If you do the same, all of the commands should work. Maple should first be loaded and then these programs should be pulled in.

NOTE: When running these programs successively, definitions of variables in one program could have an adverse effect on same named variables in a succeeding program. If this is the case, reload the programs, beginning with the "restart" command.

In summary, copy the "Maple Examples" folder into a folder on the C-drive of  your computer that is named "Tanis-Hogg" and run the Maple examples from there after Maple has first been loaded.

 >

[Example 3.1-5] Illustrates stem-and-leaf and box plot procedures. Solution

Given random samples of sizes n and m from independent normal distributions, when does

have a t-distribution with  n + m - 2  degrees of freedom?

The simulations in this section can take a long time so the results of a simulation are included in the output. However, you may replicate the simulations.

2. Let n = 6, m = 18, , , , and .  Solution

3. Let n = 12, m = 12, , , , and .  Solution

4. (Figure 4.2-3) Let n = 18, m = 6, ,  ,  , and .  Solution

[Example 5.2-2] Find the mean, variance and standard deviation of a b(n, p) random variable. Solution

[Example 5.2-3] Find the mean, variance, and standard deviation of a Poisson random variable.   Solution

[Expanded Example 5.2-3] This program finds the mean and variance of a Poisson random variable plus the third and fourth moments. It finds the mean and variance of X-bar and  and illustrates that these are correct using simulation. It also fits a normal curve to the Poisson p.m.f.  Solution

[Example 5.2-4] Find the mean, variance, and standard deviation of a negative binomial random variable.   Solution

[Example 5.2-5] Find the mean, variance, and standard deviation of a hypergeometric random variable.   Solution

[Example 5.2-6] Find percentiles for the Weibull distribution.   Solution

[Example 5.2-7] Find characteristics of the exponential distribution with .  Solution

[Example 5.2-8] Find characteristics of the gamma distribution.  Solution

[Example 5.2-9] Find the mean and variance of a discrete distribution.  Solution

[Example 5.2-10] Find the mean, variance, and standard deviation of a normally distributed random variable, N(a, b^2), showing that  and . Solution

[Example 5.2-11] The solution of two equations for two unknowns.  Solution

[Example 5.2-12] Find the p.d.f. of a T random variable.   Solution

[Example 5.2-13] Find the p.d.f. of an F random variable. Solution

[Example 5.2-14] Find the p.d.f. of a beta random variable. Solution

[Exercise 5.2-2(b) and (c)] Find the p.d.f. of a U-shaped p.d.f. and a beta p.d.f. Solution

[Exercise 5.2-3] Finding the distribution of the ratio of two independent standard normal                random variables. Solution

[Exercise 5.2-4] Finding the distribution of the sample mean when sampling from a Cauchy distribution.  Solution

[Exercise 5.2-6] An exercise using the logistic distributuion.  Solution

[Exercise 5.2-8] Find the p.d.f. of  when X has a Cauchy distribution. Solution

[Example 5.3-3] (Expanded) Histograms of 10,000 sample means of samples of sizes 1, 2, 3, 4, 5, 6 from the U(0, 1) distribution. Solution

[Exercise 5.3-4] A simulation illustrating the Central Limit Theorem.  Solution

[Exercise 5.3-6] The Cauchy distribution.  Solution

[Exercise 5.3-8] Craps.  Solution

[Exercise 5.3-10] Estimation of population sizes.  Solution

[Exercise 5.3-11] Illustration of confidence intervals when assumptions are not satisfied. Solution

[Exercise 5.3-12] Does T have a t-distribution when sampling from non-normal distributions? Solution

[Exercise 5.3-14] Simulations of a  random variable.  Solution

[Exercise 5.3-15] A simulation to illustrate the Box-Muller transformation. Solution

[Exercise 5.3-16] (Note that this exercise does not exist. But this simulation is based on the material at the end of Section 5.3.) A simulation from the bivariate normal distribution with means 5.8 and 5.3, standard deviations 0.2 and 0.2 and correlation coefficient 0.6. Solution

[Figures 5.4-2 and 5.4-3] T observations from an exponential distribution. Solution

[Exercise 5.4-4] Simulations to estimate the distribution of R using Old Faithful data. Solution

[Exercise 5.4-6] Simulations to estimate the distribution of R using paired exponential data. Solution

It is possible to approximate binomial probabilities using the Poisson distribution. This is proved by showing that the limit of the binomial moment-generating function converges to the Poisson moment-generating function. A proof of the Central Limit Theorem involves the limit of moment-generating functions converging to the N(0, 1) moment-generating function.

2. [Figure 6.3-2] Let , ...,   be a random sample of size n from an exponential distribution with mean

3. [Figure 6.3-3] Let , ...,   be a random sample of size n from a U-shaped distribution with p.d.f.  ,   < x < 1.  Show that the moment-generating function of

=

Acknowledgements

These materials have been developed during the past several years. I would like to thank some of the people who have made a variety of contributions.

Zaven Karian from Denison University did the major development of the MAPLE procedures that are used. In fact, he has developed approximately 130 procedures that supplement the MAPLE V Computer Algebra System. They are available as a MAPLE package. For more information contact him at  Karian@Denison.edu  or see his web page: http://www.dension.edu/mathsci/faculty/karian, or better yet, go to Waterloo MAPLE to download the supplement from the following web page:

http://www.mapleapps.com/powertools/statisticssupplement/stats_supplement.shtml

Exercises have been written for a year long course in mathematical statistics and probability and are published in "PROBABILITY and STATISTICS: EXPLORATIONS WITH MAPLE", second edition,  that was written by Zaven A. Karian and Elliot A. Tanis, published by Prentice Hall, 1999.

As a part of our computer based laboratory that currently uses MAPLE, many Hope College students have contributed to my understanding of MAPLE and the way it can be used for solving a variety of problems. In particular, Hope College students Bryan Goodman, Joshua Levy, John Krueger, and Michael Van Opstall have been very helpful and I thank them for their contributions.