[R-sig-eco] variance explained for PCoA axes

Jari Oksanen jari.oksanen at oulu.fi
Mon Apr 4 20:15:40 CEST 2011


On 4/04/11 19:24 PM, "Mario Beolco" <mario.beolco at gmail.com> wrote:

> Dear R users,
> 
> I was wondering whether it is possible to obtain a measure of the
> variance explained for each axis of a PCoA performed using cmdscale?
> The function add.spec.scores
> <http://rss.acs.unt.edu/Rdoc/library/BiodiversityR/html/add.spec.scores.html>,
> that comes with the BiodiversityR package, should in theory do what I
> want, but I have not found any reference to the method in the package
> manual. Any help would be greatly appreciated!

Mario,

If you ask, you'll get it: If you call cmdscale with argument eig = TRUE or
x.ret = TRUE or add = TRUE, the output will contain item GOF (= "goodness of
fit") which is as close to the R2 as you can get in PCoA. However, you must
very carefully read the documentation (?cmdscale) and check the version of R
you use: the definition of GOF changes in R 2.13.0 (now in beta), and if I
remember correctly, it also changed during R 2.12.x (but my memory can fail
here: GOF was fixed last October, but I'm not quite sure that these fixes
were ported to the 2.12.x releases). Moreover, at some stages (2.11.x and
earlier) the calculation of GOF didn't follow the ?cmdscale documentation. A
bit messy, but R 2.13.0 at least has a fixed GOF, and wcmdscale in vegan has
followed main R -- sometimes it followed R ahead of R. Just ask for GOF, and
you'll get it.

Cheers, Jari Oksanen



More information about the R-sig-ecology mailing list