Learn R Programming

multilevelTools (version 0.2.0)

plot.modelDiagnostics.merMod: Plot Diagnostics for an lmer model

Description

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

Usage

# S3 method for modelDiagnostics.merMod
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 lmer().

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 <- lme4::lmer(extra ~ group + (1 | ID), data = sleep)

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

data(aces_daily, package = "JWileymisc")
m <- lme4::lmer(PosAff ~ STRESS + (1 + STRESS | UserID), data = aces_daily)

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