plot_lift_curve_relative: plot_lift_curve_relative

Description Usage Arguments Value Examples

View source: R/plot_lift_curve_relative.R

Description

Buckets data into groups using the difference in predicted values (proposed_pred - incumbent_pred) (see prep_num_bin) and finds average predictions and actual in each bucket.

Note: Predictions should be annualised (independent of exposure)

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
plot_lift_curve_relative(
  actual,
  incumbent_pred,
  proposed_pred,
  weight = NULL,
  title = NULL,
  n_bins = 10,
  method = "even_weight",
  use_labels = TRUE,
  mean = 0.5,
  sd = 0.3,
  incumbent_label = "Incumbent",
  proposed_label = "Proposed",
  use_plotly = TRUE
)

Arguments

actual

Array[Numeric] - Values we are aiming to predict.

incumbent_pred

Array[Numeric] - Values that we have predicted by the incumbent model. Incumbent is the current model looking to be replaced.

proposed_pred

Optional: String - Text to use to label the proposed predictions.

weight

Optional: Array[Numeric] - Weighting of predictions. If NULL even weighting is used.

title

Optional: String - Title for the plot.

n_bins

numeric - Number of bins to split exposure into

method

string - One of c("even_weight", "gaussian_weight"). If "even_weight" is used the weight (exposure) in each bucket is even If "gaussian_weight" is used the weight look like a normal distribution centered on mean with width sd. The effect of this is to give thinner tails

use_labels

logical - should the bins be numbered or human readable labelled

mean

numeric - Only used when method="gaussian_weight" - value between 0 - 1 for if the bucket with maximum weight is at min or max prediction. Default is 0.5 (middle bucket)

sd

numeric - Only used when method="gaussian_weight" - value between 0.1 - 1 for how thin the distribution tails should be. Low numbers give thin tails

incumbent_label

Optional: String - Text to use to label the incumbent predictions.

use_plotly

Optional: boolean - If TRUE plotly object is returned else ggplot2 object.

Value

plotly/ggplot object of showing relative lift curve for given pair of predictions

Examples

1
2
plot_lift_curve_relative(actual=1:100, incumbent_pred = seq(25,74.5,0.5) + rnorm(100, mean=0, sd = 10), proposed_pred=seq(1,100,1) + rnorm(100, mean=0, sd = 10), title="Example Lift Curve")
plot_lift_curve_relative(actual=1:100, incumbent_pred = seq(25,74.5,0.5) + rnorm(100, mean=0, sd = 10), proposed_pred=seq(1,100,1) + rnorm(100, mean=0, sd = 10), title="Example Lift Curve", method="gaussian_weight")

gloverd2/admr documentation built on Dec. 2, 2020, 11:16 p.m.