simulate_lme: Simulate values from an object of class lme
Description
Simulate values from an object of class lme. Unequal variances,
as modeled using the ‘weights’ option are supported, and there is
experimental code for considering the ‘correlation’ structure.
Usage
simulate_lme(
object,
nsim = 1,
psim = 1,
value = c("matrix", "data.frame"),
data = NULL,
...
)
Value
It returns a vector with simulated values with length equal to the number of rows
in the original data
parameter simulation level, 0: for fitted values, 1: for simulation from
fixed parameters (assuming a fixed vcov matrix), 2: for simulation considering the
uncertainty in the residual standard error (sigma), this returns data which
will appear similar to the observed values. 3: in addition samples a new set of random effects.
value
whether to return a matrix (default) or an augmented data frame
data
the data argument is needed when using this function inside user defined functions.
...
additional arguments (it is possible to supply a newdata this way)
It uses function mvrnorm to generate new values for the coefficients
of the model using the Variance-Covariance matrix vcov. This variance-covariance matrix
refers to the one for the parameters 'beta', not the one for the residuals.
See Also
predict.lme and ‘simulate.merMod’ in the ‘lme4’ package.