Learn R Programming

sjPlot (version 2.7.2)

sjc.dend: Compute hierarchical cluster analysis and visualize group classification

Description

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).

Usage

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'.

Examples

Run this code
# NOT RUN {
# 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)

# }

Run the code above in your browser using DataLab