View source: R/choice_covariates.R
| choice_covariates | R Documentation |
The choice_covariates object defines the choice model covariates.
generate_choice_covariates() samples covariates.
covariate_names() gives the covariate names for given choice_effects.
design_matrices() builds design matrices.
choice_covariates(
data_frame,
format = "wide",
column_decider = "deciderID",
column_occasion = NULL,
column_alternative = NULL,
column_ac_covariates = NULL,
column_as_covariates = NULL,
delimiter = "_",
cross_section = is.null(column_occasion)
)
generate_choice_covariates(
choice_effects = NULL,
choice_identifiers = generate_choice_identifiers(N = 100),
labels = covariate_names(choice_effects),
n = nrow(choice_identifiers),
marginals = list(),
correlation = diag(length(labels)),
verbose = FALSE,
delimiter = "_"
)
covariate_names(choice_effects)
design_matrices(
x,
choice_effects,
choice_identifiers = extract_choice_identifiers(x)
)
data_frame |
[ |
format |
[ |
column_decider |
[ |
column_occasion |
[ |
column_alternative |
[ |
column_ac_covariates |
[ |
column_as_covariates |
[ |
delimiter |
[ |
cross_section |
[ |
choice_effects |
[ |
choice_identifiers |
[ |
labels |
[ |
n |
[ |
marginals |
[ Each list entry must be named according to a regressor label, and the following distributions are currently supported:
|
correlation |
[ |
verbose |
[ |
x |
A |
A tibble.
A covariate design matrix contains the choice covariates of a decider at a
choice occasion. It is of dimension J x P, where J is
the number of choice alternatives and P the number of effects. See
compute_P to compute the number P.
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)
)
ids <- generate_choice_identifiers(N = 3, Tp = 2)
choice_covariates <- generate_choice_covariates(
choice_effects = choice_effects,
choice_identifiers = ids
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.