Graphical representation of the residuals from a linear mixed model.
Require a long format (except for the correlation where both format are accepted) and having exported the dataset along with the residual (argument keep.data
when calling residuals.lmm
).
# S3 method for residuals_lmm
autoplot(
object,
type = NULL,
type.residual = NULL,
time.var = NULL,
facet = NULL,
facet_nrow = NULL,
facet_ncol = NULL,
engine.qqplot = "ggplot2",
add.smooth = TRUE,
digits.cor = 2,
size.text = 16,
color = NULL,
obs.size = NULL,
mean.size = c(3, 1),
ci.alpha = 0.25,
position = NULL,
scales = "fixed",
labeller = "label_value",
...
)# S3 method for residuals_lmm
plot(x, ...)
A list with two elements
data
: data used to generate the plot.
plot
: ggplot object.
an object of class residuals_lmm
, output of the residuals.lmm
function.
[character] Should a qqplot ("qqplot"
), or a heatmap of the correlation between residuals ("correlation"
, require wide format), or a plot of residuals along the fitted values ("scatterplot"
, require long format) be displayed?
[character] Type of residual for which the graphical representation should be made.
[character] x-axis variable for the plot. Only relevant when argument type is one of "scatterplot"
, "scatterplot2"
, "partial"
, "partial-center"
,
[formula] split the plot into a matrix of panels defined by the variables in the formula.
Internally it calls ggplot2::facet_wrap
or ggplot2::facet_grid
depending on whether the formula contains a variable on the left hand side.
[integer] number of rows of panels in the graphical display.
[integer] number of columns of panels in the graphical display.
[character] Should ggplot2 or qqtest be used to display quantile-quantile plots?
Only used when argument type
is "qqplot"
.
[logical] should a local smoother be used to display the mean of the residual values across the fitted values.
Only relevant for when argument type
is "scatterplot"
.
[integer, >0] Number of digit used to display the correlation coefficients?
No correlation coefficient is displayed when set to 0. Only used when argument plot
is "correlation"
.
[numeric, >0] Size of the font used to displayed text when using ggplot2.
[character] color of the dots representing the observations. When displaying partial residuals, should contain a second color indicating how to display the model fit.
[numeric vector] size of the dots representing the observations.
[numeric vector of length 2] size of the point and line for the mean trajectory.
[numeric, 0-1] When not NA, transparency parameter used to display the confidence intervals.
[character] relative position of the points when colored according to a variable.
[character] Passed to ggplot2::facet_wrap
.
Not used. For compatibility with the generic method.
plot(residuals_lmm)
: Graphical Display of the Residuals