Page 190 - Computational Statistics Handbook with MATLAB
P. 190
Chapter 5: Exploratory Data Analysis 177
% For m random starts, find the best projection plane
% using N structure removal procedures.
% Two structures:
N = 2;
% Four random starts:
m = 4;
c = tan(80*pi/180);
% Number of steps with no increase.
half = 30;
We now set up some arrays to store the results of projection pursuit.
% To store the N structures:
astar = zeros(d,N);
bstar = zeros(d,N);
ppmax = zeros(1,N);
Next we have to sphere the data.
% Sphere the data.
[n,d] = size(X);
muhat = mean(X);
[V,D] = eig(cov(X));
Xc = X-ones(n,1)*muhat;
Z = ((D)^(-1/2)*V'*Xc')';
We use the sphered data as input to the function csppeda. The outputs from
this function are the vectors that span the plane containing the structure and
the corresponding value of the projection pursuit index.
% Now do the PPEDA.
% Find a structure, remove it,
% and look for another one.
Zt = Z;
for i = 1:N
[astar(:,i),bstar(:,i),ppmax(i)] =,...
csppeda(Zt,c,half,m);
% Now remove the structure.
Zt = csppstrtrem(Zt,astar(:,i),bstar(:,i));
end
Note that each column of astar and bstar contains the projections for a
structure, each one found using m random starts of the Posse algorithm. To
see the first structure and second structures, we project onto the best planes
as follows:
% Now project and see the structure.
proj1 = [astar(:,1), bstar(:,1)];
proj2 = [astar(:,2), bstar(:,2)];
Zp1 = Z*proj1;
© 2002 by Chapman & Hall/CRC