Learn R Programming

multilevelTools (version 0.2.0)

plot.modelDiagnostics.lme: Plot Diagnostics for an lme model

Description

This function creates a number of diagnostic plots from lme models.

Usage

# S3 method for modelDiagnostics.lme
plot(x, y, plot = TRUE, ask = TRUE, ncol = 1, nrow = 1, ...)

Value

a list including plots of the residuals, residuals versus fitted values, and one list for plots of all random effects

Arguments

x

A fitted model object from lme().

y

Included to match the generic. Not used.

plot

A logical value whether or not to plot the results or simply return the graaphical objects.

ask

A logical whether to ask before changing plots. Only applies to interactive environments.

ncol

The number of columns to use for plots. Defaults to 1.

nrow

The number of rows to use for plots. Defaults to 1.

...

Included to match the generic. Not used.

Examples

Run this code

library(JWileymisc)
sleep[1,1] <- NA
m <- nlme::lme(extra ~ group, data = sleep, random = ~ 1 | ID, na.action = "na.omit")

md <- modelDiagnostics(m, ev.perc = .1)
md$extremeValues

plot(md)

data(aces_daily, package = "JWileymisc")
m <- nlme::lme(PosAff ~ STRESS, data = aces_daily,
  random = ~ 1 + STRESS | UserID, na.action = "na.omit")

md <- modelDiagnostics(m, ev.perc = .001)
md$extremeValues
plot(md$modelDiagnostics[[2]][[2]])
plot(md, ncol = 2, nrow = 2)
plot(md, ncol = 2, nrow = 3)

rm(m, md, sleep)

Run the code above in your browser using DataLab