permutest.coca.Rd
A permutation test for predictive co-correspondence analysis models to assess the significance of each CoCA ordination axes.
# S3 method for coca permutest(x, R0 = NULL, permutations = 99, n.axes = x$n.axes, verbose = TRUE, ...) <!-- %\method{print}{permutest.coca}(x, digits = max(3, getOption("digits") - 3), \ldots) --> # S3 method for permutest.coca summary(object, ...) <!-- %\method{print}{summary.permutest.coca}(x, digits = max(3, getOption("digits") - 3), \ldots) -->
x | an object of class |
---|---|
R0 | row weights to use in the analysis. If missing, the
default, these are determined from |
permutations | the number of permutations to perform. |
n.axes | The number of axes to test. Defaults to the number of
axes stated in |
verbose | if |
object | an object of class |
... | arguments to be passed to other methods. |
An alternative approach to cross-validation (see
crossval
) to select the number of axes to retain in a
predictive co-correspondence analysis is to test the statistical
significance of each ordination axis using permutation tests.
The test statistic used is the F-ratio based on the fit of the first axis to the response data (ter Braak and Smilauer 2002). The second and subsequent axes are tested by treating previous axes as co-variables.
To be precise, this approach does not test the significance of SIMPLS axes, but those of NIPALS-PLS axes (ter Braak and de Jong 1998).
A list with the following components:
a vector of P-values for each ordination axis.
a vector of values for the test statistic for each axis.
the total inertia in the response matrix.
a vector containing the residualised inertia. This is the total inertia in the response after removing the inertia explained by all previous axes. For the first CoCA axis this is, by definition, the total inertia in the response.
a vector containing the amount of inertia in the response matrix explained by each ordination axis.
a vector containing the fit of each axis to the response as a percentage of the total inertia (variance).
the number of axes in the ordination.
the matched call.
ter Braak, C.J.F. and de Jong, S. (1998) The objective function of partial least squares regression. Journal of Chemometrics 12, 41--54.
ter Braak, C.J.F and Schaffers, A.P. (2004) Co-Correspondence Analysis: a new ordination method to relate two community compositions. Ecology 85(3), 834--846.
ter Braak, C.J.F. and Smilauer, P. (2002) Canoco reference manual and CanoDraw for Windows user's guide: software for canonical community ordination. Version 4.5. New York: Microcomputer Power.
Gavin L. Simpson, based on Matlab code by C.J.F. ter Braak and A.P. Schaffers.
Argument R0
is provided for compatibility with the original
MATLAB code. The R usage paradigm makes this argument redundant in the
current code and it may be invalid to supply different row weights
(\(R_0\)) as R0
. This argument will likely be removed in future
versions.
This function is slow. Beware setting argument
permutations
higher than the default. Determine how long it
takes for the default 99 permutations to complete before going crazy
and asking for thousands of permutations - you've been warned, have a
good book to hand.
coca
, for the model fitting function,
crossval
, for a leave-one-out cross-validation
procedure, which is the preferred way to select axes in a predictive
co-correspondence analysis.
# \dontshow{ suppressWarnings(RNGversion("3.5.0")) od <- options(digits = 4) # } ## load some data data(beetles) data(plants) ## log transform the bettle data beetles <- log(beetles + 1) ## predictive CoCA using SIMPLS and formula interface bp.pred <- coca(beetles ~ ., data = plants) #> #> Removed some species that contained no data in: beetles, plants ## should retain only the useful PLS components for a parsimonious model # \donttest{ ## Leave-one-out crossvalidation - this takes a while crossval(beetles, plants) #> some species contain no data and were removed from data matrix y #> some species contain no data and were removed from data matrix x #> LOO - Site: 1 - Complete #> LOO - Site: 2 - Complete #> LOO - Site: 3 - Complete #> LOO - Site: 4 - Complete #> LOO - Site: 5 - Complete #> LOO - Site: 6 - Complete #> LOO - Site: 7 - Complete #> LOO - Site: 8 - Complete #> LOO - Site: 9 - Complete #> LOO - Site: 10 - Complete #> LOO - Site: 11 - Complete #> LOO - Site: 12 - Complete #> LOO - Site: 13 - Complete #> LOO - Site: 14 - Complete #> LOO - Site: 15 - Complete #> LOO - Site: 16 - Complete #> LOO - Site: 17 - Complete #> LOO - Site: 18 - Complete #> LOO - Site: 19 - Complete #> LOO - Site: 20 - Complete #> LOO - Site: 21 - Complete #> LOO - Site: 22 - Complete #> LOO - Site: 23 - Complete #> LOO - Site: 24 - Complete #> LOO - Site: 25 - Complete #> LOO - Site: 26 - Complete #> LOO - Site: 27 - Complete #> LOO - Site: 28 - Complete #> LOO - Site: 29 - Complete #> LOO - Site: 30 - Complete #> #> Cross-validation for Predictive Co-Correspondence Analysis #> #> Call: crossval(y = beetles, x = plants) #> #> Cross-validatory %fit of beetles to plants: #> #> COCA1 COCA2 COCA3 COCA4 COCA5 COCA6 COCA7 COCA8 COCA9 COCA10 #> 5.1 7.8 7.0 6.9 7.7 8.5 8.7 6.8 6.5 6.7 #> COCA11 COCA12 COCA13 COCA14 COCA15 COCA16 COCA17 COCA18 COCA19 COCA20 #> 5.8 3.5 2.7 2.0 2.5 -0.1 -2.1 -2.9 -2.9 -3.5 #> COCA21 COCA22 COCA23 COCA24 COCA25 COCA26 COCA27 COCA28 COCA29 #> -4.2 -4.3 -4.8 -5.7 -8.1 -24.6 -29.2 -37.9 -41.4 ## so 2 axes are sufficient # } ## permutation test ## (Testing the first 2 axes & only 50 perms for speed.) bp.perm <- permutest(bp.pred, permutations = 50, n.axes = 2) #> Permutations for axis: 1 - completed #> Permutations for axis: 2 - completed bp.perm #> #> Permutation test for predictive co-correspondence analysis: #> #> Call: permutest.coca(x = bp.pred, permutations = 50, n.axes = 2) #> #> Permutation test results: #> #> Stat. Inertia Fit % fit P-value #> COCA 1 0.0890 5.6964 0.4658 8.1763 0.02 #> COCA 2 0.0761 5.2306 0.3701 6.4973 0.25 #> options(od)