Computes a hierarchical cluster analysis and plots a hierarchical dendrogram with highlighted rectangles around the classified groups. Can be used, for instance, as visual tool to verify the elbow-criterion (see sjc.elbow).

sjc.dend(data, groupcount, distance = "euclidean", agglomeration = "ward")

Arguments

data

A data frame with variables that should be used for the cluster analysis.

groupcount

The amount of groups (clusters) that should be used.

  • Use sjc.elbow-function to determine the group-count depending on the elbow-criterion.

  • Use sjc.grpdisc-function to inspect the goodness of grouping (accuracy of classification).

Solutions for multiple cluster groups can be plotted, for instance with "groupcount = c(3:6)".

distance

Distance measure to be used when method = "hclust" (for hierarchical clustering). Must be one of "euclidean", "maximum", "manhattan", "canberra", "binary" or "minkowski". See dist. If is method = "kmeans" this argument will be ignored.

agglomeration

Agglomeration method to be used when method = "hclust" (for hierarchical clustering). This should be one of "ward", "single", "complete", "average", "mcquitty", "median" or "centroid". Default is "ward" (see hclust). If method = "kmeans" this argument will be ignored. See 'Note'.

Note

Since R version > 3.0.3, the "ward" option has been replaced by either "ward.D" or "ward.D2", so you may use one of these values. When using "ward", it will be replaced by "ward.D2".

Examples

# Plot dendrogram of hierarchical clustering of mtcars-dataset # and show group classification sjc.dend(mtcars, 5)
# Plot dendrogram of hierarchical clustering of mtcars-dataset # and show group classification for 2 to 4 groups sjc.dend(mtcars, 2:4)