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