
Updates to choice modeling were introduced in Stata 10.
|
Order |
. use http://www.stata-press.com/data/r10/restaurant, clear . nlogitgen type = restaurant(fast:Freebirds | PotatoShack, family: WingsNmore | LosNortenos | Amas, fancy: Christophers | CafeEccell) new variable type is generated with 3 groups label list lb_type lb_type: 1 fast 2 family 3 fancy . nlogit chosen cost distance rating || type: income kids, base(family) || restaurant:, noconst case(family_id) tree structure specified for the nested logit model type N restaurant N k ------------------------------------- fast 600 --- Freebirds 300 12 +- PotatoShack 300 15 family 900 --- Amas 300 78 |- LosNortenos 300 75 +- WingsNmore 300 69 fancy 600 --- Christophers 300 27 +- CafeEccell 300 24 ------------------------------------- total 2100 300 k = number of times alternative is chosen N = number of observations at each level Iteration 0: log likelihood = -541.93581 Iteration 1: log likelihood = -517.95909 (backed up) Iteration 2: log likelihood = -511.99261 (backed up) (output omitted) Iteration 16: log likelihood = -485.47333 Iteration 17: log likelihood = -485.47331 RUM-consistent nested logit regression Number of obs = 2100 Case variable: family_id Number of cases = 300 Alternative variable: restaurant Alts per case: min = 7 avg = 7.0 max = 7 Wald chi2(7) = 46.71 Log likelihood = -485.47331 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ chosen | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- restaurant | cost | -.1843847 .0933975 -1.97 0.048 -.3674404 -.0013289 distance | -.3797474 .1003828 -3.78 0.000 -.5764941 -.1830007 rating | .463694 .3264935 1.42 0.156 -.1762215 1.10361 ------------------------------------------------------------------------------ type equations ------------------------------------------------------------------------------ fast | income | -.0266038 .0117306 -2.27 0.023 -.0495952 -.0036123 kids | -.0872584 .1385026 -0.63 0.529 -.3587184 .1842016 -------------+---------------------------------------------------------------- family | income | (base) kids | (base) -------------+---------------------------------------------------------------- fancy | income | .0461827 .0090936 5.08 0.000 .0283595 .0640059 kids | -.3959413 .1220356 -3.24 0.001 -.6351267 -.1567559 ------------------------------------------------------------------------------ dissimilarity parameters ------------------------------------------------------------------------------ type | /fast_tau | 1.712878 1.48685 -1.201295 4.627051 /family_tau | 2.505113 .9646351 .614463 4.395763 /fancy_tau | 4.099844 2.810123 -1.407896 9.607583 ------------------------------------------------------------------------------ LR test for IIA (tau = 1): chi2(3) = 6.87 Prob > chi2 = 0.0762 ------------------------------------------------------------------------------