oecosimu(comm, nestfun, method, nsimul = 99, burnin = 0, thin = 1, ...)
nestedchecker(comm)
nestedn0(comm)
nesteddisc(comm)
commsimulator(x, method, thin=1)
statistic
. See Examples for defining your ow"swap"
and "tswap"
."swap"
and "tswap"
.commsimulator
.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. The result returned by
nestedness function must contain item called statistic
, but
the other components differ among functions. 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
nestedness statistic on these null models. The Function netstedchecker
gives the number of checkerboard
units, or 2x2 submatrices where both species occur once but on
different sites (Stone & Roberts 1990). Function nestedn0
implements nestedness measure N0 which is the number of absences
from the sites which are richer than the most pauperate site species
occurs (Patterson & Atmar 1986). Function nesteddisc
implements discrepancy index which is the number of ones that should
be shifted to fill a row with ones in a table arranged by species
frequencies (Brualdi & Sanderson 1999).
In addition to these functions provided in comm
as the first argument, and
returns the nestedness index in item statistic
. Function
chisq.test
is such a function, and examples show how
to do this in general. If you write a function that may be useful
to others, please consider submitting it to
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
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
. Both swap methods are sequential,
and the result of the swap is used as the input of the next swap. 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
thin
steps.
Method 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
(quasiswap
method is not sequential, but it produces
a random incidence matrix with given marginal totals.
Gotelli, N.J. & Entsminger, N.J. (2001). Swap and fill algorithms in null model analyis: rethinking the knight's tour. Oecologia 129, 281--291.
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.
Stone, L. & Roberts, A. (1990). The checkerboard score and species distributions. Oecologia 85, 74--79.
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. Function rndtaxa
(data(sipoo)
nestedchecker(sipoo)
## Use the first eigenvalue of correspondence analysis as an index
## of structure: a model for making your own functions.
## This is a minimal structure; fancier functions give fancier results
caeval <- function(x) list(statistic = decorana(x, ira=1)$evals[1])
out <- oecosimu(sipoo, caeval, "swap", burnin=100, thin=5)
out
## Inspect the swap sequence
plot(out$oecosimu$simulated, type="l")
Run the code above in your browser using DataLab