autoplot.residuals_lmm: Graphical Display of the Residuals

View source: R/autoplot.R

autoplot.residuals_lmmR Documentation

Graphical Display of the Residuals

Description

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

Usage

## S3 method for class 'residuals_lmm'
autoplot(
  object,
  type = NULL,
  type.residual = NULL,
  by.repetition = TRUE,
  engine.qqplot = "ggplot2",
  add.smooth = TRUE,
  digits.cor = 2,
  size.text = 16,
  mean.size = c(3, 1),
  ci.alpha = 0.25,
  scales = "free",
  labeller = "label_value",
  ...
)

## S3 method for class 'residuals_lmm'
plot(x, ...)

Arguments

object, x

an object of class residuals_lmm, output of the residuals.lmm function.

type

[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?

type.residual

[character] Type of residual for which the graphical representation should be made.

by.repetition

[logical] Should a seperate graphical display be made for each repetition.

engine.qqplot

[character] Should ggplot2 or qqtest be used to display quantile-quantile plots? Only used when argument type is "qqplot".

add.smooth

[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".

digits.cor

[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".

size.text

[numeric, >0] Size of the font used to displayed text when using ggplot2.

mean.size

[numeric vector of length 2] size of the point and line for the mean trajectory.

ci.alpha

[numeric, 0-1] When not NA, transparency parameter used to display the confidence intervals.

scales, labeller

[character] Passed to ggplot2::facet_wrap.

...

Not used. For compatibility with the generic method.

Value

A list with two elements

  • data: data used to generate the plot.

  • plot: ggplot object.

Functions

  • plot(residuals_lmm): Graphical Display of the Residuals


LMMstar documentation built on Nov. 9, 2023, 1:06 a.m.