Decompose all summary variables for a single group
Examples
# Outcomes for every on/off combination of two factors, where the
# factors interact: y = 10 + 5a + 3b + 2ab
rt <- make_run_table(c("a", "b"))
rt[, y := 10 + 5 * a + 3 * b + 2 * a * b]
#> run_id a b y
#> <int> <int> <int> <num>
#> 1: 1 0 0 10
#> 2: 2 1 0 15
#> 3: 3 0 1 13
#> 4: 4 1 1 20
# The interaction term is split evenly: a gets 5 + 1, b gets 3 + 1
decomp_algebra(rt, list(summary_vars = "y", decomp_vars = c("a", "b"),
decomp_method = "shapley"))
#> measure a b
#> <char> <num> <num>
#> 1: y 6 4