Dear R users,

I have noted a difference in the merge distances given by hclust using
centroid method.

For the following data:

x<-c(1009.9,1012.5,1011.1,1011.8,1009.3,1010.6)

and using Euclidean distance, hclust using centroid method gives the
following results:

> x.dist<-dist(x)
> x.aah<-hclust(x.dist,method="centroid")
> x.aah$merge
     [,1] [,2]
[1,]   -3   -6
[2,]   -1   -5
[3,]   -2   -4
[4,]    1    2
[5,]    3    4
> x.aah$height
[1] 0.50000 0.60000 0.70000 0.97500 1.36875

A calculation by hand results same merges, but at different distances for
latter stages:

heights:
   0.5  => merging 3 and 6  => G1
   0.6  => merging 1 and 5  => G2
   0.7  => merging 2 and 4  => G3
   *1.25  => merging G1 and G2 => G4
   1.92  => merging G3 and G4*

It seems that hclust is not correctly computing the group centroids. Is it
correct?

Best regards,

Mateus

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to