simulate.rda: Simulate Responses with Gaussian Error or Permuted Residuals...

Description Usage Arguments Details Value Author(s) See Also Examples

Description

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 distance-based RDA (capscale). The function is a special case of generic simulate, and works similarly as simulate.lm.

Usage

1
2
## S3 method for class 'rda'
simulate(object, nsim = 1, seed = NULL, indx = NULL, rank = "full", ...)

Arguments

object

an object representing a fitted rda model.

nsim

number of response vectors to simulate. (Not yet used, and values above 1 will give an error).

seed

an object specifying if and how the random number generator should be initialized (‘seeded’). See simulate for details.

indx

Index of residuals added to the fitted values, such as produced by permuted.index, shuffle or sample. The index can have duplicate entries so that bootstrapping is allowed. If null, parametric simulation is used and Gaussian error is added to the fitted values.

rank

The rank of the constrained component: passed to predict.rda or predict.cca.

...

additional optional arguments (ignored).

Details

The implementation follows "lm" method of simulate, and adds Gaussian (Normal) error to the fitted values (fitted.rda) using function rnorm. The standard deviations are estimated independently for each species (column) 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 Chi-square transformed data in cca within the function, but the returned data frame 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.

Value

Returns a data frame with similar additional arguments on random number seed as simulate.

Author(s)

Jari Oksanen

See Also

simulate for the generic case and for lm objects. Functions fitted.rda and fitted.cca return fitted values without the error component.

Examples

1
2
3
4
5
6
7
8
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")

pattakosn/Rworkshop documentation built on May 24, 2019, 8:22 p.m.