
Generate survey designs for choice experiments (Updated Implementation)
Source:R/design.R
cbc_design.Rd
This function creates experimental designs for choice-based conjoint experiments using multiple design approaches including optimization and frequency-based methods.
Usage
cbc_design(
profiles,
method = "random",
priors = NULL,
n_alts,
n_q,
n_resp = 100,
n_blocks = 1,
n_cores = NULL,
no_choice = FALSE,
label = NULL,
randomize_questions = TRUE,
randomize_alts = TRUE,
remove_dominant = FALSE,
dominance_types = c("total", "partial"),
dominance_threshold = 0.8,
max_dominance_attempts = 50,
max_iter = 50,
n_start = 5,
include_probs = FALSE,
use_idefix = TRUE
)
Arguments
- profiles
A data frame of class
cbc_profiles
created usingcbc_profiles()
- method
Choose the design method: "random", "shortcut", "minoverlap", "balanced", "stochastic", "modfed", or "cea". Defaults to "random"
- priors
A
cbc_priors
object created bycbc_priors()
, or NULL for random/shortcut designs- n_alts
Number of alternatives per choice question
- n_q
Number of questions per respondent (or per block)
- n_resp
Number of respondents (for random/shortcut designs) or 1 (for optimized designs that get repeated)
- n_blocks
Number of blocks in the design. Defaults to 1
- n_cores
Number of cores to use for parallel processing in the design search. Defaults to NULL, in which case it is set to the number of available cores minus 1.
- no_choice
Include a "no choice" option? Defaults to FALSE
- label
The name of the variable to use in a "labeled" design. Defaults to NULL
- randomize_questions
Randomize question order for each respondent? Defaults to TRUE (optimized methods only)
- randomize_alts
Randomize alternative order within questions? Defaults to TRUE (optimized methods only)
- remove_dominant
Remove choice sets with dominant alternatives? Defaults to FALSE
- dominance_types
Types of dominance to check: "total" and/or "partial"
- dominance_threshold
Threshold for total dominance detection. Defaults to 0.8
- max_dominance_attempts
Maximum attempts to replace dominant choice sets. Defaults to 50.
- max_iter
Maximum iterations for optimized designs. Defaults to 50
- n_start
Number of random starts for optimized designs. Defaults to 5
- include_probs
Include predicted probabilities in resulting design? Requires
priors
. Defaults toFALSE
- use_idefix
If
TRUE
(the default), the idefix package will be used to find optimal designs, which is faster. Only valid with"cea"
and"modfed"
methods.
Details
Design Methods
The method
argument determines the design approach used:
"random"
: Creates designs by randomly sampling profiles for each respondent independently"shortcut"
: Frequency-based greedy algorithm that balances attribute level usage"minoverlap"
: Greedy algorithm that minimizes attribute overlap within choice sets"balanced"
: Greedy algorithm that maximizes overall attribute balance across the design"stochastic"
: Stochastic profile swapping with D-error optimization (first improvement found)"modfed"
: Modified Fedorov algorithm with exhaustive profile swapping for D-error optimization"cea"
: Coordinate Exchange Algorithm with attribute-by-attribute D-error optimization
Method Compatibility
The table below summarizes method compatibility with design features:
Method | No choice? | Labeled designs? | Restricted profiles? | Blocking? | Interactions? | Dominance removal? |
"random" | Yes | Yes | Yes | No | Yes | Yes |
"shortcut" | Yes | Yes | Yes | No | No | Yes |
"minoverlap" | Yes | Yes | Yes | No | No | Yes |
"balanced" | Yes | Yes | Yes | No | No | Yes |
"stochastic" | Yes | Yes | Yes | Yes | Yes | Yes |
"modfed" | Yes | Yes | Yes | Yes | Yes | Yes |
"cea" | Yes | Yes | No | Yes | Yes | Yes |
Design Quality Assurance
All methods ensure the following criteria are met:
No duplicate profiles within any choice set
No duplicate choice sets within any respondent
If
remove_dominant = TRUE
, choice sets with dominant alternatives are eliminated (optimization methods only)
Method Details
Random Method
Creates designs where each respondent sees completely independent, randomly generated choice sets.
Greedy Methods (shortcut, minoverlap, balanced)
These methods use frequency-based algorithms that make locally optimal choices:
Shortcut: Balances attribute level usage within questions and across the overall design
Minoverlap: Minimizes attribute overlap within choice sets while allowing some overlap for balance
Balanced: Maximizes overall attribute balance, prioritizing level distribution over overlap reduction
These methods provide good level balance without requiring priors or D-error calculations and offer fast execution suitable for large designs.
D-Error Optimization Methods (stochastic, modfed, cea)
These methods minimize D-error to create statistically efficient designs:
Stochastic: Random profile sampling with first improvement acceptance
Modfed: Exhaustive profile testing for best improvement (slower but thorough)
CEA: Coordinate exchange testing attribute levels individually (requires full factorial profiles)
idefix Integration
When use_idefix = TRUE
(the default), the function leverages the highly optimized
algorithms from the idefix package for 'cea' and 'modfed' design generation methods.
This can provide significant speed improvements, especially for larger
problems.
Key benefits of idefix integration:
Faster optimization algorithms with C++ implementation
Better handling of large candidate sets
Optimized parallel processing
Advanced blocking capabilities for multi-block designs