Math 46 --- Spring 2000 Last Update: April 21, 2000

Starting the statatistics package in Maple. In Windows NT Explorer, double-click on the file

G:\Maple V Release 5.1 - Server\bin.wnt\wmaple.exe

This Maple worksheet is named tank_lab_0427.mws and is located in

P:\data\math\jones\Math 46

This program will allow you to see and compare the actual performance of the estimators you

derived in the theoretical portion of this lab. Particularly, you are to:

1. Fill in the Maple code below for the calculations of the expectations and variances of the

estimators U, T , and V that you derived in the theoretical development portion of the lab. I have

preset all of these theoretical values to 100 (see below).

2. You should run this program for at least two values of N , and for each N , at least two values

of n . So you should run at least four simulations. Feel free to run more. For each simulation

you should:

--- compare the performance of the three estimators in estimating the true value of N

--- compare the sample means and variances of the estimators with the theoretical ones

you derived in the theoretical development

--- discuss the effects of N and n on estimator performance

3. Do your findings in this simulation reinforce your answer in Problem 15 in the

theoretical development? Explain.

> restart;

Initialize the number of tanks in the enemy army, N .

> N:=700;

[Maple Math]

Enter the number of tanks you will sample, n .

> n:=8;

[Maple Math]

Enter the number of samples of size n you would like to draw, call this R .

> R:=1000;

[Maple Math]

Simulate R samples of size n from Uniform{1,2,...., N }

> S:=[seq(DiscUniformS(1..N,n),i=1..R)]:

Take a peek at a few samples .....

> S[1];

[Maple Math]

> S[2];

[Maple Math]

> S[R];

[Maple Math]

Form the collection of R values of the estimator U .

> set_of_U:=[seq(evalf(2*Mean(S[i])-1,6),i=1..R)]:

Form the collection of R values of the estimator T .

> set_of_T:=[seq(evalf(Max(S[i]),6),i=1..R)]:

Form the collection of R values of the estimator V .

> set_of_V:=[seq(evalf(((n+1)/n)*Max(S[i]),6),i=1..R)]:

Take a look at the sampling distribution of the estimator U .

> Histogram(set_of_U,10..2*N,20);

[Maple Plot]

Take a look at the sampling distribution of the estimator T.

> Histogram(set_of_T,10..2*N,20);

[Maple Plot]

Take a look at the sampling distribution of the estimator V .

> Histogram(set_of_V,10..2*N,20);

[Maple Plot]

Calculate the sample average of the R values of the estimators U, T, V .

> Mean(set_of_U);

> Mean(set_of_T);

> Mean(set_of_V);

[Maple Math]

[Maple Math]

[Maple Math]

Now calculate the mean of your estimators U, T, V , as predicted by your theoretical development.

> theory_mean_U:=100;

> theory_mean_T:=100;

> theory_mean_V:=100;

[Maple Math]

[Maple Math]

[Maple Math]

Calculate the sample variance of the R values of the estimators U, T, V .

> Variance(set_of_U);

> Variance(set_of_T);

> Variance(set_of_V);

[Maple Math]

[Maple Math]

[Maple Math]

Now calculate the variance of your estimators U, T, V , as predicted by your theoretical development.

> theory_variance_U:=100;

> theory_variance_T:=100;

> theory_variance_V:=100;

[Maple Math]

[Maple Math]

[Maple Math]

Make a boxplot of the R values of U, T , and V .

> BoxWhisker(set_of_U,set_of_T,set_of_V);

[Maple Plot]