Computes empirical coverage within each group, useful for diagnosing conditional coverage violations.
See also
Other diagnostics:
conformal_compare(),
conformal_pvalue(),
coverage(),
coverage_by_bin(),
interval_width(),
set_size()
Examples
set.seed(42)
n <- 500
x <- matrix(rnorm(n * 3), ncol = 3)
y <- x[, 1] * 2 + rnorm(n)
x_new <- matrix(rnorm(200 * 3), ncol = 3)
y_new <- x_new[, 1] * 2 + rnorm(200)
groups <- factor(ifelse(x_new[, 1] > 0, "high", "low"))
result <- conformal_split(x, y, model = y ~ ., x_new = x_new)
coverage_by_group(result, y_new, groups)
#> group coverage n target
#> 1 high 0.8947368 95 0.9
#> 2 low 0.8857143 105 0.9