oecosimu(comm, nestfun, method, nsimul = 99, burnin = 0, thin = 1,
statistic = "statistic", ...)
commsimulator(x, method, thin=1)
"swap"
and "tswap"
."swap"
and "tswap"
.nestedfun
oecosimu
returns the result of nestfun
with one added component called oecosimu
. The oecosimu
component contains the simulated values of the statistic (item
simulated
), the name of the method
, two-sided $P$
value and z-value of the statistic based on simulation. The
commsimulator
returns a null model matrix or a swap of the
input matrix.oecosimu
is a wrapper that evaluates a nestedness
statistic using function given by nestfun
, and then simulates a
series of null models using commsimulator
, and evaluates the
statistic on these null models. The nestedchecker
, nesteddisc
,
nestedn0
, nestedtemp
), but many other
functions can be used as long as they are meaningful with binary
community models. An applicable function must return either the
statistic as a plain number, or as a list element "statistic"
(like chisq.test
), or in an item whose name is given in
the argument statistic
. The statistic can be a single number
(like typical for a nestedness index), or it can be a vector. The
vector indices can be used to analyse site (row) or species (column)
properties, see treedive
for an example. Function commsimulator
implements null models for community
composition. The implemented models are r00
which maintains the
number of presences but fills these anywhere so that neither species
(column) nor site (row) totals are preserved. Methods r0
,
r1
and r2
maintain the site (row) frequencies. Method r0
fills presences anywhere on the row with no respect to species (column)
frequencies, r1
uses column marginal
frequencies as probabilities, and r2
uses squared column
sums. Methods r1
and r2
try to simulate original species
frequencies, but they are not strictly constrained. All these methods
are reviewed by Wright et al. (1998). Method c0
maintains
species frequencies, but does not honour site (row) frequencies (Jonsson
2001).
The other methods maintain both row and column frequencies.
Methods swap
and tswap
implement sequential methods,
where the matrix is changed only little in one step, but the changed
matrix is used as an input if the next step.
Methods swap
and tswap
inspect random 2x2 submatrices
and if they are checkerboard units, the order of columns is
swapped. This changes the matrix structure, but does not influence
marginal sums (Gotelli & Entsminger
2003). Method swap
inspects submatrices so long that a swap
can be done. tswap
or trial swap. Function commsimulator
makes
only one trial swap in time (which probably does nothing),
but oecosimu
estimates how many
submatrices are expected before finding a swappable checkerboard,
and uses that ratio to thin the results, so that on average one swap
will be found per step of tswap
. However, the checkerboard
frequency probably changes during swaps, but this is not taken into
account in estimating the thin
. One swap still changes the
matrix only little, and it may be useful to
thin the results so that the statistic is only evaluated after
burnin
steps (and thin
ned).
Methods quasiswap
and backtracking
are not sequential,
but each call produces a matrix that is independent of previous
matrices, and has the same marginal totals as the original data. The
recommended method is quasiswap
which is much faster because
it is implemented in C. Method bactkracking
is provided for
comparison, but it is so slow that it may be dropped from future
releases of quasiswap
(backtracking
implements a filling method with constraints both for row and column
frequencies (Gotelli & Entsminger 2001). The matrix is first filled
randomly using row and column frequencies as probabilities. Typically
row and column sums are reached before all incidences are filled in.
After that begins quasiswap
method is not sequential, but it produces
a random incidence matrix with given marginal totals.
Gotelli, N.J. & Entsminger, N.J. (2003). Swap algorithms in null model analysis. Ecology 84, 532--535.
Jonsson, B.G. (2001) A null model for randomization tests of nestedness in species assemblages. Oecologia 127, 309--313.
Wright, D.H., Patterson, B.D., Mikkelson, G.M., Cutler, A. & Atmar, W. (1998). A comparative analysis of nested subset patterns of species composition. Oecologia 113, 1--20.
r2dtable
generates table with given marginals but
with entries above one. Functions permatfull
and
permatswap
generate Null models for count data.
Function rndtaxa
(nestedtemp
(that also discusses other nestedness
functions) and treedive
for another application.## Use the first eigenvalue of correspondence analysis as an index
## of structure: a model for making your own functions.
data(sipoo)
out <- oecosimu(sipoo, decorana, "swap", burnin=100, thin=10, statistic="evals")
out
## Inspect the swap sequence
matplot(t(out$oecosimu$simulated), type="l")
Run the code above in your browser using DataLab