Consider the USArrests
data. We will now perform hierarchical clustering on the states.
Make sure to set.seed(2)
to have consistent results.
Using hierarchical clustering with complete linkage and Euclidean distance, cluster the states.
Store the model in hc.complete
.
Cut the dendrogram at a height that results in three distinct clusters.
Store the cluster labels to labels.complete
.
Hierachically cluster the states using complete linkage and Euclidean distance,
after scaling the variables to have standard deviation one and mean zero.
Store the scaled data in sd.data
and the model in hc.complete.sd
.
Cut the dendrogram of the scaled model at a height that results in three distinct clusters.
Store the cluster labels to labels.complete.sd
.
Assume that:
USArrests
dataset has been loaded and attached