Re: [R] Is there a way to print branch distances for hclust function?

2011-12-13 Thread kbrownk
Thanks, I had tried using height but I was using it wrong. If I had
the distances alone it would be enough, except that the height returns
the distance all the way to 0, rather than to the adjacent merge. So,
if an initial merge at height 0 has a distance of 10, and that object
then merges again at having a distance that reaches height 35, I'd
want to see a distance value of 25 not 35. So I will need a way to
relate merges with heights somehow so I can subtract lower level
distances like this. I have 67 total distances, so if some manual work
is involved I can manage. I'm working on the advice you provided,
which may provide some answers.

Thanks,
kbrownk

On Dec 12, 1:38 am, Peter Langfelder 
wrote:
> On Sun, Dec 11, 2011 at 8:43 PM,kbrownk wrote:
> > The R function hclust is used to do cluster analysis, but based on R
> > help I see no way to print the actual fusion distances (that is, the
> > vertical distances for each connected branch pairs seen in the cluster
> > dendrogram).
>
> > Any ideas? I'd like to use them test for significant differences from
> > the mean fusion distance (i.e. The Best Cut Test).
>
> > To perform a cluster analysis I'm using:
>
> > x <- dist(mydata, method = "euclidean") # distance matrix
> > y <- hclust(x, method="ward") #clustering (i.e. fusion) method
> > plot(y) # display dendogram
>
> > Thanks,
> >kbrownk
>
> You need to dig a bit deeper in the help file :) The return value is a
> list that contains, among others, components
> 'merge' and 'height'. The 'merge' component tells you which objects
> were merged at each particular step, and the 'height' component tells
> you what the merging height at that step was. The (slightly) tricky
> part is to relate the merge component to actual objects - AFAIK there
> is no function for that. The function cutree() using the argument k
> and varying it between 2 and n should basically do it for you but you
> need to match it to the entries in 'merge'. Maybe someone else knows a
> better way to do this.
>
> HTH,
>
> Peter
>
> __
> r-h...@r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
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.


Re: [R] Is there a way to print branch distances for hclust function?

2011-12-13 Thread kbrownk
Never mind on my reply post (hasn't posted yet, but assuming it does).
I found a way to use the merge and height values with Excel to
subtract out the lower level distance. Thanks for the help!

kbrownk

On Dec 12, 1:38 am, Peter Langfelder 
wrote:
> On Sun, Dec 11, 2011 at 8:43 PM,kbrownk wrote:
> > The R function hclust is used to do cluster analysis, but based on R
> > help I see no way to print the actual fusion distances (that is, the
> > vertical distances for each connected branch pairs seen in the cluster
> > dendrogram).
>
> > Any ideas? I'd like to use them test for significant differences from
> > the mean fusion distance (i.e. The Best Cut Test).
>
> > To perform a cluster analysis I'm using:
>
> > x <- dist(mydata, method = "euclidean") # distance matrix
> > y <- hclust(x, method="ward") #clustering (i.e. fusion) method
> > plot(y) # display dendogram
>
> > Thanks,
> >kbrownk
>
> You need to dig a bit deeper in the help file :) The return value is a
> list that contains, among others, components
> 'merge' and 'height'. The 'merge' component tells you which objects
> were merged at each particular step, and the 'height' component tells
> you what the merging height at that step was. The (slightly) tricky
> part is to relate the merge component to actual objects - AFAIK there
> is no function for that. The function cutree() using the argument k
> and varying it between 2 and n should basically do it for you but you
> need to match it to the entries in 'merge'. Maybe someone else knows a
> better way to do this.
>
> HTH,
>
> Peter
>
> __
> r-h...@r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
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.


Re: [R] Is there a way to print branch distances for hclust function?

2011-12-11 Thread Peter Langfelder
On Sun, Dec 11, 2011 at 8:43 PM, kbrownk  wrote:
> The R function hclust is used to do cluster analysis, but based on R
> help I see no way to print the actual fusion distances (that is, the
> vertical distances for each connected branch pairs seen in the cluster
> dendrogram).
>
> Any ideas? I'd like to use them test for significant differences from
> the mean fusion distance (i.e. The Best Cut Test).
>
> To perform a cluster analysis I'm using:
>
> x <- dist(mydata, method = "euclidean") # distance matrix
> y <- hclust(x, method="ward") #clustering (i.e. fusion) method
> plot(y) # display dendogram
>
> Thanks,
> kbrownk

You need to dig a bit deeper in the help file :) The return value is a
list that contains, among others, components
'merge' and 'height'. The 'merge' component tells you which objects
were merged at each particular step, and the 'height' component tells
you what the merging height at that step was. The (slightly) tricky
part is to relate the merge component to actual objects - AFAIK there
is no function for that. The function cutree() using the argument k
and varying it between 2 and n should basically do it for you but you
need to match it to the entries in 'merge'. Maybe someone else knows a
better way to do this.

HTH,

Peter

__
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.


[R] Is there a way to print branch distances for hclust function?

2011-12-11 Thread kbrownk
The R function hclust is used to do cluster analysis, but based on R
help I see no way to print the actual fusion distances (that is, the
vertical distances for each connected branch pairs seen in the cluster
dendrogram).

Any ideas? I'd like to use them test for significant differences from
the mean fusion distance (i.e. The Best Cut Test).

To perform a cluster analysis I'm using:

x <- dist(mydata, method = "euclidean") # distance matrix
y <- hclust(x, method="ward") #clustering (i.e. fusion) method
plot(y) # display dendogram

Thanks,
kbrownk

__
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.