Page 177 - Computational Statistics Handbook with MATLAB
P. 177
164 Computational Statistics Handbook with MATLAB
% Generate the bivariate normal random variables.
% Note: you could use csmvrnd to get these.
[u,s,v] = svd(covmat);
vsqrt = (v*(u'.*sqrt(s)))';
subdata = randn(20,2);
data = subdata*vsqrt;
% Close any open figure windows.
close all
% Create parallel plot using CS Toolbox function.
csparallel(data)
title('Correlation of 1')
This is shown in Figure 5.38. The direct linear relationship between the first
variable and the second variable is readily apparent. We can generate data
that are correlated differently by changing the covariance matrix. For exam-
ple, to obtain a random sample for data with a correlation of 0.2, we can use
covmat = [4 1.2; 1.2, 9];
In Figure 5.39, we show the parallel coordinates plot for data that have a cor-
relation coefficient of -1. Note the different structure that is visible in the par-
allel coordinates plot.
In the previous example, we showed how parallel coordinates can indicate
the relationship between variables. To provide further insight, we illustrate
how parallel coordinates can indicate clustering of variables in a dimension.
Figure 5.40 shows data that can be separated into clusters in both of the
dimensions. This is indicated on the parallel coordinate representation by
parallel axes. In Figure 5.41,
separation or groups of lines along the x 1 and x 2
, but
we have data that are separated into clusters in only one dimension, x 1
dimension. This appears in the parallel coordinates plot as a gap
not in the x 2
parallel axis.
in the x 1
As with Andrews curves, the order of the variables makes a difference.
Adjacent parallel axes provide some insights about the relationship between
consecutive variables. To see other pairwise relationships, we must permute
the order of the parallel axes. Wegman [1990] provides a systematic way of
finding all permutations such that all adjacencies in the parallel coordinate
display will be visited.
Before we proceed to other topics, we provide an example applying paral-
lel coordinates to the iris data. In Example 5.26, we illustrate a parallel
coordinates plot of the two classes: Iris setosa and Iris virginica.
Example 5.26
First we load up the iris data. An optional input argument of the
csparallel function is the line style for the lines. This usage is shown
© 2002 by Chapman & Hall/CRC