plot_calibration: Plot a calibration plot of model performance

Description Usage Arguments Examples

Description

This function creates a nicely formatted, standardised calibration plot. Prior to calling the function the data should only be in a form of a decile table (calculate_decile_table() function will do that for you), unless it's already provided.

Usage

1
2
3
4
plot_calibration(df,
  title = "Lift chart: predicted probabilities vs. actual defaul rates",
  lab_x = "Deciles of predicted probabilities",
  lab_y = "Decile performance")

Arguments

df

A data frame

title

Text that is displayed on as the plot title. Defaults to "Lift chart: evaluation of model predicted probabilities vs. actual defaul rates across deciles"

lab_x

Text that is displayed on the x axis. Defaults to "Deciles of predicted probabilities"

lab_y

Text that is displayed on the y axis. Defaults to "Decile performance"

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
df <- tibble::tribble(
  ~decile, ~actual_br, ~predicted_br,
  1,  0.00, 0.01,
  2,  0.00, 0.01,
  3,  0.00, 0.03,
  4,  0.00, 0.05,
  5,  0.30, 0.08,
  6,  0.12, 0.11,
  7,  0.00, 0.16,
  8,  0.21, 0.22,
  9,  0.30, 0.33,
  10, 0.68, 0.59,
)

plot_calibration(df)

konradsemsch/aider documentation built on May 22, 2019, 2:40 p.m.