plot_regression: Plot fitted values versus outcome for regression objects.

View source: R/utils_plotting.R

plot_regressionR Documentation

Plot fitted values versus outcome for regression objects.

Description

Generates a point plot with for the fitted and outcome values for regression predictions with a fitted trend as an option.

Usage

plot_regression(
  predx_object,
  x_var = ".outcome",
  y_var = ".fitted",
  point_size = 2,
  point_shape = 21,
  point_color = "steelblue",
  point_wjitter = 0.01,
  point_hjitter = 0.01,
  point_alpha = 0.75,
  show_trend = TRUE,
  trend_method = "lm",
  show_calibration = TRUE,
  line_size = 0.5,
  plot_title = NULL,
  plot_subtitle = NULL,
  plot_tag = NULL,
  x_lab = x_var,
  y_lab = y_var,
  cust_theme = ggplot2::theme_classic(),
  ...
)

Arguments

predx_object

a predx object.

x_var

name of the variable presented in the X axis.

y_var

name of the variable presented in the Y axis.

point_size

size of the plot points.

point_shape

shape of the points.

point_color

color of the data points.

point_wjitter

horizontal jittering of the points.

point_hjitter

vertical jittering of the points.

point_alpha

plot point alpha.

show_trend

logical, should a trend line be displayed?

trend_method

a method for fitting the trend line, see geom_smooth for details, defaults to 'lm'.

show_calibration

logical, should a line with slope 1 and intercept 1 be displayed in the plot?

line_size

size of the calibration or trend line.

plot_title

plot title.

plot_subtitle

plot subtitle.

plot_tag

plot tag, number of complete observations if not specified by the user.

x_lab

X axis title.

y_lab

Y axis title.

cust_theme

customized plot theme provided by the user.

...

extra arguments passed to geom_smooth.

Details

The fitted trend is generated by geom_smooth.

Value

returns a ggplot object.


PiotrTymoszuk/caretExtra documentation built on Oct. 15, 2023, 10:03 p.m.