Function simulates a response data frame so that it adds
Gaussian error to the fitted responses of Redundancy Analysis
(rda
), Constrained Correspondence Analysis
(cca
) or distancebased RDA (capscale
).
The function is a special case of generic simulate
, and
works similarly as simulate.lm
.
1 2 3 
object 
an object representing a fitted 
nsim 
number of response matrices to be simulated. Only one
dissimilarity matrix is returned for 
seed 
an object specifying if and how the random number
generator should be initialized (â€˜seededâ€™). See

indx 
Index of residuals added to the fitted values, such as
produced by 
rank 
The rank of the constrained component: passed to

correlated 
Are species regarded as correlated in parametric
simulation or when 
... 
additional optional arguments (ignored). 
The implementation follows "lm"
method of
simulate
, and adds Gaussian (Normal) error to the fitted
values (fitted.rda
) using function rnorm
if correlated = FALSE
or mvrnorm
if
correlated = TRUE
. The standard deviations (rnorm
)
or covariance matrices for species (mvrnorm
) are
estimated from the residuals after fitting the constraints.
Alternatively, the function can take a permutation index that is used
to add permuted residuals (unconstrained component) to the fitted
values. Raw data are used in rda
. Internal Chisquare
transformed data are used in cca
within the function,
but the returned matrix is similar to the original input data. The
simulation is performed on internal metric scaling data in
capscale
, but the function returns the Euclidean
distances calculated from the simulated data. The simulation uses
only the real components, and the imaginary dimensions are ignored.
If nsim = 1
, returns a matrix or dissimilarities (in
capscale
) with similar additional arguments on random
number seed as simulate
. If nsim > 1
, returns a
similar array as returned by simulate.nullmodel
with
similar attributes.
Jari Oksanen
simulate
for the generic case and for
lm
objects, and simulate.nullmodel
for
community null model simulation. Functions fitted.rda
and fitted.cca
return fitted values without the error
component. See rnorm
and mvrnorm
(MASS package) for simulating Gaussian random error.
1 2 3 4 5 6 7 8 9 10  data(dune)
data(dune.env)
mod < rda(dune ~ Moisture + Management, dune.env)
## One simulation
update(mod, simulate(mod) ~ .)
## An impression of confidence regions of site scores
plot(mod, display="sites")
for (i in 1:5) lines(procrustes(mod, update(mod, simulate(mod) ~ .)), col="blue")
## Simulate a set of null communities with permutation of residuals
simulate(mod, indx = shuffleSet(nrow(dune), 99))

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.