simulate {Matrix} | R Documentation |
This generic function generates a sample of responses from a fitted model object using the parameter estimates from the fit. Typically these simulated responses are used in a parametric bootstrap sample of a test statistic.
simulate(object, nsim, seed, ...)
object |
an object representing a fitted model. |
nsim |
number of response vectors to simulate. Defaults to 1. |
seed |
an integer that will be used in a call to set.seed
before simulating the response vectors. The value is saved as an
attribute named "seed" in the returned value. Defaults to a
random integer between 0 and .Machine$integer.max . |
... |
additional optional arguments. |
A data frame with nsim
columns and nobs
, the number
of observations in the fitted model object
, rows.
"object"
.(fm2 <- lmer(Reaction ~ Days + (1|Subject) + (0 + Days|Subject), sleepstudy)) sim2 <- simulate(fm2, nsim = 4) head(sim2) tail(sim2)