Make a randomized conjoint survey from a design of experiment

makeSurvey(doe, nResp, nAltsPerQ, nQPerResp, outsideGood = FALSE, group = NULL)

Arguments

doe

A design of experiment data frame. Each row is an alternative, each column is an attribute.

nResp

Maximum number of survey respondents.

nAltsPerQ

Number of alternatives per question.

nQPerResp

Number of questions per respondent.

outsideGood

Include an outside good in the choice sets? Defaults to FALSE. If included, the total number of alternatives per question will be one more than the provided nAltsPerQ argument.

group

The name of the variable to use in a "labeled" design such that each set of alternatives contains one of each of the levels in the group attribute. If included, the nAltsPerQ argument will be ignored as its value is determined by the unique number of levels in the group variable. Defaults to NULL.

Value

Returns a conjoint survey by randomly sampling from a design of experiment data frame. The sampling is done iteratively to remove the possibility of duplicate alternatives appearing in the same choice question.

Examples

# Define the attributes and levels
levels <- list(
  price     = seq(1, 4, 0.5), # $ per pound
  type      = c('Fuji', 'Gala', 'Honeycrisp', 'Pink Lady', 'Red Delicious'),
  freshness = c('Excellent', 'Average', 'Poor')
)

# Make a full-factorial design of experiment
doe <- makeDoe(levels)

# Re-code levels
doe <- recodeDoe(doe, levels)

# Make the conjoint survey by randomly sampling from the doe
survey <- makeSurvey(
  doe       = doe,  # Design of experiment
  nResp     = 2000, # Total number of respondents (upper bound)
  nAltsPerQ = 3,    # Number of alternatives per question
  nQPerResp = 6     # Number of questions per respondent
)