[R] vegan (ordisurf): R² for smoothed surfaces

Gavin Simpson gavin.simpson at ucl.ac.uk
Wed Apr 14 21:25:53 CEST 2010


On Tue, 2010-04-13 at 15:02 +0200, Kim Vanselow wrote:
> Dear r-helpers,
> I just read in an article by Virtanen et al. (2006) where
> vegetation-environment relationships  are studied by fitting smoothed
> surfaces on an NMDS ordination using GAMs (Wood 2000). The authors
> describe, that they used R² as goodness-of-fit statistic, which they
> compare to the R² of fitted vectors. Calculations were carried out
> using the package vegan (Oksanen).
> I know that I can fit vectors onto ordinations with the function
> envfit. The R² is listed in the output table. I also know that GAMs
> are implemented in vegan by the function ordisurf. But how can I get
> an R² from this function.

?ordisurf and see the Value section. ordisurf returns the mgcv::gam
object describing the model fit. If you assign the object returned by
ordisurf and run summary on it (as you would any other mgcv::gam model),
you'll get the R^2(adj). Here's an example:

data(varespec)
data(varechem)
library(MASS)
vare.dist <- vegdist(varespec)
vare.mds <- isoMDS(vare.dist)
## capture return value
mod <- with(varechem, ordisurf(vare.mds, Baresoil, bubble = 5))
## summary
summary(mod)

You can then pull apart the returned object ('mod') if you need to get
at the R^2 for subsequent computations, storage etc rather than just
display it.

HTH

G

> 
> Thanks in advance,
> Kim 
> 
> -- 
> GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> 
> 

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 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
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-help mailing list