Generates synthetic choice data from the MNP data-generating process
estimated by run_mnprobit(): latent utility differences against the base
alternative (alternative 1),
$$w_i = X_i \beta + \delta + \varepsilon_i, \qquad
\varepsilon_i \sim N_{J-1}(0, \Sigma),$$
with alternative \(j > 1\) chosen iff
\(w_{ij} > \max(0, \max_{k \neq j} w_{ik})\) and the base chosen iff all
\(w_{ij} < 0\). Covariates are Uniform(-1, 1). Choice sets are balanced
(every individual faces all J alternatives), as the MNP estimator
requires; there is no outside-option flag — model an outside good as a
zero-covariate base alternative instead.
Arguments
- N
Number of choice situations.
- J
Number of alternatives (alternative 1 is the base).
- beta
Fixed coefficients for
x1..x{K_x}(lengthK_x = length(beta)).- delta
ASCs of the differenced utilities, one per non-base alternative (length
J - 1). Defaults to an alternating pattern ofc(0.5, -0.5).- Sigma
Covariance matrix of the differenced errors (
(J-1) x (J-1)).- seed
Random seed (
NULLskipsset.seed()).
Value
A choicer_sim object. true_params contains beta, delta,
and Sigma on the identified scale (see Details).
Details
The MNP likelihood only identifies parameters up to scale, so
true_params is reported on the identified scale (normalized by
\(\sigma_{11}\)): beta \(= \beta / \sqrt{\sigma_{11}}\), delta
\(= \delta / \sqrt{\sigma_{11}}\), and Sigma \(= \Sigma /
\sigma_{11}\) — the scale on which run_mnprobit() reports its posterior.
With the default Sigma (\(\sigma_{11} = 1\)) the DGP scale and the
identified scale coincide.
Examples
# \donttest{
sim <- simulate_mnp_data(N = 1000, J = 3, seed = 123)
print(sim)
#> <choicer_sim: mnp>
#> settings:
#> N = 1000
#> J = 3
#> K_x = 2
#> base_alt = 1
#> rows in $data: 3000
#> true_params: beta, delta, Sigma
# }