Page 325 - Computational Statistics Handbook with MATLAB
P. 325
314 Computational Statistics Handbook with MATLAB
Exercises
8.1. Create a MATLAB function that will return the value of the histogram
estimate for the probability density function. Do this for the 1-D case.
8.2. Generate a random sample of data from a standard normal. Construct
a kernel density estimate of the probability density function and verify
that the area under the curve is approximately 1 using trapz.
8.3. Generate 100 univariate normals and construct a histogram. Calculate
using Monte Carlo simulation. Do this for
the MSE at a point x 0
varying bin widths. What is the better bin width? Does the sample
is in the tails or
size make a difference? Does it matter whether x 0
closer to the mean? Repeat this experiment using the absolute error.
Are your conclusions similar?
8.4. Generate univariate normal random variables. Using the Normal Ref-
erence Rules for h, construct a histogram, a frequency polygon and a
using
kernel estimate of the data. Estimate the MSE at a point x 0
Monte Carlo simulation.
8.5. Generate a random sample from the exponential distribution. Con-
struct a histogram using the Normal Reference Rule. Using Monte
Carlo simulation, estimate the MISE. Use the skewness factor to adjust
h and re-estimate the MISE. Which window width is better?
8.6. Use the snowfall data and create a MATLAB movie that shows
how 1-D histograms change with bin width. See help on movie for
information on how to do this. Also make a movie showing how
changing the bin origin affects the histogram.
8.7. Repeat Example 8.2 for bin widths given by the Freedman-Diaconis
Rule. Is there a difference in the results? What does the histogram
look like if you use Sturge’s Rule?
8.8. Write a MATLAB function that will return the value of a bivariate
histogram at a point, given the bin counts, the sample size, and the
window widths.
8.9. Write a MATLAB function that will evaluate the cumulative distribu-
tion function for a univariate frequency polygon. You can use the
trapz, quad, or quadl functions.
8.10. Load the iris data. Create a 150 × 2 matrix by concatenating the
first two columns of each species. Construct and plot a frequency
polygon of these data. Do the same thing for all possible pairs of
columns. You might also look at a contour plot of the frequency
polygons. Is there evidence of groups in the plots?
© 2002 by Chapman & Hall/CRC

