plot.lcc {lcc} | R Documentation |
Diagnostic Plots of an lcc
Object.
Description
Diagnostic plots for conditional error and random effects from the linear mixed-effects fit are obtained. Six plots plots (selectable by 'which') are currently available: a plot of residuals against fitted values, a plot of residuals against time variable, a boxplot of residuals by subject, a plot of observerd values against fitted values, a normal Q-Q plot with simulation envelopes based on conditional error, and a normal Q-Q plot with simulation envelopes based on the random effects. By default, all plots are provided.
Usage
## S3 method for class 'lcc'
plot(x, which = c(1L:6L),
caption = list("Residuals vs Fitted",
"Residuals vs Time",
"Residuals by Subject",
"Observed values vs Fitted values",
"Normal Q-Q Plot (Conditional residuals)",
"Normal Q-Q Plot (Random effects)"),
sub.caption = NULL, main = NULL,
panel = if(add.smooth) panel.smooth else points,
add.smooth = TRUE, ask = TRUE,
id.n = 3, labels.id = names(residuals(x)),
label.pos = c(4, 2), cex.id = 0.75, cex.caption = 1,
cex.oma.man = 1.25, ...)
Arguments
x |
an object inheriting from class |
which |
if a subset of the plots is required, specify a subset of the numbers from 1 to 6. |
caption |
captions to appear above the plots. Vector or list of
valid graphics annotations is required. All captions can be
supressed using '""' or |
sub.caption |
common sub-title (at bottom). Default to
|
main |
The main title (on top) above the caption. |
panel |
panel function. If |
add.smooth |
logical indicating if smoother should be added to
most plots; see also |
ask |
logical; if |
id.n |
number of points to be labelled is the first three plots, starting with the most extreme. |
labels.id |
vector of labels, from which the labels for extreme
points will be chosen. Default to |
label.pos |
positioning of labels, for the left half and right half of the graph respectively, for plots 1-3. |
cex.id |
magnification of point label. |
cex.caption |
controls the size of |
cex.oma.man |
controls the size of the |
... |
further graphical parameters from 'par'. |
Details
The Q-Q plot uses the normalized residuals. The standardized residuals is pre-multiplied by the inverse square-root factor of the estimated error correlation matrix while the random effects is pre-multiplied by the inverse square root of the estimated variances obtained from matrix G. The simulate envelopes are obtained from package hnp (Moral et al., 2018).
Code partially adapted from plot.lm
.
Value
Return plots for conditional error and random effects from the linear mixed-effects
Author(s)
Thiago de Paula Oliveira, thiago.paula.oliveira@alumni.usp.br
See Also
lccPlot
, lcc
,
mtext
, text
, plotmath
Examples
## Second degree polynomial model with random intercept, slope and
## quadratic term
fm1 <- lcc(data = hue, subject = "Fruit", resp = "H_mean",
method = "Method", time = "Time", qf = 2, qr = 2)
plot(fm1)