cbc_design {cbcTools}R Documentation

Make a choice-based conjoint survey design

Description

This function creates a data frame containing a choice-based conjoint survey design where each row is an alternative. Generate a variety of survey designs, including full factorial designs, orthogonal designs, and Bayesian D-efficient designs as well as designs with "no choice" options and "labeled" (also known as "alternative specific") designs.

Usage

cbc_design(
  profiles,
  n_resp,
  n_alts,
  n_q,
  n_blocks = 1,
  n_draws = 50,
  n_start = 5,
  no_choice = FALSE,
  label = NULL,
  method = "random",
  priors = NULL,
  prior_no_choice = NULL,
  probs = FALSE,
  keep_d_eff = FALSE,
  keep_db_error = FALSE,
  max_iter = 50,
  parallel = FALSE
)

Arguments

profiles

A data frame in which each row is a possible profile. This can be generated using the cbc_profiles() function.

n_resp

Number of survey respondents.

n_alts

Number of alternatives per choice question.

n_q

Number of questions per respondent.

n_blocks

Number of blocks used in Orthogonal or Bayesian D-efficient designs. Max allowable is one block per respondent. Defaults to 1, meaning every respondent sees the same choice set.

n_draws

Number of draws used in simulating the prior distribution used in Bayesian D-efficient designs. Defaults to 50.

n_start

A numeric value indicating the number of random start designs to use in obtaining a Bayesian D-efficient design. The default is 5. Increasing n_start can result in a more efficient design at the expense of increased computational time.

no_choice

Include a "no choice" option in the choice sets? Defaults to FALSE. If TRUE, the total number of alternatives per question will be one more than the provided n_alts argument.

label

The name of the variable to use in a "labeled" design (also called an "alternative-specific design") such that each set of alternatives contains one of each of the levels in the label attribute. Currently not compatible with Bayesian D-efficient designs. If used, the n_alts argument will be ignored as its value is defined by the unique number of levels in the label variable. Defaults to NULL.

method

Choose the design method to use: "random", "full", "orthogonal", "dopt", "CEA", or "Modfed". Defaults to "random". See details below for complete description of each method.

priors

A list of one or more assumed prior parameters used to generate a Bayesian D-efficient design. Defaults to NULL

prior_no_choice

Prior utility value for the "no choice" alternative. Only required if no_choice = TRUE. Defaults to NULL.

probs

If TRUE, for Bayesian D-efficient designs the resulting design includes average predicted probabilities for each alternative in each choice set given the sample from the prior preference distribution. Defaults to FALSE.'

keep_d_eff

If TRUE, for D-optimal designs (method = "dopt") the returned object will be a list containing the design and the D-efficiency score. Defaults to FALSE.

keep_db_error

If TRUE, for Bayesian D-efficient designs the returned object will be a list containing the design and the DB-error score. Defaults to FALSE.

max_iter

A numeric value indicating the maximum number allowed iterations when searching for a Bayesian D-efficient design. The default is 50.

parallel

Logical value indicating whether computations should be done over multiple cores. The default is FALSE.

Details

The method argument determines the design method used. Options are:

Value

The returned design data frame contains a choice-based conjoint survey design where each row is an alternative. It includes the following columns:

References

Grömping, U. (2018). R Package DoE.base for Factorial Experiments. Journal of Statistical Software, 85(5), 1–41 doi:10.18637/jss.v085.i05

Traets, F., Sanchez, D. G., & Vandebroek, M. (2020). Generating Optimal Designs for Discrete Choice Experiments in R: The idefix Package. Journal of Statistical Software, 96(3), 1–41, doi:10.18637/jss.v096.i03

Wheeler B (2022)._AlgDesign: Algorithmic Experimental Design. R package version 1.2.1, https://CRAN.R-project.org/package=AlgDesign.

Examples

library(cbcTools)

# A simple conjoint experiment about apples

# Generate all possible profiles
profiles <- cbc_profiles(
  price     = c(1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5),
  type      = c("Fuji", "Gala", "Honeycrisp"),
  freshness = c('Poor', 'Average', 'Excellent')
)

# Make a survey by randomly sampling from all possible profiles
# (This is the default setting where method = 'random')
design_random <- cbc_design(
  profiles = profiles,
  n_resp   = 100, # Number of respondents
  n_alts   = 3,   # Number of alternatives per question
  n_q      = 6    # Number of questions per respondent
)

# Make a survey using a full factorial design and include a "no choice" option
design_full <- cbc_design(
  profiles = profiles,
  n_resp   = 100, # Number of respondents
  n_alts   = 3,   # Number of alternatives per question
  n_q      = 6,   # Number of questions per respondent
  method   = 'full', # Change this to use a different method, e.g. 'orthogonal', or 'dopt'
  no_choice = TRUE
)

# Make a survey by randomly sampling from all possible profiles
# with each level of the "type" attribute appearing as an alternative
design_random_labeled <- cbc_design(
  profiles = profiles,
  n_resp   = 100, # Number of respondents
  n_alts   = 3,   # Number of alternatives per question
  n_q      = 6,   # Number of questions per respondent
  label    = "type"
)

# Make a Bayesian D-efficient design with a prior model specified
# Note that by speed can be improved by setting parallel = TRUE
design_bayesian <- cbc_design(
    profiles  = profiles,
    n_resp    = 100, # Number of respondents
    n_alts    = 3,   # Number of alternatives per question
    n_q       = 6,   # Number of questions per respondent
    n_start   = 1,   # Defaults to 5, set to 1 here for a quick example
    priors = list(
        price     = -0.1,
        type      = c(0.1, 0.2),
        freshness = c(0.1, 0.2)
    ),
    method = "CEA",
    parallel = FALSE
)

[Package cbcTools version 0.5.0 Index]