{smcl}
{hline}
help for {hi:clustergram}{right:{hi: (SJ2-4: st0028)}}
{hline}

{title:Graph for visualizing hierarchical and non-hierarchical cluster analyses}

{p 8 27 2}
{cmd:clustergram} 
{it:varlist}
[{cmd:if} {it:exp}] 
[{cmd:in} {it:range}] 
{cmd:,} 
{cmdab:cl:uster(}{it:clustervarlist}{cmd:)} 
[
{cmdab:fr:action(}{it:#}{cmd:)} 
{cmd:fill}
{it:graph_options}
]


{title:Description}

{p 4 4 2}{cmd:clustergram} draws a graph to examine how cluster members are
assigned to clusters as the number of clusters increases in a cluster
analysis.  This is similar in spirit to the dendrograms (tree graphs) used for
hierarchical cluster analyses. The graph is especially useful for
non-hierarchical clustering algorithms, such as {it:k}-means, and for
hierarchical cluster algorithms when the number of observations is too large
for dendrograms to be practical.

{p 4 4 2}{it:varlist} contains the variables with which the cluster algorithm
was run.  As with cluster analysis generally, it often makes sense to
standardize the variables. 


{title:Options}

{p 4 8 2} {cmd:cluster(}{it:clustervarlist}{cmd:)} specifies the variables
containing cluster assignments, as previously produced by {cmd:cluster}.  More
precisely, they usually successively specify assignments to 1, 2, ...
clusters.  Typically they will be named something like
{cmd:cluster1-cluster}{it:max}, where {it:max} is the maximum number of
clusters identified.  It is possible to specify assignments other than to 1,2,
... clusters (e.g.  omitting the first few clusters, or in reverse order). A
warning will be displayed in this case. This option is required. 

{p 4 8 2}{cmd:fraction(}{it:#}{cmd:)} specifies a fudge factor controlling the
width of line segments and is typically modified to reduce visual clutter.  The
relative width of any two line segments is not affected.  The value should be
between 0 and 1.  The default is 0.2.

{p 4 8 2} {cmd:fill} specifies that individual graph segments are to be filled
(solid).  By default only the outline of each segment is drawn. 

{p 4 8 2}
{it:graph_options} are options of {cmd:graph, twoway} other than 
{cmd:symbol()} and {cmd:connect()}. The defaults include {cmd:ylabel}s 
showing three (rounded) levels and {cmd:gap(5)}. 


{title:Examples}

{p 4 4 2}Plot the clustergram for {cmd:cluster1} through {cmd:cluster20}:

{p 4 8 2}{cmd:. clustergram var1-var7, cluster(cluster1-cluster20)}

{p 4 4 2}Plot the clustergram with a smaller width to reduce visual clutter:

{p 4 8 2}{cmd:. clustergram sepallen-petalwid, cluster(cluster1-cluster10) fraction(.1) xla(1/10)}


{title:Author}

	Matthias Schonlau, RAND
	matt@rand.org


{title:Also see}

{p 5 19 2}Manual:  {hi:[R] cluster}, {hi:[R] cluster dendrogram}, {hi:[R] cluster kmeans}, {hi:[R] graph}{p_end}
{p 5 19 2}Online:  help for {help cluster}, {help graph}{p_end}
