lift: Gain and lift charts

View source: R/lift.R

liftR Documentation

Gain and lift charts

Description

Validates predicted probabilities against a set of observed (binary) outcomes.

Usage

lift(prob, y, pos.class = NULL, cumulative = TRUE, nbins = 0)

## S3 method for class 'lift'
plot(
  x,
  refline = TRUE,
  refline.col = 2,
  refline.fill = 2,
  refline.lty = "dashed",
  refline.lwd = 1,
  ...
)

Arguments

prob

Vector of predicted probabilities.

y

Vector of binary (i.e., 0/1) outcomes. If y is coded as anything other than 0/1, then you must specify which of the two categories represents the "positive" class (i.e., the class for which the probabilities specified in prob correspond to) via the pos.class argument.

pos.class

Numeric/character string specifying which values in y correspond to the "positive" class. Default is NULL. (Must be specified whenever y is not coded as 0/1, where 1 is assumed to represent the "positive" class.)

cumulative

Logical indicating whether or not to compute cumulative lift (i.e., gain). Default is TRUE.

nbins

Integer specifying the number of bins to use when computing lift. Default is 0, which corresponds to no binning. For example, setting nbins = 10 will result in computing lift within each decile of the sorted probabilities.

x

An object of class "lift".

refline

Logical indicating whether or not to include a reference line.

refline.col

The color to use for the reference line. Default is 2.

refline.fill

The color to use for filling in the polygon-shaped reference line. Default is 2.

refline.lty

The type of line to use for the reference line. Default is "dashed".

refline.lwd

The width of the reference line. Default is 1.

...

Additional optional argument to be passed on to other methods.

Value

A "lift" object, which is essentially a list with the following components:

"lift"

A numeric vector containing the computed lift values.

"prop"

The corresponding proportion of cases associated with each lift value.

"cumulative"

Same value as that supplied via the cumulative argument. (Used by the plot.lift() method.)


bgreenwell/treemisc documentation built on Oct. 26, 2022, 12:56 a.m.