View source: R/choice_probabilities.R
| choice_probabilities | R Documentation |
The choice_probabilities object defines the choice probabilities.
compute_choice_probabilities() calculates the choice probabilities based
on the choice parameters and the choice data.
choice_probabilities(
data_frame,
choice_only = TRUE,
column_decider = "deciderID",
column_occasion = NULL,
cross_section = FALSE,
column_probabilities = if (choice_only) "choice_probability"
)
compute_choice_probabilities(
choice_parameters,
choice_data,
choice_effects,
choice_only = FALSE,
input_checks = TRUE,
...
)
data_frame |
[ |
choice_only |
[ |
column_decider |
[ |
column_occasion |
[ |
cross_section |
[ |
column_probabilities |
[ If |
choice_parameters |
[ |
choice_data |
[ |
choice_effects |
[ |
input_checks |
[ |
... |
Passed to the underlying probability computation routine. |
A choice_probabilities S3 object (a data frame) that stores additional
metadata in attributes such as column_probabilities, choice_only, and the
identifier columns. These attributes are used by downstream helpers to
reconstruct the original structure.
data(train_choice)
choice_effects <- choice_effects(
choice_formula = choice_formula(
formula = choice ~ price | time,
error_term = "probit"
),
choice_alternatives = choice_alternatives(
J = 2, alternatives = c("A", "B")
)
)
choice_parameters <- generate_choice_parameters(choice_effects)
choice_data <- choice_data(
data_frame = train_choice,
format = "wide",
column_choice = "choice",
column_decider = "deciderID",
column_occasion = "occasionID"
)
compute_choice_probabilities(
choice_parameters = choice_parameters,
choice_data = choice_data,
choice_effects = choice_effects,
choice_only = TRUE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.