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

Description Usage Arguments Value Examples

View source: R/plotting.R

Description

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

Usage

1
2
## S3 method for class 'modelDiagnostics.merMod'
plot(x, y, plot = TRUE, ask = TRUE, ncol = 1, nrow = 1, ...)

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.

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
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)

multilevelTools documentation built on March 13, 2020, 2:07 a.m.