[R] Conditional CCA and Monte Carlo - Help!

Jari Oksanen jari.oksanen at oulu.fi
Fri Mar 29 07:40:16 CET 2013


MWilson <mjw029 <at> bucknell.edu> writes:

> 
> Hi All,
> I am using canonical correspondence analysis to compare a community
> composition matrix to a matrix of sample spatial relationships and
> environmental variables. In order to parse out how much variance is
> explained purely by space (S/E) or the environment (E/S) I am using a
> conditional (partial) CCA.  I want to test significance via Monte Carlo but
> I can not find a way to do this with a conditional CCA.  I have been using
> vegan for the CCA and attempting to use ade4 to run a Monte Carlo. However,
> these two packages conflict when it comes to CCA.  If I use vegan I can run
> a conditional CCA, and if I use ade4 I can do a Monte Carlo - but I can't
> figure out how to do a conditional CCA with ade4 OR a Monte Carlo with
> vegan.  If anyone has experience with this I would be truly grateful for
> your help!  I am fairly new to R, and I have quickly found myself in a place
> where "Google-ing" has no longer proven useful.  Below are my scripts and
> error messages.

> --
> View this message in context: http://r.789695.n4.nabble.com/Conditional-CCA-and-Monte-Carlo-
Help-tp4662572.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> 
randtest() is an ade4 function that only works with ade4 result
objects. That you found the hard way.  In vegan we have permutest: see
?permutest.cca. Some other similar functions are described together
with permutest.cca, but permutest() is similar to randtest.

ade4::randtest.cca and vegan:::permutest.cca work similarly and are
comparable with basic models, but there are following differences:

1) vegan uses ter Braak's pseudo-F statistic, whereas ade4 returns the
proportion constrained/all eigenvalues. These are similar to a
constant multiplier in non-conditional models and with "direct" or
"reduced" permutation models in vegan, but differ otherwise. The ade4
alternative is not good for partial models (but that does not matter
since ade4 has no partial models). The vegan:::permutest.cca function
returns items num and den (numerator and denominator) that can be used
to get the proportion of ade4.

2) vegan permutes response (community) data whereas ade4 permutes
constraints (environmental data).  This makes only difference in
partial (conditional) models or with some non-default permutation
strategies in vegan. However, because of this, ade4 and vegan results
are not identical with the same random number seed (with little
trickery this can be fixed, but that is hardly for
beginners). Permutation of community data is needed in analysis of
conditional (partial) models, and in some permutation strategies.

3) We do not call it Monte Carlo, but permutation. (Monte Carlo is too
expensive for me -- I prefer Menton). That may explain why Google did
not find it to you.

In general, you should not expect methods functions (such as
ade4::randtest.cca) to work across packages. In sometimes they do, but
in those cases the package authors have taken special care to make
their functions to work with alien objects. Not in this case. It
neither makes sense for ade4::randtest be able to handle vegan object
because randtest does not know what to do with contional (partial)
models. 

Cheers, Jari Oksanen



More information about the R-help mailing list