powered by
Calculates ROI after sorting observations with ROI defined as (Current Value - Start Value) / Start Value
roi(x, fixed_cost = 0, var_cost = 0, tp_val = 0, prob_col = NA, truth_col = NA)
A data frame containing predicted probabilities of a target event and the actual outcome/class.
Fixed cost (e.g. of a campaign)
Variable cost (e.g. discount offered)
The average value of a True Positive
The unquoted name of the column with probabilities of the event of interest.
The unquoted name of the column with the actual outcome/class. Possible values are 'Yes' and 'No'.
A data frame with the following columns:
row = row numbers pct = percentiles cum_rev = cumulated revenue cost_sum = cumulated costs roi = return on investment
# NOT RUN { roi(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