Add forbidden attribute-level pair combinations
Source:R/design_restrictions.R
cjtd_forbid_pairs.RdAdds one restriction that forbids the Cartesian product of levels_a and
levels_b for attributes attr_a and attr_b within a given scope.
Examples
cfg <- cjtd_design_config(
attributes = list(
brand = c("A", "B", "C", "D"),
price = c("very_high", "high", "mid", "low", "very_low"),
f1 = c("off", "on"),
f2 = c("off", "on"),
f3 = c("off", "on")
),
n_tasks = 10,
n_alternatives = 3,
n_versions = 2
)
# Forbid one specific pair of levels from appearing together.
cfg <- cjtd_forbid_pairs(
cfg,
attr_a = "brand",
levels_a = "A",
attr_b = "price",
levels_b = "very_low"
)
# Variations can forbid multiple levels on either side.
# cfg <- cjtd_forbid_pairs(cfg, "brand", c("A", "B"), "price", c("low", "very_low"))
cfg
#>
#> ── Conjoint Design Config ──────────────────────────────────────────────────────
#> • n_tasks: 10
#> • n_alternatives: 3
#> • n_versions: 2
#> • restrictions: 1
#> attributes:
#> brand: A, B, C, D
#> price: very_high, high, mid, low, very_low
#> f1: off, on
#> f2: off, on
#> f3: off, on
#> restrictions:
#> [1] conjoint design restriction: forbid_pairs
#> scope: alternative
#> attr_a: brand
#> levels_a: A
#> attr_b: price
#> levels_b: very_low
#> ────────────────────────────────────────────────────────────────────────────────