Re: [R] metaMDS and envfit: Help reading output

From: Gavin Simpson <gavin.simpson_at_ucl.ac.uk>
Date: Mon, 23 May 2011 13:08:20 +0100

On Wed, 2011-05-11 at 07:07 -0400, Michael Denslow wrote:
> Hi Katie,
>
> On Tue, May 10, 2011 at 4:51 PM, Songer, Katherine B - DNR
> <Katherine.Songer_at_wisconsin.gov> wrote:
> > Hello R experts,
> >
> > I've used metaMDS to run NMDS on some fish abundance data, and am also working on correlating environmental data to the NMDS coordinates. I'm fairly new to metaMDS and NMDS in general, so I have what are probably some very basic questions. My fish abundance data consists of 66 sites for which up to 20 species of fish were identified and counted. I ran metaMDS on this data in 3 dimensions (after using a scree plot to check for stress levels in the different dimensions). I then used envfit to correlate a predictor dataset of environmental variables with the NMDS results, using the following code.
> >
> >>Fish<-as.data.frame(read.csv("Fish.csv",header=TRUE, sep = ","))
> >>Fish.mds<-metaMDS(Fish,zerodist = "add",k=3,trymax=20)
> >
> >>Predictors<-as.data.frame(read.csv("Predictors.csv",header=TRUE, sep = ","))
> >>Fish.fit <- envfit(Fish.mds$points, Predictors, k=3, 1000, na.rm = TRUE)
>
> Have a look at the choices argument in envfit, etc. This is how you
> specify which axes you want to plot.
>
> ord <- metaMDS(varespec, k=3)
> fit <- envfit(ord, varechem,
> perm = 999, choices=c(1:3))

Indeed, this is an essential step because we probably shouldn't interpret the "axes" of nMDS as separate components a la PCA/CA...

> fit
> plot(ord, choices=c(1,3))
> plot(fit, choices=c(1,3))

...as such, a 3-d plot might be better (for some definition of "better"). See ?ordirgl

G

> >>Fish.fit
> >
> > The output of Fish.fit was as follows (table truncated):
> >
> > Dim1 Dim2 r2 Pr(>r)
> > DrainArea -0.5923233 -0.8057004 0.7674 0.000999 ***
> > Flow -0.5283236 -0.8490431 0.7847 0.000999 ***
> > StrmWidth -0.6993457 -0.7147836 0.6759 0.000999 ***
> > Gradient 0.4541225 0.8909392 0.2085 0.010989 *
> >
> > I'd like to better understand how to read this table. I understand that Dim1 and Dim2 refer to the dimensions of the vectors produced by envfit, and r2 is the r-squared of those vectors. But how do I visualize these vectors in a 3-d plot? To which of the 3 NMDS dimensions are these vectors being correlated? Is there code to produce the x, y, and z coordinates of each of the sites in Fish.mds?
> >
> > Thanks very much.
> > Katie
> >
> >
> > [[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.
> >
>
>
>

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

______________________________________________
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.
Received on Mon 23 May 2011 - 12:10:50 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 23 May 2011 - 12:20:09 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive