The choice_preferences object defines the deciders' preferences in the
choice model.
choice_preferences()constructs achoice_preferencesobject.generate_choice_preferences()samples choice preferences at random.
Usage
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)
)Arguments
- data_frame
[
data.frame]
Contains the deciders' preferences.- column_decider
[
character(1)|NULL]
The column name ofdata_framewith the decider identifiers. IfNULL, decider identifiers are generated.- choice_effects
[
choice_effects]
Achoice_effectsobject.- choice_parameters
[
choice_parameters]
Achoice_parametersobject.- choice_identifiers
[
choice_identifiers]
Achoice_identifiersobject.
Value
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.
Examples
### 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
))
#> deciderID ASC_B ASC_C comfort_A comfort_B comfort_C price
#> 1 1 -3.355917 -1.709963 -2.261676 -0.565795 0.5216818 -2.585067
#> 2 2 -3.355917 -1.709963 -2.261676 -0.565795 0.5216818 -2.490591
#> 3 3 -3.355917 -1.709963 -2.261676 -0.565795 0.5216818 -2.206151
#> 4 4 -3.355917 -1.709963 -2.261676 -0.565795 0.5216818 -1.570579
#> income_B income_C
#> 1 -2.219161 -2.225161
#> 2 -2.159966 -2.114323
#> 3 -2.042560 -1.284947
#> 4 -1.984565 -1.070331
### inspect decider-specific preference vectors
head(choice_preferences)
#> deciderID ASC_B ASC_C comfort_A comfort_B comfort_C price
#> 1 1 -3.355917 -1.709963 -2.261676 -0.565795 0.5216818 -2.585067
#> 2 2 -3.355917 -1.709963 -2.261676 -0.565795 0.5216818 -2.490591
#> 3 3 -3.355917 -1.709963 -2.261676 -0.565795 0.5216818 -2.206151
#> 4 4 -3.355917 -1.709963 -2.261676 -0.565795 0.5216818 -1.570579
#> income_B income_C
#> 1 -2.219161 -2.225161
#> 2 -2.159966 -2.114323
#> 3 -2.042560 -1.284947
#> 4 -1.984565 -1.070331
