dm 'log;clear;output;clear;'; options ps=50 ls=60 pageno=1; goptions reset=global border ftext=swiss gunit=cm htext=0.4 htitle=0.5; goptions display noprompt; **********************************************************************; ** **; ** AUTHOR: Chris Bilder **; ** COURSE: STAT 873 **; ** DATE: 11-30-03 **; ** PURPOSE: 4 observations example in chapter 9 notes **; ** **; ** NOTES: **; ** **; **********************************************************************; title1 'Chris Bilder, STAT 873'; data set1; input obs X1 X2; datalines; 1 2 3.4 2 4 5 3 6 3 4 4 2 ; run; *****************************************************************************; * K-means clustering; title2 'K-means clustering'; proc fastclus data=set1 maxclusters=2 OUT=out_set1 list OUTITER OUTSEED=temp RANDOM=1234 REPLACE=RANDOM; var x1 x2; run; *Different clusters! title2 'K-means clustering'; proc fastclus data=set1 maxclusters=2 OUT=out_set1 list OUTITER OUTSEED=temp RANDOM=1235 REPLACE=RANDOM maxiter=3; var x1 x2; run; *goptions reset=global; *Scatter plot of the first two principal components; proc gplot data=out_set1; plot x2*x1=cluster / vaxis=axis1 haxis=axis2 frame grid vref=0 href=0 cvref=green chref=green; title2 "X2 vs. X1"; symbol1 v=dot h=0.25 cv=blue; symbol2 v=square h=0.25 cv=red; symbol3 v=circle h=0.25 cv=green; symbol4 v=square h=0.25 cv=purple; symbol5 v=star h=0.25 cv=black; axis1 label = (a=90 'X2') length = 12; axis2 label = ('X1') length = 12; run; quit;