I want to do an agglomerative clustering with R, but I want to use my own distance as a linkage method instead of the ones already predefined. How can I can I embed my own distance as a linkage method using the function hclust in R?
Asked
Active
Viewed 104 times
0
-
The function is defined as `hclust(d, method = "complete", members = NULL)`, where `d` is a dissimilarity matrix as produced by function `dist`. Your custom dissimilarity function should return an object compatible with `dist`'s return value. Is this what you are looking for? – Rui Barradas Apr 24 '22 at 09:47
-
Suppose that I use the correlation dissimilarity. Will the function hclust use this distance in the linkage method as well? – Toney Shields Apr 24 '22 at 10:33
-
1Yes, it will. `hclust` will operate on the dissimilarity matrix it is given. – Rui Barradas Apr 24 '22 at 13:29