Learn R Programming

modelimpact (version 1.0.0)

cost_revenue: Calculate cost and revenue

Description

Calculates cost and revenue after sorting observations.

Usage

cost_revenue(
  x,
  fixed_cost = 0,
  var_cost = 0,
  tp_val = 0,
  prob_col = NA,
  truth_col = NA
)

Arguments

x

A data frame containing predicted probabilities of a target event and the actual outcome/class.

fixed_cost

Fixed cost (e.g. of a campaign)

var_cost

Variable cost (e.g. discount offered)

tp_val

The average value of a True Positive

prob_col

The unquoted name of the column with probabilities of the event of interest.

truth_col

The unquoted name of the column with the actual outcome/class. Possible values are 'Yes' and 'No'.

Value

A data frame with the following columns:

row = row numbers pct = percentiles cost_sum = cumulated costs cum_rev = cumulated revenue

Examples

Run this code
# NOT RUN {
cost_revenue(predictions,
   fixed_cost = 1000,
   var_cost   = 100,
   tp_val     = 2000,
   prob_col   = Yes,
   truth_col  = Churn)
# }

Run the code above in your browser using DataLab