plot_class_p: Squared distance to outcome and class assignment probability...

View source: R/utils_plotting.R

plot_class_pR Documentation

Squared distance to outcome and class assignment probability in the outcome classes.

Description

plot_class_p: This internally used function plots squared distances to the outcome (as defined by Brier at al.) and class-assignment probabilities for the outcome classes as scatter plots. The correct/false class assignment is color-coded. The observations are sorted by the statistic value. Numbers of complete observations are indicated in the plot subtitle (if not provided by the user) and class n numbers can be displayed in the plot facets (show_class_n set to TRUE).

plot_class_stats: The function plots squared distances to the outcome (as defined by Brier at al.) and class-assignment probabilities for the outcome classes as box plots. Class n numbers are indicated in the X axis.

Usage

plot_class_p(
  predx_object,
  plot_subtitle = NULL,
  plot_tag = NULL,
  show_class_n = TRUE,
  flip = FALSE,
  point_size = 2,
  hide_obs_labels = TRUE,
  label_misclassified = TRUE,
  txt_size = 2.75,
  txt_color = "firebrick",
  cust_theme = ggplot2::theme_classic()
)

plot_class_stats(
  predx_object,
  plot_subtitle = NULL,
  plot_tag = NULL,
  point_size = 2,
  point_hjitter = 0,
  point_wjitter = 0.1,
  point_alpha = 0.75,
  box_alpha = 0.5,
  cust_theme = ggplot2::theme_classic()
)

Arguments

predx_object

a predx class object.

plot_subtitle

plot subtitle.

plot_tag

plot tag.

show_class_n

logical, should n numbers for classes be presented in the plot facets?

flip

logical, exchange the X and Y axes in the plots?

point_size

size of the data points.

hide_obs_labels

logical, hide labels of single observations?

label_misclassified

logical, should misclassified observation be labeled with their numbers?

txt_size

size of the text in the observation labels. Ignored if label_misclassified is set to FALSE.

txt_color

color of the text in the observation labels. Ignored if label_misclassified is set to FALSE.

cust_theme

a custom ggplot theme.

point_hjitter

height of the data point jittering.

point_wjitter

width of the data point jittering.

point_alpha

alpha of the data points.

box_alpha

alpha of the box plots.

Details

For regression, NULL and a warning is returned.

Value

a list of ggplot graphics: one plot for squared distances (square_dist) and one plot for class assignment probabilities (winner_p).

References

Brier GW. VERIFICATION OF FORECASTS EXPRESSED IN TERMS OF PROBABILITY. Mon Weather Rev (1950) 78:1–3. doi:10.1175/1520-0493(1950)078<0001:vofeit>2.0.co;2

Goldstein-Greenwood J. A Brief on Brier Scores | UVA Library. (2021) Available at: https://library.virginia.edu/data/articles/a-brief-on-brier-scores


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