Draws a data set from the nested logit of nlogit(): utilities from beta
(and gamma) as in rmnl(), nests as in nlogit(), and inclusive-value
parameters lambda (one per nest, in the order of nests; a singleton
nest's value is irrelevant). With case-specific covariates only, lambda
is identified just through the curvature of the inclusive values and
recovered imprecisely; alternative-specific covariates (gamma) identify
it sharply.
Arguments
- n
Number of cases.
- beta
A \(p \times (J-1)\) matrix: rows are the intercept and the \(p - 1\) covariates, columns the non-base alternatives (column names become their labels; the base is
"a"unlesslevelsis given).- nests
A named list assigning every level to a nest.
- lambda
Inclusive-value parameters, one per nest.
- gamma
Optional generic coefficients on alternative-specific covariates
w1,w2, ... (standard normal draws for every case and alternative). When given, the data are returned in the long layout: one row per case and alternative with columnsid,alt,chosen(0/1), thew's, thex's (and, for inflated draws ofrmnl(), thez's ands), ready forchosen ~ w1 | x1 + x2withid = "id", alt = "alt".- x
Optional data frame of case-specific covariates (
nrows) to use instead of standard normal draws.- levels
Optional labels of all \(J\) alternatives (base first).
Value
A data frame as in rmnl(); the truth in the attribute "truth".