Nonlinear Mixed Effects Models

Mixed-effects models provide a powerful and flexible tool for analyzing grouped data, that is, data that can be classified according to one or more grouping variables. Mixed-effects models incorporate both fixed and random effects:

__image\ebd_ebd58.gif Fixed effects are parameters associated with an entire population, or with repeatable levels of experimental factors.

__image\ebd_ebd59.gif Random effects are instead associated with experimental units drawn at random from a population.

Such models typically describe relationships between a response variable and some covariates in data grouped according to one or more classification factors. Common applications are longitudinal data, repeated measures data, multilevel data, and block designs. Mixed-effects models flexibly represent the covariance structure induced by the grouping of the data by associating common random effects to observations sharing the same level of a classification factor.

The parameters in a Mixed-Effects model are the fixed effects coefficients, the variance-covariance matrix of the random effects, plus the variance of the noise term. These parameters are estimated by maximum likelihood (ML) or by restricted maximum likelihood (REML). Best Linear Unbiased Predictors of the random effects are also estimated.

The Fixed-Effects part of the Non-linear Mixed Effects model assumes that the response is obtained by a non-linear model on the predictors. If the predictors affect the response in a linear way, the Linear Mixed-Effects dialog may be appropriate.

The within-group errors have a Gaussian (normal) distribution and are allowed to be correlated and/or to have unequal variances.

The Compare Models dialog can be used to compare two Non-linear Mixed Effects Models (models of class nlme) fitted using this dialog.

Choose Statistics __image\arrow5.gif Mixed Effects __image\arrow5.gif Nonlinear. The dialog shown below appears.

Model page

The Model page allows you to specify the basic parameters of the non-linear mixed-effects model that S-PLUS will fit. The data sets used for fitting mixed-effects models typically contain measurements of a continuous response variable, at several levels of a covariate (for example, time, dose, or treatment), grouped according to one or more classification factors. Additional covariates may also be present, some may vary within a group (inner covariates), and some may not (outer covariates).

__image\nlme1.gif

In the Nonlinear Mixed Effects Models, the Model page has the following options:

Data

Data Set

Select a data set from the dropdown list or type the name of a data set. You can also type into the Data Set edit field any expression that evaluates to a data set.

Subset Rows

Enter an S-PLUS expression that identifies the rows to use in the analysis. To use all the rows in the data set, leave this field blank.

Omit Rows with Missing Values

Select this box to omit from the analysis any rows in the data set that contain missing values for any of the variables in the model.

Effects

Fixed

A two-sided linear formula of the form f1+...+fn ~ x1+...+xm, or a list of two-sided formulas of the form f1~x1+...+xm, with possibly different models for each fixed effect (parameter) in the model.

Random

Optionally, a one-sided formula specifying the random effects and the grouping variables.

Model

Formula

Enter a two-sided formula object specifying the nonlinear model to be fitted. It may include a self-starting function. For example

weight ~ SSlogis(Time, Asym, xmid, scal)

See the help file for nls for a list of available self-starting functions in S-PLUS.

Parameters (name=value)

Enter a numeric vector, or list of initial estimates for the fixed effects and random effects.

Save Model Object

Save Model Object

In the Save As field, enter the name for the object in which to save the results of the analysis. If an object with this name already exists, its contents are overwritten. The model object can be used in later functions such as plotting.

Options page

__image\nlme2.gif

In the Nonlinear Mixed Effects Models, the Options page has the following options:

Within Group Variance

The variance functions are used to model heteroscedasticity in the within-group error.

Optimization Options

Method Choose the fitting method. REML (the default) fits by maximizing the restricted log-likelihood. ML maximizes the log-likelihood.

Control Enter a list of control values for the estimation algorithm to replace the default values returned by the function lmeControl. Defaults to an empty list.

Within-Group Correlation

Correlation structures are used to model within-group correlation not captured by the random effects. These are generally associated with temporal or spatial dependencies.

Results page

__image\nlme3.gif

In the Nonlinear Mixed Effects Models, the Results page has the following options:

Printed Results

Short Output for Mixed Effects Models

Display a short summary of the model fit to the designated output window. This includes the model call, random effects, the number of observations, and the number of groups.

Long Output for Mixed Effects Models

Display a detailed summary of the model fit to the designated output window. This includes the model call, random effects, fixed effects, standardized within-group residuals, the number of observations, and the number of groups.

ANOVA Table

Display an analysis of variance table. The sums-of-squares in the table are for the terms added sequentially (Type I sums-of-squares).

Saved Results

Save In

Enter the name of a data set in which a part of the analysis, such as fitted values and residuals, predictions, confidence intervals, or standard errors, is saved.

Levels

Select an integer giving the level(s) of grouping to be used in extracting the residuals. Level values increase from outermost to innermost grouping, with level zero corresponding to the population residuals. The default is the highest or innermost level of grouping.

Fitted Values

Save the fitted values from the model in the object specified in Save In.

Pearson Residuals

Select to save the Pearson residuals. They are a rescaled version of the working residuals. Their sums-of-squares is the chi-squared statistic.

Normalized Residuals

Select this to save the normalized residuals.

Response Residuals

Select to save the response residuals. These are the ordinary residuals (the response minus the fitted value).

Plot page

__image\nlme4.gif

In the Nonlinear Mixed Effects Models, the Plot page has the following options:

Plots

Residuals vs Fit

Select this to display a plot of the residuals versus the fitted values.

Sqrt Abs Residuals vs Fit

Display a plot of the square root of the absolute values of the residuals versus the fitted values. This plot is useful for checking for the constant variance assumption of the model.

Response vs Fit

Display a plot of the response variable versus the fitted values. The line y = x is also drawn on the graph.

Residuals Normal QQ

Display a normal quantile-quantile plot of the residuals.

Augmented Predictions

Select this to obtain a plot of predictions versus the primary covariate, with a different panel for each value of the grouping factor.

Autocorrelation of Residuals

Select this to plot the empirical autocorrelation function for the within-group residuals from the mixed-effects model fitted.

Variogram of Residuals

Select this to plot the semi-variogram for the within-group residuals.

Random Effects Dot

A Trellis dot-plot of the random effects is generated, with a different panel for each random effect (coefficient).

Random Effects Scatter

Select this for a scatter plot of estimated random effects.

Random Effects Normal QQ

Select this for a diagnostic plot for assessing the normality of residuals and random effects in the linear mixed-effects fit

Specified Formula

Select this to activate the formula field thereby adding considerable flexibility to the type of plot obtained from the linear mixed-effects object.

Specified Formula Options

The formula gives considerable flexibility in the type of plot specification. A conditioning expression (on the right side of a | operator) always implies that different panels are used for each group.

General Options

Group Variables A panel will be produced for each level of the variable selected here.

Include Grid Select this if you want a grid to be added to the plot.

Augmented Prediction Options

Levels Integer specifying the desired prediction level. Levels increase from outermost to innermost grouping, with level 0 representing the population (fixed effects) predictions. Defaults to the innermost level.

Primary Covariate Covariate to be used to generate the augmented predictions. By default, if a covariate can be extracted from the data used to generate object it will be used as primary.

Minimum lower limit for the primary covariate. Defaults to min(primary)

Maximum upper limit for the primary covariate. Defaults to max(primary)

Number of Values the number of primary covariate values at which to evaluate the predictions. Defaults to 51.

Variogram Options

The semi-variogram for the within-group residuals from an linear mixed effects model fit is calculated for pairs of residuals within the same group.

Formula Choose a variable to be used for calculating the distances between residual pairs, preceded by a "~". For example, enter "~ Time" to specify a formula for the covariate Time.

Random Effects Options

Levels Integer value giving the level of grouping to be used for the random effects plot.

Predict page

__image\nlme5.gif

In the Nonlinear Mixed Effects Models, the Predict page has the following options:

Standard Predictions

Save Predictions

Select this to save the standard predictions.

Save In

Enter the name of a data set in which a part of the analysis, such as fitted values and residuals, predictions, confidence intervals, or standard errors, is saved. If an object with the name you enter does not already exist (in database 1), then it is created

Levels

Choose an integer specifying the desired prediction level. Levels increase from outermost to innermost grouping, with level 0 representing the population (fixed effects) predictions. Defaults to the innermost level.

New Data

Enter the name of a matrix or data set to use for computing predictions. It must contain the same names as the terms in the right side of the formula for the model. If omitted, the original data are used for computing predictions.

Augmented Predictions

Save Augmented Predictions

Select this to save the augmented predictions.

Save In

Enter the name of a data set in which a part of the analysis, such as fitted values and residuals, predictions, confidence intervals, or standard errors, is saved. If an object with the name you enter does not already exist (in database 1), then it is created

Levels

Choose an integer specifying the desired prediction level. Levels increase from outermost to innermost grouping, with level 0 representing the population (fixed effects) predictions. Defaults to the innermost level.

Primary Covariate

Choose a covariate to be used to generate the augmented predictions. By default, if a covariate can be extracted from the data used to generate the object, it will be used as primary.

Minimum

Enter a lower limit for the primary covariate. Defaults to min(primary).

Maximum

Enter an upper limit for the primary covariate. Defaults to max(primary).

Number of Values

Enter the number of primary covariate values at which to evaluate the predictions. Defaults to 51.

S-Plus language functions related to Nonlinear Mixed Effects Models

NlmeControl, nlme.nlsList, nlmeObject, nlsList, reStruct, varFunc, pdClasses, corClasses, varClasses