Introduction to Clustering Procedures

Elongated Multinormal Clusters

In this example, the data are sampled from two highly elongated multinormal distributions with equal covariance matrices. The following SAS statements produce Figure 11.18:

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 sgplot noautolegend;
   title 'FASTCLUS Analysis: Parallel Elongated Clusters';
   scatter y=y x=x / group=cluster;
   keylegend / location=inside position=topright sortorder=ascending
               across=1 noopaque title='';
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 these data.

Figure 11.18: Parallel Elongated Clusters: PROC FASTCLUS

Parallel Elongated Clusters: PROC FASTCLUS


The following SAS statements produce Figure 11.19:

proc cluster data=elongate outtree=tree method=average noprint;
run;

proc tree noprint out=out n=2 dock=5;
   copy x y;
run;

proc sgplot noautolegend;
   title 'Average Linkage Cluster Analysis: '
         'Parallel Elongated Clusters';
   scatter y=y x=x / group=cluster;
   keylegend / location=inside position=topright sortorder=ascending
               across=1 noopaque title='';
run;

Figure 11.19: Parallel Elongated Clusters: PROC CLUSTER METHOD=AVERAGE

Parallel Elongated Clusters: PROC CLUSTER METHOD=AVERAGE


The following SAS statements produce Figure 11.20:

proc cluster data=elongate outtree=tree method=twostage k=10 noprint;
run;

proc tree noprint out=out n=2;
   copy x y;
run;

proc sgplot noautolegend;
   title 'Two-Stage Density Linkage Cluster Analysis: '
         'Parallel Elongated Clusters';
   scatter y=y x=x / group=cluster;
   keylegend / location=inside position=topright sortorder=ascending
               across=1 noopaque title='';
run;

Figure 11.20: Parallel Elongated Clusters: PROC CLUSTER METHOD=TWOSTAGE

Parallel Elongated Clusters: PROC CLUSTER METHOD=TWOSTAGE


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 the 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 11.21 and Figure 11.22:

proc aceclus data=elongate out=ace p=.1;
   var x y;
   title 'ACECLUS Analysis: Parallel Elongated Clusters';
run;

proc sgplot noautolegend;
   title 'Data Containing Parallel Elongated Clusters';
   title2 'After Transformation by PROC ACECLUS';
   scatter y=can2 x=can1;
   xaxis label='Canonical Variable 1';
   yaxis label='Canonical Variable 2';
run;

Figure 11.21: Parallel Elongated Clusters: PROC ACECLUS

ACECLUS Analysis: Parallel Elongated Clusters

The ACECLUS Procedure
 
Approximate Covariance Estimation for Cluster Analysis

Observations100Proportion0.1000
Variables2Converge0.00100

Means and Standard Deviations
VariableMeanStandard
Deviation
x2.64068.3494
y10.64886.8420

COV: Total Sample Covariances
 xy
x69.7131481924.24268934
y24.2426893446.81324861


Initial Within-Cluster Covariance Estimate = Full Covariance Matrix

Threshold =0.328478

Iteration History
IterationRMS
Distance
Distance
Cutoff
Pairs
Within
Cutoff
Convergence
Measure
12.0000.657672.00.673685
29.3823.082716.00.006963
39.3393.068760.00.008362
49.4373.100824.00.009656
59.3593.074889.00.010269
69.2673.044955.00.011276
79.2083.025999.00.009230
89.2303.0321052.00.011394
99.2263.0301091.00.007924
109.1733.0131121.00.007993

WARNING: Iteration limit exceeded.

ACE: Approximate Covariance Estimate
Within Clusters
 xy
x9.2993296328.215362614
y8.2153626148.937753936

Eigenvalues of Inv(ACE)*(COV-ACE)
 EigenvalueDifferenceProportionCumulative
136.709133.16720.91200.9120
23.5420 0.08801.0000

Eigenvectors (Raw Canonical
Coefficients)
 Can1Can2
x-.7483920.109547
y0.7363490.230272

Standardized Canonical
Coefficients
 Can1Can2
x-6.248660.91466
y5.038121.57553


Figure 11.22: Parallel Elongated Clusters after Transformation by PROC ACECLUS

Parallel Elongated Clusters after Transformation by PROC ACECLUS


The following SAS statements produce Figure 11.23:

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 sgplot noautolegend;
   title 'Ward''s Minimum Variance Cluster Analysis: '
         'Parallel Elongated Clusters';
   title2 'After Transformation by PROC ACECLUS';
   scatter y=y x=x / group=cluster;
   keylegend / location=inside position=topright sortorder=ascending
               across=1 noopaque title='';
run;

Figure 11.23: Transformed Data Containing Parallel Elongated Clusters: PROC CLUSTER METHOD=WARD

Transformed Data Containing Parallel Elongated Clusters: PROC CLUSTER METHOD=WARD