Creates MaxDiff experimental design.
Usage
md_create_design(
attributes,
n_questions,
n_alternatives_per_question,
n_versions = 1,
n_repeats = 10,
seed = 1223
)Arguments
- attributes
Items to be evaluated in the MaxDiff study.
- n_questions
The number of MaxDiff questions to show to respondents. Sawtooth Software suggests that a rough guideline is:
Number of questions >= 3 * Number of alternatives / Alternatives per question.- n_alternatives_per_question
For example, if you have a study of 10 brands, and in each question you show five brands, asking the respondent to choose the one of the five that they like the most and the one that they like the least, then
Alternatives per question = 5. That is, the number of options shown in each question.- n_versions
The number of versions of the experimental design (defaults to 1). Subsequent versions are obtained by permuting the columns of the binary design.
- n_repeats
The number of times that the algorithm seeks to find a solution. The higher the number, the greater the chance that the best possible solution is found. For most problems, this makes little difference (i.e., a marginally sub-optimal experimental design will tend not to have any meaningful consequence on the conclusions drawn from the analyses).
- seed
Random number seed for generation of the experimental design.
Examples
attributes <- paste0("Item ", 1:20)
# In this example, we are working with 20 alternatives (or attributes), which
# means there are 20 distinct items to evaluate.
#
# Since each MaxDiff question presents a subset of items for comparison, we aim
# to display 5 items per question. This number is chosen because the attributes
# are not overly complex or wordy, making it feasible for respondents to evaluate
# 5 at a time.
#
# To ensure each alternative appears at least twice across the entire survey,
# we calculate the minimum number of MaxDiff questions needed:
# - Each question displays 5 items.
# - We want each item to appear at least 2 times.
# - The formula for determining the required number of questions is: 2 * (20/5) = 8.
#
# Therefore, we set n_questions = 8 to achieve the desired coverage.
#
# We also generate 15 different questionnaire versions (n_versions = 15) to account
# for variations in respondent exposure.
#
# To balance design robustness, we use 10 repeats (n_repeats = 10), ensuring that
# each attribute placement is optimized across the versions.
# (increase this in real projects)
design <-
md_create_design(
attributes = attributes,
n_questions = 8,
n_alternatives_per_question = 5,
n_versions = 15,
n_repeats = 10,
seed = 1223
)
#> Warning: You have specified 8 questions. It is sometimes recommended that number.questions >= 3 * number.alternatives / alternatives.per.question (i.e., that you should have at least 12 questions).
#> Warning: One or more of the alternatives appears only 2 time(s). A common recommendation is that each alternative should appear 3 times. You can review the frequencies by viewing the detailed outputs.
#> Warning: Some alternatives never appear together. You can review the pairwise frequencies by viewing the detailed outputs.
design
#>
#> ── MaxDiff Design ──────────────────────────────────────────────────────────────
#> $raw_design:
#> • $binary.design: dbl [8 × 20]
#> • $design: dbl [8 × 5]
#> • $frequencies: table [20]
#> • $pairwise.frequencies: dbl [20 × 20]
#> • $binary.correlations: dbl [20 × 20]
#> • $versions.binary.correlations: dbl [20 × 20]
#> • $versions.pairwise.frequencies: dbl [20 × 20]
#> • $versions.design: dbl [120 × 7]
#> $tidy_design:
#> # A tibble: 600 × 4
#> version block display_order item
#> <dbl> <dbl> <int> <fct>
#> 1 1 1 1 Item 19
#> 2 1 1 2 Item 15
#> 3 1 1 3 Item 7
#> # ℹ 597 more rows
#> ────────────────────────────────────────────────────────────────────────────────
design$tidy_design
#> # A tibble: 600 × 4
#> version block display_order item
#> <dbl> <dbl> <int> <fct>
#> 1 1 1 1 Item 19
#> 2 1 1 2 Item 15
#> 3 1 1 3 Item 7
#> 4 1 1 4 Item 18
#> 5 1 1 5 Item 9
#> 6 1 2 1 Item 10
#> 7 1 2 2 Item 11
#> 8 1 2 3 Item 5
#> 9 1 2 4 Item 14
#> 10 1 2 5 Item 3
#> # ℹ 590 more rows