View source: R/choice_parameters.R
| choice_parameters | R Documentation |
These functions construct, validate, and transform an object of class
choice_parameters, which defines the parameters of a choice model.
choice_parameters() constructs a choice_parameters object.
generate_choice_parameters() samples parameters at random, see details.
validate_choice_parameters() validates a choice_parameters object.
switch_parameter_space() transforms a choice_parameters object between
the interpretation and optimization space, see details.
choice_parameters(beta = NULL, Omega = NULL, Sigma = NULL, gamma = NULL)
generate_choice_parameters(
choice_effects,
fixed_parameters = choice_parameters()
)
validate_choice_parameters(
choice_parameters,
choice_effects,
allow_missing = FALSE
)
switch_parameter_space(choice_parameters, choice_effects)
beta |
[ |
Omega |
[ Can be |
Sigma |
[ |
gamma |
[ |
choice_effects |
[ |
fixed_parameters |
[ |
choice_parameters |
[ |
allow_missing |
[ |
An object of class choice_parameters, which is a list with the elements:
betaThe coefficient vector (if any).
OmegaThe covariance matrix of random effects (if any).
SigmaThe error term covariance matrix (or variance in ordered models).
gammaThreshold parameters for ordered models (if any).
Unspecified choice model parameters (if required) are drawn independently from the following distributions:
betaDrawn from a multivariate normal distribution with zero mean and a diagonal covariance matrix with value 10 on the diagonal.
OmegaDrawn from an Inverse-Wishart distribution with degrees
of freedom equal to P_r + 2 and scale matrix equal to the identity.
SigmaThe first row and column are fixed to 0 for level
normalization. The (2, 2)-value is fixed to 1 for scale
normalization. The lower right block is drawn from an Inverse-Wishart
distribution with degrees of freedom equal to J + 1 and scale matrix
equal to the identity.
The switch_parameter_space() function transforms a choice_parameters
object between the interpretation and optimization space.
The interpretation space is a list of (not necessarily identified)
parameters that can be interpreted.
The optimization space is a numeric vector of identified parameters that
can be optimized:
beta is not transformed
the first row and column of Sigma are fixed to 0 for level
normalization and the second diagonal element is fixed to 1 for scale
normalization
the covariance matrices (Omega and Sigma) are transformed to their
vectorized Cholesky factor (diagonal fixed to be positive for uniqueness)
### generate choice parameters at random
J <- 3
choice_effects <- choice_effects(
choice_formula = choice_formula(
formula = choice ~ A | B, error_term = "probit",
random_effects = c("A" = "cn")
),
choice_alternatives = choice_alternatives(J = J)
)
choice_parameters <- generate_choice_parameters(
choice_effects = choice_effects,
fixed_parameters = choice_parameters(
Sigma = diag(c(0, rep(1, J - 1))) # scale and level normalization
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.