autoplot.residuals_lmm {LMMstar}R 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,
  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 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.

time.var

[character] x-axis variable for the plot. Only relevant when argument type is one of "scatterplot", "scatterplot2", "partial", "partial-center",

facet

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

facet_nrow

[integer] number of rows of panels in the graphical display.

facet_ncol

[integer] number of columns of panels in the graphical display.

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.

color

[character] color of the dots representing the observations. When displaying partial residuals, should contain a second color indicating how to display the model fit.

obs.size

[numeric vector] size of the dots representing the observations.

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.

position

[character] relative position of the points when colored according to a variable.

scales, labeller

[character] Passed to ggplot2::facet_wrap.

...

Not used. For compatibility with the generic method.

Value

A list with two elements

Functions


[Package LMMstar version 1.1.0 Index]