Skip to contents

The plot method of a semdplot_residuals-class object. It generates the residual plots based on the output of casewise_residuals().

Usage

# S3 method for semdplot_residuals
plot(
  x,
  what = c("partial", "residual"),
  x_names = NULL,
  y_names = NULL,
  same_x_range = TRUE,
  same_y_range = TRUE,
  partial_point_aes = list(),
  partial_loess_aes = list(),
  partial_reg_aes = list(),
  partial_b_aes = list(),
  partial_theme_aes = list(),
  added_point_aes = list(),
  added_loess_aes = list(),
  added_reg_aes = list(),
  added_b_aes = list(),
  added_theme_aes = list(),
  resid_hist_aes = list(),
  resid_density_aes = list(),
  resid_theme_aes = list(),
  resid_ellipse_aes = list(),
  text_nopath = "--",
  output_type = c("plot", "list"),
  ...
)

Arguments

x

A semdplot_residuals-class object, such as the output of casewise_residuals(). Named x as required for the plot method.

what

String. What to plot. Can be "partial" or "residual". if "partial", the default, a matrix of partial plots and/or plots of residuals will be plotted. If "residual", then only the plots of residuals of y-variable will be plotted.

x_names

Character vector. The x-variables. If the vector is named, the names will be used instead of the variable names in the plots.

y_names

Character vector. The y-variables. If the vector is named, the names will be used instead of the variable names in the plots.

same_x_range

Whether all plots will have the same range for the x-axis. Default is TRUE.

same_y_range

Whether all plots will have the same range for the y-axis, except for the plots of residuals. Default is TRUE.

partial_point_aes

A list of argument for ggplot2::geom_point(). Used to modify the default aesthetics of the points in the partial plot.

partial_loess_aes

A list of argument for ggplot2::geom_line() for the loess line. Used to modify the default aesthetics of the line in the partial plot.

partial_reg_aes

A list of argument for ggplot2::geom_line() for the regression line. Used to modify the default aesthetics of the line in the partial plot.

partial_b_aes

A list of argument for ggplot2::annotate() for the standardized regression coefficient. Used to modify the default aesthetics of the text in the partial plot.

partial_theme_aes

A list of argument for ggplot2::theme() for the partial plots. Used to modify the default theme of the partial plot.

added_point_aes

A list of argument for ggplot2::geom_point(). Used to modify the default aesthetics of the points in the added-variable plot.

added_loess_aes

A list of argument for ggplot2::geom_line() for the loess line. Used to modify the default aesthetics of the line in the added-variable plot.

added_reg_aes

A list of argument for ggplot2::geom_line() for the regression line. Used to modify the default aesthetics of the line in the added-variable plot.

added_b_aes

A list of argument for ggplot2::annotate() for the standardized regression coefficient. Used to modify the default aesthetics of the text in the added-variable plot.

added_theme_aes

A list of argument for ggplot2::theme() for the added-variable plots. Used to modify the default theme of the added-variable plot.

resid_hist_aes

A list of arguments for ggplot2::geom_histogram() for the plot of residuals. Use to modify the default aesthetics of the histogram.

resid_density_aes

A list of arguments for ggplot2::geom_density() for the plot of residuals. Use to modify the default aesthetics of the density plot.

resid_theme_aes

A list of argument for ggplot2::theme() for the plots of residuals. Used to modify the default theme of the plot of residual.

resid_ellipse_aes

A list of arguments for ggplot2::stat_ellipse() for the plot of residuals. Use to modify the default aesthetics of the ellipse.

text_nopath

String. Text to display in empty cells. Default is`"--".

output_type

The type of output. If "plot", the default, the plots will be processed by patchwork::wrap_plots(). If "list", the list of plots will be returned.

...

Additional arguments. Not used.

Value

A ggplot2 plot, or a list of ggplot2 plots.

Details

It currently supports the output of casewise_residuals().

Examples

# \donttest{
# TODO: Prepare some examples.
# }