Syntax


The following statements are available in the CLUSTER procedure.

  • PROC CLUSTER METHOD = name < options > ;

    • BY variables ;

    • COPY variables ;

    • FREQ variable ;

    • ID variable ;

    • RMSSTD variable ;

    • VAR variables ;

Only the PROC CLUSTER statement is required, except that the FREQ statement is required when the RMSSTD statement is used; otherwise the FREQ statement is optional. Usually only the VAR statement and possibly the ID and COPY statements are needed in addition to the PROC CLUSTER statement. The rest of this section provides detailed syntax information for each of the preceding statements, beginning with the PROC CLUSTER statement. The remaining statements are covered in alphabetical order.

PROC CLUSTER Statement

  • PROC CLUSTER METHOD=name < options > ;

The PROC CLUSTER statement starts the CLUSTER procedure, identifies a clustering method, and optionally identifies details for clustering methods, data sets, data processing, and displayed output. The METHOD= specification determines the clustering method used by the procedure. Any one of the following 11 methods can be specified for name :

AVERAGE AVE

requests average linkage (group average, unweighted pair- group method using arithmetic averages, UPGMA). Distance data are squared unless you specify the NOSQUARE option.

CENTROID CEN

requests the centroid method (unweighted pair-group method using centroids, UPGMC, centroid sorting, weighted-group method). Distance data are squared unless you specify the NOSQUARE option.

COMPLETE COM

requests complete linkage (furthest neighbor, maximum method, diameter method, rank order typal analysis). To reduce distortion of clusters by outliers, the TRIM= option is recommended.

DENSITY DEN

requests density linkage, which is a class of clustering methods using nonparametric probability density estimation. You must also specify one of the K=, R=, or HYBRID options to indicate the type of density estimation to be used. See also the MODE= and DIM= options in this section.

EML

requests maximum- likelihood hierarchical clustering for mixtures of spherical multivariate normal distributions with equal variances but possibly unequal mixing proportions . Use METHOD=EML only with coordinate data. See the PENALTY= option on page 971. The NONORM option does not affect the reported likelihood values but does affect other unrelated criteria. The EML method is much slower than the other methods in the CLUSTER procedure.

FLEXIBLE FLE

requests the Lance-Williams flexible-beta method. See the BETA= option in this section.

MCQUITTY MCQ

requests McQuitty s similarity analysis, which is weighted average linkage, weighted pair-group method using arithmetic averages (WPGMA).

MEDIAN MED

requests Gower s median method, which is weighted pair-group method using centroids (WPGMC). Distance data are squared unless you specify the NOSQUARE option.

SINGLE SIN

requests single linkage ( nearest neighbor, minimum method, connectedness method, elementary linkage analysis, or dendritic method). To reduce chaining, you can use the TRIM= option with METHOD=SINGLE.

TWOSTAGE TWO

requests two-stage density linkage. You must also specify the K=, R=, or HYBRID option to indicate the type of density estimation to be used. See also the MODE= and DIM= options in this section.

WARD WAR

requests Ward s minimum-variance method (error sum of squares, trace W). Distance data are squared unless you specify the NOSQUARE option. To reduce distortion by outliers, the TRIM= option is recommended. See the NONORM option.

The following table summarizes the options in the PROC CLUSTER statement.

Tasks

Options

Specify input and output data sets

 

specify input data set

DATA=

 

create output data set

OUTTREE=

Specify clustering methods

 

specify clustering method

METHOD=

 

beta for flexible beta method

BETA=

 

minimum number of members for modal clusters

MODE=

 

penalty coefficient for maximum-likelihood

PENALTY=

 

Wong s hybrid clustering method

HYBRID

Control data processing prior to clustering

 

suppress computation of eigenvalues

NOEIGEN

 

suppress normalizing of distances

NONORM

 

suppress squaring of distances

NOSQUARE

 

standardize variables

STANDARD

 

omit points with low probability densities

TRIM=

Control density estimation

 

dimensionality for estimates

DIM=

 

number of neighbors for k th-nearest-neighbor

K=

 

radius of sphere of support for uniform-kernel

R=

Suppress checking for ties

NOTIE

Control display of the cluster history

 

display cubic clustering criterion

CCC

 

suppress display of ID values

NOID

 

specify number of generations to display

PRINT=

 

display pseudo F and t 2 statistics

PSEUDO

 

display root-mean-square standard deviation

RMSSTD

 

display R 2 and semipartial R 2

RSQUARE

Control other aspects of output

 

suppress display of all output

NOPRINT

 

display simple summary statistics

SIMPLE

The following list provides details on these options.

BETA = n

  • specifies the beta parameter for METHOD=FLEXIBLE. The value of n should be less than 1, usually between 0 and ˆ’ 1. By default, BETA= ˆ’ . 25. Milligan (1987) suggests a somewhat smaller value, perhaps ˆ’ . 5, for data with many outliers.

CCC

  • displays the cubic clustering criterion and approximate expected R 2 under the uniform null hypothesis (Sarle 1983). The statistics associated with the RSQUARE option, R 2 and semipartial R 2 , are also displayed. The CCC option applies only to coordinate data. The CCC option is not appropriate with METHOD=SINGLE because of the method s tendency to chop off tails of distributions.

DATA =SAS-data-set

  • names the input data set containing observations to be clustered. By default, the procedure uses the most recently created SAS data set. If the data set is TYPE=DISTANCE, the data are interpreted as a distance matrix; the number of variables must equal the number of observations in the data set or in each BY group. The distances are assumed to be Euclidean, but the procedure accepts other types of distances or dissimilarities. If the data set is not TYPE=DISTANCE, the data are interpreted as coordinates in a Euclidean space, and Euclidean distances are computed. For more on TYPE=DISTANCE data sets, see Appendix A, Special SAS Data Sets.

    You cannot use a TYPE=CORR data set as input to PROC CLUSTER, since the procedure uses dissimilarity measures. Instead, you can use a DATA step or the IML procedure to extract the correlation matrix from a TYPE=CORR data set and transform the values to dissimilarities such as 1 ˆ’ r or 1 ˆ’ r 2 , where r is the correlation.

    All methods produce the same results when used with coordinate data as when used with Euclidean distances computed from the coordinates. However, the DIM= option must be used with distance data if you specify METHOD=TWOSTAGE or METHOD=DENSITY or if you specify the TRIM= option.

    Certain methods that are most naturally defined in terms of coordinates require squared Euclidean distances to be used in the combinatorial distance formulas (Lance and Williams 1967). For this reason, distance data are automatically squared when used with METHOD=AVERAGE, METHOD=CENTROID, METHOD=MEDIAN, or METHOD=WARD. If you want the combinatorial formulas to be applied to the (unsquared) distances with these methods, use the NOSQUARE option.

DIM =n

  • specifies the dimensionality used when computing density estimates with the TRIM= option, METHOD=DENSITY, or METHOD=TWOSTAGE. The values of n must be greater than or equal to 1. The default is the number of variables if the data are coordinates; the default is 1 if the data are distances.

HYBRID

  • requests Wong s (1982) hybrid clustering method in which density estimates are computed from a preliminary cluster analysis using the k -means method. The DATA= data set must contain means, frequencies, and root-mean-square standard deviations of the preliminary clusters (see the FREQ and RMSSTD statements). To use HYBRID, you must use either a FREQ statement or a DATA= data set that contains a _FREQ_ variable, and you must also use either an RMSSTD statement or a DATA= data set that contains a _RMSSTD_ variable.

    The MEAN= data set produced by the FASTCLUS procedure is suitable for input to the CLUSTER procedure for hybrid clustering. Since this data set contains _FREQ_ and _RMSSTD_ variables, you can use it as input and then omit the FREQ and RMSSTD statements.

    You must specify either METHOD=DENSITY or METHOD=TWOSTAGE with the HYBRID option. You cannot use this option in combination with the TRIM=, K=, or R= option.

K =n

  • specifies the number of neighbors to use for k th-nearest-neighbor density estimation (Silverman 1986, pp. 19 “21 and 96 “99). The number of neighbors ( n ) must be at least two but less than the number of observations. See the MODE= option, which follows .

    If you request an analysis that requires density estimation (the TRIM= option, METHOD=DENSITY, or METHOD=TWOSTAGE), you must specify one of the K=, HYBRID, or R= options.

MODE =n

  • specifies that, when two clusters are joined, each must have at least n members for either cluster to be designated a modal cluster. If you specify MODE=1, each cluster must also have a maximum density greater than the fusion density for either cluster to be designated a modal cluster.

    Use the MODE= option only with METHOD=DENSITY or METHOD=TWOSTAGE. With METHOD=TWOSTAGE, the MODE= option affects the number of modal clusters formed . With METHOD=DENSITY, the MODE= option does not affect the clustering process but does determine the number of modal clusters reported on the output and identified by the _MODE_ variable in the output data set.

    If you specify the K= option, the default value of MODE= is the same as the value of K= because the use of k th-nearest-neighbor density estimation limits the resolution that can be obtained for clusters with fewer than k members. If you do not specify the K= option, the default is MODE=2.

    If you specify MODE=0, the default value is used instead of 0.

    If you specify a FREQ statement or if a _FREQ_ variable appears in the input data set, the MODE= value is compared with the number of actual observations in the clusters being joined, not with the sum of the frequencies in the clusters.

NOEIGEN

  • suppresses computation of eigenvalues for the cubic clustering criterion. Specifying the NOEIGEN option saves time if the number of variables is large, but it should be used only if the variables are nearly uncorrelated or if you are not interested in the cubic clustering criterion. If you specify the NOEIGEN option and the variables are highly correlated, the cubic clustering criterion may be very liberal . The NOEIGEN option applies only to coordinate data.

NOID

  • suppresses the display of ID values for the clusters joined at each generation of the cluster history.

NONORM

  • prevents the distances from being normalized to unit mean or unit root mean square with most methods. With METHOD=WARD, the NONORM option prevents the between-cluster sum of squares from being normalized by the total sum of squares to yield a squared semipartial correlation. The NONORM option does not affect the reported likelihood values with METHOD=EML, but it does affect other unrelated criteria, such as the _DIST_ variable.

NOPRINT

  • suppresses the display of all output. Note that this option temporarily disables the Output Delivery System (ODS). For more information, see Chapter 14, Using the Output Delivery System.

NOSQUARE

  • prevents input distances from being squared with METHOD=AVERAGE, METHOD=CENTROID, METHOD=MEDIAN, or METHOD=WARD.

    If you specify the NOSQUARE option with distance data, the data are assumed to be squared Euclidean distances for computing R-squared and related statistics defined in a Euclidean coordinate system.

    If you specify the NOSQUARE option with coordinate data with METHOD=CENTROID, METHOD=MEDIAN, or METHOD=WARD, then the combinatorial formula is applied to unsquared Euclidean distances. The resulting cluster distances do not have their usual Euclidean interpretation and are, therefore, labeled False in the output.

NOTIE

  • prevents PROC CLUSTER from checking for ties for minimum distance between clusters at each generation of the cluster history. If your data are measured with such sufficient precision that ties are unlikely , then you can specify the NOTIE option to reduce slightly the time and space required by the procedure. See the section Ties on page 987.

OUTTREE= SAS-data-set

  • creates an output data set that can be used by the TREE procedure to draw a tree diagram. You must give the data set a two-level name to save it. Refer to SAS Language Reference: Concepts for a discussion of permanent data sets. If you omit the OUTTREE= option, the data set is named using the DATA n convention and is not permanently saved. If you do not want to create an output data set, use OUTTREE=_NULL_.

PENALTY= p

PRINT= n P= n

  • specifies the number of generations of the cluster history to display. The P= option displays the latest n generations; for example, P=5 displays the cluster history from 1 cluster through 5 clusters. The value of P= must be a nonnegative integer. The default is to display all generations. Specify PRINT=0 to suppress the cluster history.

PSEUDO

  • displays pseudo F and t 2 statistics. This option is effective only when the data are coordinates or when METHOD=AVERAGE, METHOD=CENTROID, or METHOD=WARD. See the section Miscellaneous Formulas on page 984. The PSEUDO option is not appropriate with METHOD=SINGLE because of the method s tendency to chop off tails of distributions.

R= n

  • specifies the radius of the sphere of support for uniform-kernel density estimation (Silverman 1986, pp. 11 “13 and 75 “94). The value of R= must be greater than zero.

    If you request an analysis that requires density estimation (the TRIM= option, METHOD=DENSITY, or METHOD=TWOSTAGE), you must specify one of the K=, HYBRID, or R= options.

RMSSTD

  • displays the root-mean-square standard deviation of each cluster. This option is effective only when the data are coordinates or when METHOD=AVERAGE, METHOD=CENTROID, or METHOD=WARD. See the section Miscellaneous Formulas on page 984.

RSQUARE RSQ

  • displays the R 2 and semipartial R 2 . This option is effective only when the data are coordinates or when METHOD=AVERAGE or METHOD=CENTROID. The R 2 and semipartial R 2 statistics are always displayed with METHOD=WARD. See the section Miscellaneous Formulas on page 984.

SIMPLE S

  • displays means, standard deviations, skewness , kurtosis , and a coefficient of bimodality. The SIMPLE option applies only to coordinate data. See the section Miscellaneous Formulas on page 984.

STANDARD STD

  • standardizes the variables to mean 0 and standard deviation 1. The STANDARD option applies only to coordinate data.

TRIM= p

  • omits points with low estimated probability densities from the analysis. Valid values for the TRIM= option are 0 p < 100. If p < 1, then p is the proportion of observations omitted. If p 1, then p is interpreted as a percentage. A specification of TRIM=10, which trims 10 percent of the points, is a reasonable value for many data sets. Densities are estimated by the k th-nearest-neighbor or uniform-kernel methods. Trimmed points are indicated by a negative value of the _FREQ_ variable in the OUTTREE= data set.

    You must use either the K= or R= option when you use TRIM=. You cannot use the HYBRID option in combination with TRIM=, so you may want to use the DIM= option instead. If you specify the STANDARD option in combination with TRIM=, the variables are standardized both before and after trimming.

    The TRIM= option is useful for removing outliers and reducing chaining. Trimming is highly recommended with METHOD=WARD or METHOD=COMPLETE because clusters from these methods can be severely distorted by outliers. Trimming is also valuable with METHOD=SINGLE since single linkage is the method most susceptible to chaining. Most other methods also benefit from trimming. However, trimming is unnecessary with METHOD=TWOSTAGE or METHOD=DENSITY when k th-nearest-neighbor density estimation is used.

    Use of the TRIM= option may spuriously inflate the cubic clustering criterion and the pseudo F and t 2 statistics. Trimming only outliers improves the accuracy of the statistics, but trimming saddle regions between clusters yields excessively large values.

BY Statement

  • BY variables ;

You can specify a BY statement with PROC CLUSTER to obtain separate analyses on observations in groups defined by the BY variables. When a BY statement appears, the procedure expects the input data set to be sorted in order of the BY variables.

If your input data set is not sorted in ascending order, use one of the following alternatives:

  • Sort the data using the SORT procedure with a similar BY statement.

  • Specify the BY statement option NOTSORTED or DESCENDING in the BY statement for the CLUSTER procedure. The NOTSORTED option does not mean that the data are unsorted but rather that the data are arranged in groups (according to values of the BY variables) and that these groups are not necessarily in alphabetical or increasing numeric order.

  • Create an index on the BY variables using the DATASETS procedure.

For more information on the BY statement, refer to the discussion in SAS Language Reference: Concepts . For more information on the DATASETS procedure, refer to the discussion in the SAS Procedures Guide .

COPY Statement

  • COPY variables ;

The variables in the COPY statement are copied from the input data set to the OUTTREE= data set. Observations in the OUTTREE= data set that represent clusters of more than one observation from the input data set have missing values for the COPY variables.

FREQ Statement

  • FREQ variable ;

If one variable in the input data set represents the frequency of occurrence for other values in the observation, specify the variable s name in a FREQ statement. PROC CLUSTER then treats the data set as if each observation appeared n times, where n is the value of the FREQ variable for the observation. Noninteger values of the FREQ variable are truncated to the largest integer less than the FREQ value.

If you omit the FREQ statement but the DATA= data set contains a variable called _FREQ_ , then frequencies are obtained from the _FREQ_ variable. If neither a FREQ statement nor a _FREQ_ variable is present, each observation is assumed to have a frequency of one.

If each observation in the DATA= data set represents a cluster (for example, clusters formed by PROC FASTCLUS), the variable specified in the FREQ statement should give the number of original observations in each cluster.

If you specify the RMSSTD statement, a FREQ statement is required. A FREQ statement or _FREQ_ variable is required when you specify the HYBRID option.

With most clustering methods, the same clusters are obtained from a data set with a FREQ variable as from a similar data set without a FREQ variable, if each observation is repeated as many times as the value of the FREQ variable in the first data set. The FLEXIBLE method can yield different results due to the nature of the combinatorial formula. The DENSITY and TWOSTAGE methods are also exceptions because two identical observations can be absorbed one at a time by a cluster with a higher density. If you are using a FREQ statement with either the DENSITY or TWOSTAGE method, see the MODE=option on page 970.

ID Statement

  • ID variable ;

The values of the ID variable identify observations in the displayed cluster history and in the OUTTREE= data set. If the ID statement is omitted, each observation is denoted by OB n , where n is the observation number.

RMSSTD Statement

  • RMSSTD variable ;

If the coordinates in the DATA= data set represent cluster means (for example, formed by the FASTCLUS procedure), you can obtain accurate statistics in the cluster histories for METHOD=AVERAGE, METHOD=CENTROID, or METHOD=WARD if the data set contains

  • a variable giving the number of original observations in each cluster (see the discussion of the FREQ statement earlier in this chapter)

  • a variable giving the root-mean-square standard deviation of each cluster

Specify the name of the variable containing root-mean-square standard deviations in the RMSSTD statement. If you specify the RMSSTD statement, you must also specify a FREQ statement.

If you omit the RMSSTD statement but the DATA= data set contains a variable called _RMSSTD_ , then root-mean-square standard deviations are obtained from the _RMSSTD_ variable.

An RMSSTD statement or _RMSSTD_ variable is required when you specify the HYBRID option.

A data set created by FASTCLUS using the MEAN= option contains _FREQ_ and _RMSSTD_ variables, so you do not have to use FREQ and RMSSTD statements when using such a data set as input to the CLUSTER procedure.

VAR Statement

  • VAR variables ;

The VAR statement lists numeric variables to be used in the cluster analysis. If you omit the VAR statement, all numeric variables not listed in other statements are used.




SAS.STAT 9.1 Users Guide (Vol. 2)
SAS/STAT 9.1 Users Guide Volume 2 only
ISBN: B003ZVJDOK
EAN: N/A
Year: 2004
Pages: 92

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net