From: Gavin Simpson <gavin.simpson_at_ucl.ac.uk>

Date: Mon, 14 Apr 2008 22:24:48 +0100

Date: Mon, 14 Apr 2008 22:24:48 +0100

On Mon, 2008-04-14 at 17:00 -0400, Sarah Goslee wrote:

> On Mon, Apr 14, 2008 at 4:47 PM, Gavin Simpson <gavin.simpson@ucl.ac.uk> wrote:

*>
**> > Note that the default is to produce a bray-curtis dissimilarity matrix
**> > from the input species data. As such, I reproduce this dissimilarity
**> > matrix as arg 1 to cor and then take the Euclidean distances of the
**> > coordinates on nMDS axes 1:2 (this example is a 2D solution but scales
**> > to n-dimensions) as the second argument to cor:
**> >
**> > cor(vegdist(dune), dist(sol$points))^2
**> >
**> > In this example, the "R^2" is 0.899222
**> >
**> > If you already have jaccard for your species data, then substitute this
**> > for 'vegdist(dune)' and sol for whatever your nMDS object is called.
**>
**> Good point. I forgot to clarify that you should use the same dissimilarity
**> metric for your original data that was used in constructing the ordination.
**> Euclidean distances should be used for the NMDS configuration, though.
*

Yes - here I use dist(sol$points) which defaults to Euclidean distances.

*>
*

> > However, this assumes a linear relationship between the original

*> > distances and the nMDS distances. The relationship need not be linear,
**> > just monotonic if I recall the details correctly.
**>
**> If you (the original querent) are interested in the monotonic rather than
**> strictly linear relationship, you could use the "spearman" option to
**> cor().
*

I forgot about that, thanks for the reminder Sarah. This correlation (using method = "spearman") is different to the ones used in stressplot. I peeked inside the code of that function and the following should reproduce the linear fit R^2 shows on the plot produced by stressplot:

## continuing the example from my previous email
require(MASS) # for Shepard()

shep <- Shepard(vegdist(dune), sol$points)
cor(shep$y, shep$yf)^2

The last line yields = 0.9250712.

The non-metric fit is 1 - stress and this can be calculated using:

1 - (sum((shep$y - shep$yf)^2)/sum(shep$y^2))

So now you have 4 different R^2 values to choose from Stephen...

**HTH
**
G

*>
*

> Sarah

*>
*

-- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% 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 Tue 15 Apr 2008 - 17:18:03 GMT

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 Tue 15 Apr 2008 - 18:30:29 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.
*