Mateus, I see what you mean. I can't figure it out. I found a message from a few years ago that mentions the same problem. http://tolstoy.newcastle.edu.au/R/e8/help/09/12/8165.html
This may be a bug. Since hclust() is in the stats package, I am ccing the maintainer, r-c...@r-project.org, on this e-mail. Jean > find("hclust") [1] "package:stats" > maintainer("stats") [1] "R Core Team <r-c...@r-project.org>" Mateus Teixeira <mateus.teixe...@gmail.com> wrote on 07/04/2012 07:39:39 AM: > 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.