object
is fit to the data. Using
the fitted values of the parameters, nsim
new data vectors from
this model are simulated. Both object
and m2
are fit by
maximum likelihood (ML) and/or by restricted maximum likelihood (REML)
to each of the simulated data vectors.# S3 method for lme
simulate(object, nsim = 1, seed = , m2,
method = c("REML", "ML"), niterEM = c(40, 200), useGen, …)
"lme"
object or a list, like object
containing a second lme model specification. This argument defines
the alternative model. If given as a list, only those parts of the
specification that change between model object
and m2
need to be specified.set.seed
. Defaults to
a random integer.
"REML"
the models are fit by maximizing the restricted
log-likelihood. If it includes "ML"
the log-likelihood is
maximized. Defaults to c("REML", "ML")
, in which case both
methods are used.1
. This has
changed. Previously the default was 1000.
object
and m2
to each simulated set of data. Defaults to c(40,200)
.
TRUE
, numerical derivatives are
used to obtain the gradient and the Hessian of the log-likelihood in
the optimization algorithm in the ms
function. If
FALSE
, the default algorithm in ms
for functions that
do not incorporate gradient and Hessian attributes is used. Default
depends on the "pdMat"
classes used in object
and m2
:
if both are standard classes (see pdClasses
) then
defaults to TRUE
, otherwise defaults to FALSE
.
simulate.lme
with components null
and
alt
. Each of these has components ML
and/or REML
which are matrices. An attribute called Random.seed
contains
the seed that was used for the random number generator.lme
, set.seed
<!-- % takes too long for routine R CMD check -->
orthSim <-
simulate.lme(list(fixed = distance ~ age, data = Orthodont,
random = ~ 1 | Subject), nsim = 200,
m2 = list(random = ~ age | Subject))
<!-- % dont ==> check in ../tests/predict.lme.R -->
Run the code above in your browser using DataLab