[R] hcluster with linkage median

Peter Langfelder peter.langfelder at gmail.com
Mon Sep 27 17:41:04 CEST 2010


On Mon, Sep 27, 2010 at 8:22 AM, Kennedy <henrik.aldberg at gmail.com> wrote:
>
> Hi,
>
> I want to perform a hierarchical clustering using the median as linkage
> metric. As I understand it the function hcluster in package amap have this
> option but it does not produce the results that I expect.
>
> In the example below M is a matrix of similarities that is transformed into
> a matrix of dissimilarities D.
>> D
>     [,1] [,2] [,3] [,4] [,5]
> [1,]  1.0  0.9  0.2  0.2  0.1
> [2,]  0.9  1.0  0.7  1.0  0.0
> [3,]  0.2  0.7  1.0  0.8  0.8
> [4,]  0.2  1.0  0.8  1.0  0.5
> [5,]  0.1  0.0  0.8  0.5  1.0
>
> Since [2,5]=0 the objects 2 and 5 should be grouped together in the first
> step as is done by the agnes function but hcluster start by clustering
> objects 3 and 4. Why is this?
>


>From reading the hcluster help file I get the sense that the input is
_not_ the distance matrix, but a numeric matrix from which the
distance is computed. I think you should simply look at hclust since
that does implement the median method.

Peter



More information about the R-help mailing list