|
Chapter Contents |
Previous |
Next |
| Introduction to Clustering Procedures |
In this example, the data are sampled from two highly elongated multinormal distributions with equal covariance matrices. The following SAS statements produce Figure 8.16:
data elongate;
keep x y;
ma=8; mb=0; link generate;
ma=6; mb=8; link generate;
stop;
generate:
do i=1 to 50;
a=rannor(7)*6+ma;
b=rannor(7)+mb;
x=a-b;
y=a+b;
output;
end;
return;
run;
proc fastclus data=elongate out=out maxc=2 noprint;
run;
proc gplot;
plot y*x=cluster/frame cframe=ligr
vaxis=axis1 haxis=axis2 legend=legend1;
title 'FASTCLUS Analysis';
title2 'of Data Containing Parallel Elongated Clusters';
run;
Notice that PROC FASTCLUS found two clusters, as requested by the MAXC= option. However, it attempted to form spherical clusters, which are obviously inappropriate for this data.
|
The following SAS statements produce Figure 8.17:
proc cluster data=elongate outtree=tree
method=average noprint;
run;
proc tree noprint out=out n=2 dock=5;
copy x y;
run;
proc gplot;
plot y*x=cluster/frame cframe=ligr
vaxis=axis1 haxis=axis2 legend=legend1;
title 'Average Linkage Cluster Analysis';
title2 'of Data Containing Parallel Elongated Clusters';
run;
|
The following SAS statements produce Figure 8.18:
proc cluster data=elongate outtree=tree
method=twostage k=10 noprint;
run;
proc tree noprint out=out n=2;
copy x y;
run;
proc gplot;
plot y*x=cluster/frame cframe=ligr
vaxis=axis1 haxis=axis2 legend=legend1;
title 'Two-Stage Density Linkage Cluster Analysis';
title2 'of Data Containing Parallel Elongated Clusters';
run;
|
PROC FASTCLUS and average linkage fail miserably. Ward's method and the centroid method, not shown, produce almost the same results. Two-stage density linkage, however, recovers the correct clusters. Single linkage, not shown, finds the same clusters as two-stage density linkage except for some outliers.
In this example, the population clusters have equal covariance matrices. If the within-cluster covariances are known, the data can be transformed to make the clusters spherical so that any of the clustering methods can find the correct clusters. But when you are doing a cluster analysis, you do not know what the true clusters are, so you cannot calculate the within-cluster covariance matrix. Nevertheless, it is sometimes possible to estimate the within-cluster covariance matrix without knowing the cluster membership or even the number of clusters, using an approach invented by Art, Gnanadesikan, and Kettenring (1982). A method for obtaining such an estimate is available in the ACECLUS procedure.
In the following analysis, PROC ACECLUS transforms the variables X and Y into canonical variables CAN1 and CAN2. The latter are plotted and then used in a cluster analysis by Ward's method. The clusters are then plotted with the original variables X and Y. The following SAS statements produce Figure 8.19:
proc aceclus data=elongate out=ace p=.1;
var x y;
title 'ACECLUS Analysis';
title2 'of Data Containing Parallel Elongated Clusters';
run;
proc gplot;
plot can2*can1/frame cframe=ligr;
title 'Data Containing Parallel Elongated Clusters';
title2 'After Transformation by PROC ACECLUS';
run;
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The following SAS statements produce Figure 8.21:
proc cluster data=ace outtree=tree method=ward noprint;
var can1 can2;
copy x y;
run;
proc tree noprint out=out n=2;
copy x y;
run;
proc gplot;
plot y*x=cluster/frame cframe=ligr
vaxis=axis1 haxis=axis2 legend=legend1;
title 'Ward''s Minimum Variance Cluster Analysis';
title2 'of Data Containing Parallel Elongated Clusters';
title3 'After Transformation by PROC ACECLUS';
run;
|
|
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.