Compute diagnostics for a generated design
Source:R/design_solver_toulbar2.R
cjtd_design_diagnostics.RdReturns 1D and 2D count diagnostics together with compact balance metrics.
Examples
# Full generation workflow from the README example.
if (FALSE) { # \dontrun{
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
)
example_cjt_design <- cjtd_generate_design(cfg)
} # }
cjtd_design_diagnostics(example_cjt_design)
#>
#> ── Conjoint Design Diagnostics ─────────────────────────────────────────────────
#> • n_profiles: 60
#> • n_attributes: 5
#> • level_range_max: 0
#> • level_range_mean: 0
#> • pair_range_max: 12
#> • pair_range_mean: 4
#> worst 1D balance (top):
#> # A tibble: 5 × 9
#> attribute n_levels min_count max_count mean_count sd_count range_count
#> <chr> <int> <int> <int> <dbl> <dbl> <int>
#> 1 brand 4 15 15 15 0 0
#> 2 price 5 12 12 12 0 0
#> 3 f1 2 30 30 30 0 0
#> 4 f2 2 30 30 30 0 0
#> 5 f3 2 30 30 30 0 0
#> # ℹ 2 more variables: rel_range <dbl>, max_abs_dev <dbl>
#> worst 2D balance (top):
#> # A tibble: 6 × 9
#> pair n_cells min_count max_count mean_count sd_count range_count rel_range
#> <chr> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 f1 x f3 4 9 21 15 6.93 12 0.8
#> 2 f2 x f3 4 10 20 15 5.77 10 0.667
#> 3 f1 x f2 4 11 19 15 4.62 8 0.533
#> 4 brand x… 20 0 5 3 1.08 5 1.67
#> 5 price x… 10 5 7 6 0.667 2 0.333
#> 6 brand x… 8 7 8 7.5 0.535 1 0.133
#> # ℹ 1 more variable: max_abs_dev <dbl>
#> ────────────────────────────────────────────────────────────────────────────────