estimate_loss: Estimate Loss

View source: R/estimate_loss.R

estimate_lossR Documentation

Estimate Loss

Description

Estimate Loss

Usage

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

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

Value

numeric, the loss distribution

Examples

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

## Not run: 
estimate_loss(posterior_samples = posterior_samples, distribution = "conversion_rate")

## End(Not run)

grizbayr documentation built on Oct. 9, 2023, 5:10 p.m.