I have tried making it dendrogram but it was seeming to me very wrong.
Pair I have made: XB, XBZ, XBZY
I have tried making it dendrogram but it was seeming to me very wrong.
Pair I have made: XB, XBZ, XBZY
The obvious problem is, that your distance matrix is inconsistent.
If the distence from A
to B
is 3 and the distance from B
to Y
is 2, how is it possible that the distance from A
to Y
is 6?
If you slightly adapt your matrix, so that it corresponds to a distance of points in a real space, you get better results.
Example Using R
data <- c(0,3,3.3,1,3,
3,0,3.3,1,3,
3.3,3.3,0,3,6,
1,1,3,0,3,
3,3,6,3,0)
dim_names <- c("X","Z","Y","B","A")
mat <- matrix(data,nrow=5,ncol=5,byrow=TRUE, dimnames = list(dim_names,dim_names) )
dist <- as.dist(mat)
dist
X Z Y B
Z 3.0
Y 3.3 3.3
B 1.0 1.0 3.0
A 3.0 3.0 6.0 3.0
hc <- hclust(dist)
plot(hc, hang = -1)