Page 90 - Computational Statistics Handbook with MATLAB
P. 90
76 Computational Statistics Handbook with MATLAB
Exercises
3.1. Generate 500 random samples from the standard normal distribution
for sample sizes of n = 2, 15, and 45. At each sample size, calculate
the sample mean for all 500 samples. How are the means distributed
as n gets large? Look at a histogram of the sample means to help
answer this question. What is the mean and variance of the sample
means for each n? Is this what you would expect from the Central
Limit Theorem? Here is some MATLAB code to get you started.
For each n:
% Generate 500 random samples of size n:
x = randn(n, 500);
% Get the mean of each sample:
xbar = mean(x);
% Do a histogram with superimposed normal density.
% This function is in the MATLAB Statistics Toolbox.
% If you do not have this, then just use the
% function hist instead of histfit.
histfit(xbar);
3.2. Repeat problem 3.1 for random samples drawn from a uniform dis-
tribution. Use the MATLAB function rand to get the samples.
of the parameter θ. The
3.3. We have two unbiased estimators T 1 and T 2
(
(
variances of the estimators are given by VT 2 ) = 8 and VT 1 ) = . 4
What is the MSE of the estimators? Which estimator is better and
why? What is the relative efficiency of the two estimators?
3.4. Repeat Example 3.1 using different sample sizes. What happens to
the coefficient of skewness and kurtosis as the sample size gets large?
3.5. Repeat Example 3.1 using samples generated from a standard normal
distribution. You can use the MATLAB function randn to generate
your samples. What happens to the coefficient of skewness and kur-
tosis as the sample size gets large?
3.6. Generate a random sample that is uniformly distributed over the
interval 01,( ). Plot the empirical distribution function over the inter-
val (-0.5, 1.5). There is also a function in the Statistics Toolbox called
cdfplot that will do this.
3.7. Generate a random sample of size 100 from a normal distribution
with mean 10 and variance of 2 (use randn(1,100)*sqrt(2)+10).
Plot the empirical cumulative distribution function. What is the value
of the empirical distribution function evaluated at a point less than
© 2002 by Chapman & Hall/CRC