View source: R/choice_preferences.R
| choice_preferences | R Documentation |
The choice_preferences object defines the deciders' preferences in the
choice model.
choice_preferences() constructs a choice_preferences object.
generate_choice_preferences() samples choice preferences at random.
choice_preferences(data_frame, column_decider = colnames(data_frame)[1])
generate_choice_preferences(
choice_effects,
choice_parameters = NULL,
choice_identifiers = generate_choice_identifiers(N = 100)
)
data_frame |
[ |
column_decider |
[ |
choice_effects |
[ |
choice_parameters |
[ |
choice_identifiers |
[ |
An object of class choice_preferences, which is a data.frame with the
deciders' preferences. The column names are the names of the effects in the
choice model. The first column contains the decider identifiers.
### generate choice preferences from choice parameters and effects
choice_effects <- choice_effects(
choice_formula = choice_formula(
formula = choice ~ price | income | comfort,
error_term = "probit",
random_effects = c(
"price" = "cn",
"income" = "cn"
)
),
choice_alternatives = choice_alternatives(J = 3)
)
choice_parameters <- generate_choice_parameters(
choice_effects = choice_effects
)
ids <- generate_choice_identifiers(N = 4)
(choice_preferences <- generate_choice_preferences(
choice_parameters = choice_parameters,
choice_effects = choice_effects,
choice_identifiers = ids
))
### inspect decider-specific preference vectors
head(choice_preferences)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.