Dear R users, I would like to access the distance matrix generated by metaMDS as well as use the dist function to calculate the euclidean distance for each axis in the NMDS. I am having trouble finding a way to access these variables and any help is greatly appreciated. For the distance matrix I know I could just calculate the bray-curtis distance but it would be nice to know how to get it from the NMDS function. For the euclidean distance, the only thing I can find within metaMDS is the score function but there must be some way for me to call on/access the ordination distance for one axis right? The reason for this is I would like to do something like the stressplot function but for each axis. Thank you, Cara
distance matrix from metaMDS
3 messages · Cara Fiore, David L Carlson
Don't the functions metaMDSdist() and metaMDSredist() that are documented on the metaMDS manual page give you the distance matrix? If you want to compute the distances based on a single axis, you could use vegdist(). David C -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Cara Fiore Sent: Thursday, August 28, 2014 7:02 PM To: r-help at r-project.org Subject: [R] distance matrix from metaMDS Dear R users, I would like to access the distance matrix generated by metaMDS as well as use the dist function to calculate the euclidean distance for each axis in the NMDS. I am having trouble finding a way to access these variables and any help is greatly appreciated. For the distance matrix I know I could just calculate the bray-curtis distance but it would be nice to know how to get it from the NMDS function. For the euclidean distance, the only thing I can find within metaMDS is the score function but there must be some way for me to call on/access the ordination distance for one axis right? The reason for this is I would like to do something like the stressplot function but for each axis. Thank you, Cara ______________________________________________ R-help at 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.
Yes I looked at this and I tried metaMDSdist but got an error and for some reason I didn't try metaMDSredist which seems to be the right thing. So the main thing I was confused about was what to call dist() on -i.e., getting the correct ordinal distance, and then if I assume that the NMDS scores are the coordinates, which I believe they are, then how do I call dist() on one column? But, I just found the answer in a translation from matlab to R - you have to use drop=FALSE (and hopefully I am calling dist() on the right thing) euc.dist.axis1=dist(NMDS2[,1, drop=FALSE], method="euclidean") Maybe this is obvious to other folks but just in case there is anyone like me out there I figured I'd write back. Thanks for the info I have never written to this list before because I always found what I needed online. I appreciate your help and patience. Cara
On Thu, Aug 28, 2014 at 10:19 PM, David L Carlson <dcarlson at tamu.edu> wrote:
Don't the functions metaMDSdist() and metaMDSredist() that are documented
on the metaMDS manual page give you the distance matrix? If you want to
compute the distances based on a single axis, you could use vegdist().
David C
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Cara Fiore
Sent: Thursday, August 28, 2014 7:02 PM
To: r-help at r-project.org
Subject: [R] distance matrix from metaMDS
Dear R users,
I would like to access the distance matrix generated by metaMDS as well as
use the dist function to calculate the euclidean distance for each axis in
the NMDS. I am having trouble finding a way to access these variables and
any help is greatly appreciated.
For the distance matrix I know I could just calculate the bray-curtis
distance but it would be nice to know how to get it from the NMDS function.
For the euclidean distance, the only thing I can find within metaMDS is
the score function but there must be some way for me to call on/access the
ordination distance for one axis right?
The reason for this is I would like to do something like the stressplot
function but for each axis.
Thank you,
Cara
[[alternative HTML version deleted]]
______________________________________________ R-help at 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.