Page 200 - Computational Statistics Handbook with MATLAB
P. 200
Chapter 5: Exploratory Data Analysis 187
Exercises
5.1. Generate a sample of 1000 univariate standard normal random vari-
ables using randn. Construct a frequency histogram, relative fre-
quency histogram, and density histogram. For the density histogram,
superimpose the corresponding theoretical probability density func-
tion. How well do they match?
5.2. Repeat problem 5.1 for random samples generated from the exponen-
tial, gamma, and beta distributions.
5.3. Do a quantile plot of the Tibetan skull data of Example 5.3 using the
standard normal quantiles. Is it reasonable to assume the data follow
a normal distribution?
5.4. Try the following MATLAB code using the 3-D multivariate normal
as defined in Example 5.18. This will create a slice through the volume
at an arbitrary angle. Notice that the colors indicate a normal distri-
bution centered at the origin with the covariance matrix equal to the
identity matrix.
% Draw a slice at an arbitrary angle
hs = surf(linspace(-3,3,20),...
linspace(-3,3,20),zeros(20));
% Rotate the surface :
rotate(hs,[1,-1,1],30)
% Get the data that will define the
% surface at an arbitrary angle.
xd = get(hs,'XData');
yd = get(hs,'YData');
zd = get(hs,'ZData');
delete(hs)
% Draw slice:
slice(x,y,z,prob,xd,yd,zd)
axis tight
% Now plot this using the peaks surface as the slice.
% Try plotting against the peaks surface
[xd,yd,zd] = peaks;
slice(x,y,z,prob,xd,yd,zd)
axis tight
5.5. Repeat Example 5.23 using the data for Iris virginica and Iris versicolor.
Do the Andrews curves indicate separation between the classes? Do
you think it will be difficult to separate these classes based on these
features?
5.6. Repeat Example 5.4, where you generate random variables such that
© 2002 by Chapman & Hall/CRC