Learn R Programming

grizbayr (version 1.3.5)

estimate_loss: Estimate Loss

Description

Estimate Loss

Usage

estimate_loss(
  posterior_samples,
  distribution,
  wrt_option = NULL,
  metric = c("absolute", "lift", "relative_risk")
)

Value

numeric, the loss distribution

Arguments

posterior_samples

Tibble: returned from sample_from_posterior with 3 columns `option_name`, `samples`, and `sample_id`.

distribution

String: the name of the distribution

wrt_option

String: the option loss is calculated with respect to (wrt). If NULL, the best option will be chosen.

metric

String: the type of loss. absolute will be the difference, on the outcome scale. 0 when best = wrt_option lift will be the (best - wrt_option) / wrt_option, 0 when best = wrt_option relative_risk will be the ratio best/wrt_option, 1 when best = wrt_option

Examples

Run this code
# Requires posterior_samples dataframe. See `sample_from_posterior()`
# for an example.

if (FALSE) {
estimate_loss(posterior_samples = posterior_samples, distribution = "conversion_rate")
}

Run the code above in your browser using DataLab