en:monte_carlo_r
Section: Ordination analysis
Monte Carlo permutation test in constrained ordination
R functions
permutest(libraryvegan) - the core function inveganconducting Monte Carlo permutation test forrda,ccaand other constrained ordination methods. By default does only 99 permutations. Seeanovabelow for details.anova.cca(libraryvegan) - a convenient function forpermutest, offering more user friendly interface. It can test the significance of constrained ordination (and different parts of it, e.g., ordination axes or individual explanatory variables), and it can also be used for model selection (comparing two nested constrained ordinations). Important arguments include:bydecides what is tested; default is the global model, i.e. all variables included in the analysis. The test can be also done on variation explained by individual constrained axes (by = “axis”), with the test done sequentially from the first to the last (this is done by using samples scores on the n-th axis as explanatory variables, while using scores of the axis 1, 2, ... n as covariables), by individual terms (explanatory variables) added sequentially in order in which they appear in the formula or data frame (by = “terms”; note that this variation depends on the order of variables in which they enter the model); or by individual explanatory variables after removing variation of all other variables in the model (by = “margin”; here the variation does not depend on the order of variables in the model).permutationsis either the number of permutations (default is 999), or in case of restricted permutations defines permutation schema using the functionhowfrom the packagepermute(see details below).
how(librarypermute, implemented invegan; see also Example 3) helps to specify the details how randomization among cases should be done (and also how many of them, by argumentnperm, and whether the complete set of randomization for exact P-values should be produced, by logical argumentcomplete). There are three hierarchical levels at which we can manipulate individual cases (samples): samples, which group into plots, and these group into blocks. Blocks are the highest level, and the rule is that cases between blocks are never randomized. Plots are intermediate levels, and cases between plots can (but do not have to) be randomized. Plots represent “whole-plots” in split-plot-like design, and in the same context samples represent “split-plots”. Randomization of samples within each of the three levels can be modified separately by argumentswithin,plotsandblocks(cases are never randomized between blocks):- the argument
withindefines how samples are permuted within plots, and the argumentplotsdefine how plots are permuted among each other. To define randomization of sampleswithinplots and the randomization of plots among each other, there are two respective convenience functions,Within(with capital W) andPlots(with capital P), both having similar set of arguments:typeof permutation -free,series,gridornone;mirror(logical) - whether the randomization schemas should be mirrored or not (applies for linear transectsseries, and rectangulargrids),ncolandnrow(numeric) specifying the number of columns and rows in the grid, respectively;constant(logical, forWithinonly) defining whether the same constant order of permutation of cases should be used among different strata (e.g. for a set of time series with cases in different series recorded at the same time);strata(factor, forPlotsonly) defining strata for permutation of plots.
- the argument
blocksdefine what is the block (as samples within blocks are never randomized, the setting is easy).
shuffleandshufleSet(from libraryvegan) helps to generate set of randomizations defined in argumentcontrolby functionhow'. Whileshufflegenerates one set of randomizations,shuffleSetis a convenience function to repeatedly callshuffleand generatensetof randomizations.permustats(libraryvegan) belongs to a set of functions which can extract, analyze and display results of the permutation tests; the function can be applied on the result ofanova, and extracts the values of test statistic for all permutations done by the test (including the observed value on unpermuted data); these can then be summarized by functionsummaryand visualized by functiondensityplot(drawing density plot of test-statistics and also position of the observed value against the null distribution).
Further reading: for more details check the excellent overview by Gavin Simpson (together with Jari Oksanen the author of most functions in vegan) in recent (2020) online lecture (with video on youtube and online slides), and possibly also in 2014's blog post.
en/monte_carlo_r.txt · Last modified: by David Zelený
