shuffle can generate permutations for a wide range of restricted
permutation schemes. A small selection of the available combinations of
options is provided in the Examples section below.
Argument type controls how samples are actually permuted; "free"
indicates randomization, "series" indicates permutation via cyclic
shifts (suitable for evenly-spaced line transect or time series data),
"grid" indicates permutation via toroidal shifts (suitable for
samples on a regular grid), and "none" indicates no permutation of
samples. See the package vignette (browseVignettes("permute")) for
additional information on each of these types of permutation.
Plots(type = "partition") randomly assigns observations to the
labelled groups supplied in strata, retaining the observed number
assigned to each group. Permutations that differ only by reordering
observations carrying the same group label are omitted. If within is
not supplied, how uses Within(type = "none") for this design.
Supplying any other within-plot type is an error.
Argument mirror determines whether grid or series permutations can be
mirrored. Consider the sequence 1,2,3,4. The relationship between
consecutive observations is preserved if we reverse the sequence to 4,3,2,1.
If there is no inherent direction in your experimental design, mirrored
permutations can be considered part of the Null model, and as such increase
the number of possible permutations. The default is to not use mirroring so
you must explicitly turn this on using mirror = TRUE in how.
For spatial grids, symmetric = TRUE preserves symmetric spatial
autocovariance by preventing a permutation from being mirrored in both the
row and column directions at the same time. It has no effect unless
type = "grid" and mirror = TRUE.
To permute plots rather than the observations within plots (the levels of
strata), use Within(type = "none") and Plots(type = foo), where
foo is how you want the plots to be permuted. However,
note that the number of observations within each plot must be
equal!
For some experiments, such as BACI designs, one might wish to use the same
permutation within each plot. This is controlled by argument
constant. If constant = TRUE then the same permutation will be
generated for each level of strata. The default is constant = FALSE.
One-sided formulas can be used to define blocks and plot-level strata.
A formula containing a single variable, such as ~ site, produces a factor
from that variable. Variables participating in multiple model terms are
combined into a single interaction factor. Consequently, ~ site + plot,
~ site:plot, and the nested forms ~ site / plot and
~ plot %in% site all describe groups formed from site and plot.
Standard formula expansion and subtraction are honoured, so, for example,
~ . - unused uses all variables in data except unused.
Formulas are evaluated with standard model-frame semantics: variables are
looked up first in data and then in the formula environment. Missing
values are retained to preserve alignment with the observations, and
unused factor levels and unobserved combinations are dropped. The formulas
must be one-sided and contain at least one grouping term.