Constrained conjoint design generation for internal use.
This package is still immature. The interface is currently somewhat clunky and is likely to change as we get more experience using it.
Currently possible: - define attribute spaces - add simple pairwise prohibitions within alternatives - add count restrictions over selected levels within alternatives - generate multi-version designs following the specified restrictions - extract generated designs as tidy tables - inspect basic balance diagnostics - render config/design outputs, including diagnostics tabs, to xlsx
Design solving is done with toulbar2. Use cjtd_find_toulbar2() to check whether the solver can be found. It looks for toulbar2 on PATH and also respects the TOULBAR2_BIN environment variable.
Example
The example below defines: - two multi-level attributes: brand and price - three binary attributes: f1, f2, f3 - one prohibition: brand == "A" cannot appear with price == "very_low" - one count restriction: across f1, f2, f3, the number of "on" values must be between 1 and 2 in each alternative - a design with 2 versions, 10 tasks, and 3 alternatives per task
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
)
cfg <- cjtd_forbid_pairs(
cfg,
attr_a = "brand",
levels_a = "A",
attr_b = "price",
levels_b = "very_low"
)
cfg <- cjtd_require_n_selected(
cfg,
selected = list(
f1 = "on",
f2 = "on",
f3 = "on"
),
n = 1:2
)
design <- cjtd_generate_design(cfg)
# packed tidy table with version/task/alt and an attributes column
packed <- cjtd_extract(design)
# diagnostics summary: 1D and 2D counts
diagnostics <- cjtd_design_diagnostics(design)
# diagnostics spreadsheet
wb <- cjtd_design_render(design)
# save with openxlsx::saveWorkbook()If toulbar2 is installed in a non-standard location, set TOULBAR2_BIN=/full/path/to/toulbar2 before generating a design.