| makeSurvey | R Documentation |
Make a randomized conjoint survey from a design of experiment
makeSurvey(doe, nResp, nAltsPerQ, nQPerResp, outsideGood = FALSE, group = NULL)
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
|
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 |
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.
# 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
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.