Rev 8026 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File nlme/man/simulate.lme.Rd% Part of the nlme package for R% Distributed under GPL 2 or later: see nlme/LICENCE.note\name{simulate.lme}\title{Simulate Results from \code{lme} Models}\alias{simulate.lme}\alias{plot.simulate.lme} % currently undocumented (needs own help page)\alias{print.simulate.lme}\usage{\method{simulate}{lme}(object, nsim = 1, seed = , m2,method = c("REML", "ML"), niterEM = c(40, 200), useGen, \dots)}\arguments{\item{object}{an object inheriting from class \code{"\link{lme}"}, representing a fittedlinear mixed-effects model, or a list containing an \code{lme} modelspecification. If given as a list, it should containcomponents \code{fixed}, \code{data}, and \code{random}with values suitable for a call to \code{\link{lme}}. This argumentdefines the null model.}\item{m2}{an \code{"\link{lme}"} object or a list, like \code{object}containing a second lme model specification. This argument definesthe alternative model. If given as a list, only those parts of thespecification that change between model \code{object} and \code{m2}need to be specified.}\item{seed}{an optional integer that is passed to \code{set.seed}. Defaults toa random integer.}\item{method}{an optional character array. If it includes\code{"REML"} the models are fit by maximizing the restrictedlog-likelihood. If it includes \code{"ML"} the log-likelihood ismaximized. Defaults to \code{c("REML", "ML")}, in which case bothmethods are used.}\item{nsim}{an optional positive integer specifying the number ofsimulations to perform. Defaults to \code{1}. \bold{This haschanged. Previously the default was 1000.}}\item{niterEM}{an optional integer vector of length 2 giving the number ofiterations of the EM algorithm to apply when fitting the \code{object}and \code{m2} to each simulated set of data. Defaults to \code{c(40,200)}.}\item{useGen}{an optional logical value. If \code{TRUE}, the \code{\link{nlminb}}optimizer is used with numerical derivatives of the log-likelihood. If\code{FALSE}, the \code{\link{nlm}} algorithm is used with ananalytic gradient. The defaultdepends on the \code{"\link{pdMat}"} classes used in \code{object} and \code{m2}:if both are standard classes (see \code{\link{pdClasses}}) thendefaults to \code{FALSE}, otherwise defaults to \code{TRUE}.}\item{\dots}{optional additional arguments. None are used.}}\description{The model \code{object} is fit to the data. Usingthe fitted values of the parameters, \code{nsim} new data vectors fromthis model are simulated. Both \code{object} and \code{m2} are fit bymaximum likelihood (ML) and/or by restricted maximum likelihood (REML)to each of the simulated data vectors.}\value{an object of class \code{simulate.lme} with components \code{null} and\code{alt}. Each of these has components \code{ML} and/or \code{REML}which are matrices. An attribute called \code{seed} containsthe seed that was used for the random number generator.}\references{Pinheiro, J.C., and Bates, D.M. (2000)\emph{Mixed-Effects Models in S and S-PLUS}, Springer.}\author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}}\seealso{\code{\link{lme}}, \code{\link{set.seed}}}\examples{orthSim <-simulate.lme(list(fixed = distance ~ age, data = Orthodont,random = ~ 1 | Subject),nsim = 3, # limited here for speedm2 = list(random = ~ age | Subject))% checked in ../tests/predict.lme.R}\keyword{models}