In: Statistics and Probability
Use the data below and find the clusters using a single link technique. Use Euclidean distance and draw the dendrogram.
X | Y | |
P1 | 0.35 | 0.48 |
P2 | 0.17 | 0.33 |
P3 | 0.3 | 0.28 |
P4 | 0.21 | 0.18 |
P5 | 0.08 | 0.29 |
Sol:
Distance between two clusters is the shortest distance between two points in each cluster.
Obtain dissimilarity matrix using dist function and specify method =euclidean.
obtain heirrachial clustering using single linkage.
and obtain dendogram with plot function in R
Rcode:
df1 =read.table(header = TRUE, text ="
X Y
P1 0.35 0.48
P2 0.17 0.33
P3 0.3 0.28
P4 0.21 0.18
P5 0.08 0.29
"
)
df1
dm <- dist(df1, method = "euclidean")
hc1us <- hclust(dm, method = "single" )
plot(hc1us, cex = 0.6, hang = -1)
Output: