View source: R/choice_probabilities.R
| choiceprob_probit | R Documentation |
These helper functions calculate probit choice probabilities for various scenarios:
in the regular (choiceprob_mnp_*), ordered (*_ordered), and
ranked (ranked = TRUE) case,
in the normally mixed (choiceprob_mmnp_*) and latent class (*_lc) case,
for panel data (*_panel),
based on the full likelihood (cml = "no"), the full pairwise composite
marginal likelihood (cml = "fp"), and the adjacent pairwise composite
marginal likelihood (cml = "ap"),
for the observed choices or for all alternatives (if y is NULL).
The function choiceprob_probit() is the general API which calls the
specialized functions and can perform input checks.
choiceprob_probit(
X,
y = NULL,
Tp = NULL,
cml = "no",
beta,
Omega = NULL,
Sigma,
gamma = NULL,
weights = NULL,
re_position = utils::tail(seq_along(beta), nrow(Omega)),
gcdf = pmvnorm_cdf_default,
lower_bound = 0,
input_checks = TRUE,
ordered = !is.null(gamma),
ranked = if (!ordered && !is.null(y) && isTRUE(length(y) > 0)) {
length(y[[1]]) >
1
} else {
FALSE
},
mixed = !is.null(Omega),
panel = mixed & !is.null(Tp) & any(Tp > 1),
lc = !is.null(weights)
)
choiceprob_mnp(
X,
y,
beta,
Sigma,
gcdf = pmvnorm_cdf_default,
lower_bound = 0,
ranked = FALSE
)
choiceprob_mnp_ordered(X, y, beta, Sigma, gamma, lower_bound = 0)
choiceprob_mmnp(
X,
y,
beta,
Omega,
Sigma,
re_position = utils::tail(seq_along(beta), nrow(Omega)),
gcdf = pmvnorm_cdf_default,
lower_bound = 0,
ranked = FALSE
)
choiceprob_mmnp_ordered(
X,
y,
beta,
Omega,
Sigma,
gamma,
re_position = utils::tail(seq_along(beta), nrow(Omega)),
lower_bound = 0
)
choiceprob_mmnp_lc(
X,
y,
beta,
Omega,
Sigma,
weights,
re_position = utils::tail(seq_along(beta[[1]]), nrow(Omega[[1]])),
gcdf = pmvnorm_cdf_default,
lower_bound = 0,
ranked = FALSE
)
choiceprob_mmnp_ordered_lc(
X,
y,
beta,
Omega,
Sigma,
gamma,
weights,
re_position = utils::tail(seq_along(beta[[1]]), nrow(Omega[[1]])),
lower_bound = 0
)
choiceprob_mmnp_panel(
X,
y,
Tp,
cml,
beta,
Omega,
Sigma,
re_position = utils::tail(seq_along(beta), nrow(Omega)),
gcdf = pmvnorm_cdf_default,
lower_bound = 0,
ranked = FALSE
)
choiceprob_mmnp_ordered_panel(
X,
y,
Tp,
cml,
beta,
Omega,
Sigma,
gamma,
re_position = utils::tail(seq_along(beta), nrow(Omega)),
gcdf = pmvnorm_cdf_default,
lower_bound = 0
)
choiceprob_mmnp_panel_lc(
X,
y,
Tp,
cml,
beta,
Omega,
Sigma,
weights,
re_position = utils::tail(seq_along(beta), nrow(Omega)),
gcdf = pmvnorm_cdf_default,
lower_bound = 0,
ranked = FALSE
)
choiceprob_mmnp_ordered_panel_lc(
X,
y,
Tp,
cml,
beta,
Omega,
Sigma,
gamma,
weights,
re_position = utils::tail(seq_along(beta), nrow(Omega)),
gcdf = pmvnorm_cdf_default,
lower_bound = 0
)
X |
[ In the ordered case ( |
y |
[ In the ranked case ( In the non-panel case ( |
Tp |
[ Can be |
cml |
[ |
beta |
[ In the latent class case ( |
Omega |
[ Can be In the latent class case ( |
Sigma |
[ In the ordered case ( |
gamma |
[ The event |
weights |
[ |
re_position |
[ By default, the last |
gcdf |
[ In the no-panel ( |
lower_bound |
[ |
input_checks |
[ |
ordered, ranked, mixed, panel, lc |
[ |
A numeric vector of length N, the probabilities for the observed
choices y.
In the panel case (panel = TRUE), the probabilities of the observed choice
sequence of length length(Tp).
If y is NULL and in the non-panel case (panel = FALSE), a matrix of
dimension N times J, the probabilities for all alternatives.
In the ranked case (ranked = TRUE), only first place choice probabilities
are computed, which is equivalent to computing choice probabilities in the
regular (maximum utility) model.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.