lcc (version 1.1.0)

plot.lcc: 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 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 lcc, representing a fitted longitudinal concordance correlation function.

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 NA.

sub.caption

common sub-title (at bottom). Default to NULL.

main

The main title (on top) above the caption.

panel

panel function. If add.smooth = TRUE, panel.smooth is used rather than points.

add.smooth

logical indicating if smoother should be added to most plots; see also panel above. Defaults to TRUE.

ask

logical; if TRUE, the default, the user is _ask_ed before each plot, see par.

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 NULL (uses observation numbers).

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 caption.

cex.oma.man

controls the size of the sub.caption only if that is _above_ the figures when there is more than one.

...

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.

See Also

lccPlot, lcc, mtext, text, plotmath

Examples

Run this code
# NOT RUN {
## 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)
# }

Run the code above in your browser using DataCamp Workspace