Constructs a numeric yardstick metric that uses preselected lower and upper
interval columns. The selections are resolved against .data at creation
time and the resulting metric uses those names on each evaluation. This
allows WIS to be combined with ordinary numeric metrics that accept only
truth and estimate selections. The same interval columns must be present
whenever the metric is evaluated. WIS interpretation and assumptions are
identical to wis(). Grouping and case weights are supported.
Examples
d <- data.frame(y = c(1, 2), med = c(1, 3), lo = c(0, 1), hi = c(2, 4))
interval_score <- wis_metric(d, lo, hi, alpha = .1)
metrics <- yardstick::metric_set(yardstick::rmse, interval_score)
metrics(d, truth = y, estimate = med)
#> # A tibble: 2 × 3
#> .metric .estimator .estimate
#> <chr> <chr> <dbl>
#> 1 rmse standard 0.707
#> 2 wis standard 0.25
