knitr::opts_chunk$set( collapse = TRUE, warning = FALSE, message = FALSE, fig.retina = 3, comment = "#>" ) set.seed(123)
The first step in designing an experiment is to define the attributes and levels for your experiment and then generate all of the profiles
of each possible combination of those attributes and levels.
For example, let's say you're designing a conjoint experiment about apples and you want to include price
, type
, and freshness
as attributes. You can obtain all of the possible profiles for these attributes using the cbc_profiles()
function:
library(cbcTools) profiles <- cbc_profiles( price = seq(1, 5, 0.5), # $ per pound type = c('Fuji', 'Gala', 'Honeycrisp'), freshness = c('Poor', 'Average', 'Excellent') ) profiles
Depending on the context of your survey, you may wish to eliminate some profiles before designing your conjoint survey (e.g., some profile combinations may be illogical or unrealistic).
CAUTION: including restrictions in your designs can substantially reduce the statistical power of your design, so use them cautiously and avoid them if possible.
If you do wish to restrict some attribute level combinations, you can do so using the cbc_restrict()
function, which takes the full set of profiles
along with any number of restricted pairs of attribute levels, defined as pairs of logical expressions separated by commas. The example below includes the following restrictions (these are arbitrary and just for illustration purposes):
"Gala"
apples will not be shown with the prices 1.5
, 2.5
, and 3.5
."Honeycrisp"
apples will not be shown with prices less than 2
."Fuji"
apples will not be shown with the "Excellent"
freshness.With these restrictions, there are now only 57 profiles compared to 81 without them:
restricted_profiles <- cbc_restrict( profiles, type == "Gala" & price %in% c(1.5, 2.5, 3.5), type == "Honeycrisp" & price < 2, type == "Fuji" & freshness == "Excellent" ) dim(restricted_profiles)
Once you have your profiles, you can use them to generate an experiment design with cbc_design()
. See the Generating Designs article for more details.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.