nlmer {lme4}R Documentation

Fit Nonlinear Mixed Models

Description

Fit a nonlinear mixed model with nested or crossed grouping factors for the random effects.

Usage

nlmer(formula, data, control, start, verbose,
     subset, weights, na.action, contrasts,
     model, ...)

Arguments

formula a three part formula object describing the response, the nonlinear model and the fixed and random effects in the model. In the fixed and random effects specification the vertical bar character "|" separates an expression for a model matrix and a grouping factor. At present evaluation of the nonlinear model function must return a gradient attribute.
data an optional data frame containing the variables named in formula. By default the variables are taken from the environment from which nlmer is called.
control a list of control parameters. See below for details.
start a named numeric vector of starting values for the fixed effects parameters or a list that contains an element called "fixef" that has this form. Optionally the list may contain an element called "ST" providing a starting value for the ST slot.
verbose logical scalar - TRUE indicates verbose output from the iterations during the optimization process (highly recommended when difficulties are encountered). Default is FALSE.
subset, weights, na.action, contrasts further model specification arguments as in lm; see there for details.
model logical indicating if the model component should be returned (in slot frame).
... potentially further arguments for methods. Currently none are used.

Details

This is a revised version of the nlme function from the nlme package. This version uses a different method of specifying random-effects terms and allows for fitting generalized linear mixed models as well as linear mixed models.

Additional standard arguments to model-fitting functions can be passed to lmer.

subset
an optional expression indicating the subset of the rows of data that should be used in the fit. This can be a logical vector, or a numeric vector indicating which observation numbers are to be included, or a character vector of the row names to be included. All observations are included by default.
na.action
a function that indicates what should happen when the data contain NAs. The default action (na.fail) causes lme to print an error message and terminate if there are any incomplete observations.
control
a named list of control parameters for the estimation algorithm, specifying only the ones to be changed from their default values. Hence defaults to an empty list.
Possible control options and their default values are:
maxIter:
maximum number of iterations for the lme optimization algorithm. Default is 50.
tolerance:
relative convergence tolerance for the lme optimization algorithm. Default is sqrt(.Machine$double.eps).
msMaxIter:
maximum number of iterations for the nlminb optimization step inside the lme optimization. Default is 200.
msVerbose:
a logical value passed as the trace argument to nlminb (see documentation on that function). Default is getOption("verbose").
niterEM:
number of iterations for the EM algorithm used to refine the initial estimates of the random effects variance-covariance coefficients. Default is 15.
EMverbose:
a logical value indicating if verbose output should be produced during the EM iterations. Default is getOption("verbose").
PQLmaxIt:
maximum number of iterations for the PQL algorithm when fitting generalized linear mixed models. Default is 30.
usePQL:
Should the PQL method be used before switching to general optimization when fitting generalized linear mixed models using method = "Laplace"? Default is FALSE.
model, x
logicals. If TRUE the corresponding components of the fit (the model frame, the model matrices) are returned.

Value

An object of class "nlmer". There are many methods applicable to "nlmer" objects, see the above help page.

See Also

The nlmer class

Examples

(fm1 <- lme4:::nlmer(circumference ~ SSlogis(age, Asym, xmid, scal) ~ Asym|Tree,
                    Orange, verb = 1,
                    start = c(Asym = 192.6872, xmid = 728.7544, scal = 353.5320)))
(fm2 <- lme4:::nlmer(conc ~ SSfol(Dose, Time,lKe, lKa, lCl) ~ (lKe+lKa+lCl|Subject),
                    Theoph, start = c(lKe = -2.5, lKa = 0.5, lCl = -3), verb = 1))
(fm3 <- lme4:::nlmer(conc ~ SSfol(Dose, Time,lKe, lKa, lCl) ~
                     (lKe|Subject) + (lKa|Subject) + (lCl|Subject), Theoph,
                     start = c(lKe = -2.5, lKa = 0.5, lCl = -3), verb = 1))
(fm4 <- lme4:::nlmer(conc ~ SSfol(Dose, Time,lKe, lKa, lCl) ~
                     (lKa+lCl|Subject), Theoph,
                     start = c(lKe = -2.5, lKa = 0.5, lCl = -3), verb = 1))
(fm5 <- lme4:::nlmer(conc ~ SSfol(Dose, Time,lKe, lKa, lCl) ~
                    (lKa|Subject) + (lCl|Subject), Theoph,
                    start = c(lKe = -2.5, lKa = 0.5, lCl = -3), verb = 1))

[Package lme4 version 0.99875-9 Index]