Download Nested Logit Model: A Non-IIA Choice Model for Structured Choice Situations - Prof. Bradfo and more Exams Political Science in PDF only on Docsity!
Nested Logit
Brad Jones
1 Department of Political Science
University of California, Davis
April 30, 2008
Nested Logit
I IIA “says” that the disturbances are independent and
homoskedastic.
I Odds are assumed to remain the same if some alternative is
removed.
I Problem: one left party is a close substitute (possibly) of
another.
I If CD voters split their vote across two leftist parties,
elimination of one from the choice set does not imply they will
randomly distribute over remaining choices.
I That is, they most likely will gravitate to the remaining leftist
party.
I If so, odds ratios will change because of nonrandom
redistribution.
Nested Logit
I Under NL (or MNNL), the idea is to group comparable
alternatives and then structure choice setting as a “tree.”
I Voter i decides to vote leftist, centrist, or rightist.
I Call this the “top level” choice.
I Once this choice is made, the voter must decide which
outcome to choose:
I Left: Green, Workers; Center: SD, Moderate; Right: CR,
Extreme Right
I Basic result from conditional probability: Prij = Prj|i × Pri
I J outcomes (i.e. parties) and i branches.
Nested Logit
I The conditional probabilities can only be a function of the xij :
Prj|i =
exp(β
xij ) exp(α
wi )
exp(α
wi )
∑N
i
k=1 exp(β
xik )
exp(β
xij )
∑N
i
k=
exp(β′xik )
I The “top level” probability is defined by first identifying what
is sometimes called an “inclusive value” parameter:
Ii = log
Ni
k=
exp(β
xik )
I The probability of branch i is then
Pri =
exp(α
wi + τi Ii )
∑C
m=
exp(α′wi + τmIm)
Nested Logit
I The “inclusive value” parameter, τ , is the weight accorded
each of the branches.
I Under CL (or MNL), we assume this weight is fixed at 1.
I Estimation is done via full information maximum likelihood:
log L =
∑^ N
i
log
[
Prj|i × Pri
]
I Model has many parameters.
I It requires a lot of work to interpret.
I My job to show you how...
I Stata is actually quite good w/this model.
. list family_id restaurant chosen kids rating distance cost income in 1/
+---------------------------------------------------------------------------------+
| family~d restaurant chosen kids rating distance cost income |
- | 1 Freebirds 1 1 0 1.245553 5.444695 39 |
- | 1 MamasPizza 0 1 1 2.82493 6.19446 39 |
- | 1 CafeEccell 0 1 2 4.21293 8.182085 39 |
- | 1 LosNortenos 0 1 3 4.167634 9.861741 39 |
| 1 WingsNmore 0 1 2 6.330531 9.667909 39 |
- | 1 Christophers 0 1 4 10.19829 25.95777 39 |
- | 1 MadCows 0 1 5 5.601388 28.99846 39 |
- | 2 Freebirds 0 3 0 4.162657 5.26874 58 |
- | 2 MamasPizza 0 3 1 2.865081 5.728618 58 |
- | 2 CafeEccell 0 3 2 5.337799 7.054855 58 | |---------------------------------------------------------------------------------|
- | 2 LosNortenos 1 3 3 4.282864 10.78514 58 |
- | 2 WingsNmore 0 3 2 8.133914 8.313948 58 |
- | 2 Christophers 0 3 4 8.664631 21.2801 58 |
- | 2 MadCows 0 3 5 9.119597 25.87567 58 |
- | 3 Freebirds 1 3 0 2.112586 4.616315 30 | |---------------------------------------------------------------------------------|
- | 3 MamasPizza 0 3 1 2.215329 5.992166 30 |
- | 3 CafeEccell 0 3 2 6.978715 7.980528 30 |
- | 3 LosNortenos 0 3 3 5.117877 10.0605 30 |
- | 3 WingsNmore 0 3 2 5.312941 8.76644 30 |
- | 3 Christophers 0 3 4 9.551273 23.64499 30 | |---------------------------------------------------------------------------------|
- | 3 MadCows 0 3 5 5.539806 24.72128 30 | +---------------------------------------------------------------------------------+
. nlogitgen type=restaurant(fast: Freebirds | MamasPizza, family: CafeEccell | LosNortenos | WingsNmore, fancy: Christophers | MadCows)
This returns: new variable type is generated with 3 groups label list lb_type lb_type: 1 fast 2 family 3 fancy
. nlogittree restaurant type <-GIVES US THE TREE STRUCTURE. Type is the branch; restaurants are the "twigs."
tree structure specified for the nested logit model
top --> bottom
type restaurant
fast Freebirds MamasPizza family CafeEccell LosNorte~s WingsNmore fancy Christop~s MadCows
For fun.
. nlogit chosen (restaurant= cost rating distance) (type = incFast incFancy kidFast kidFancy), group(family_id) nolog ivc(fast=1, family=1, fancy=1) notree <---CONSTRAINING TAU TO 1 User-defined constraints: IV constraints: [fast]_cons = 1 [family]_cons = 1 [fancy]_cons = 1 Nested logit regression Levels = 2 Number of obs = 2100 Dependent variable = chosen LR chi2(7) = 189. Log likelihood = -488.90834 Prob > chi2 = 0.
| Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- restaurant | cost | -.1367799 .0358479 -3.82 0.000 -.2070404 -. rating | .3066626 .1418291 2.16 0.031 .0286827. distance | -.1977508 .0471653 -4.19 0.000 -.2901931 -. -------------+---------------------------------------------------------------- type | incFast | -.0390182 .0094018 -4.15 0.000 -.0574454 -. incFancy | .0407053 .0080405 5.06 0.000 .0249462. kidFast | -.2398756 .1063674 -2.26 0.024 -.4483517 -. kidFancy | -.3893868 .1143797 -3.40 0.001 -.6135669 -. -------------+---------------------------------------------------------------- (incl. value | parameters) | type | /fast | 1..... /family | 1..... /fancy | 1.....
Constraining tau=1 should recover conditional logit:
. clogit chosen cost rating dist incFast incFancy kidFast kidFancy, group(family_id) Conditional (fixed-effects) logistic regression Number of obs = 2100 LR chi2(7) = 189. Prob > chi2 = 0. Log likelihood = -488.90834 Pseudo R2 = 0.
chosen | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- cost | -.1367799 .0358479 -3.82 0.000 -.2070404 -. rating | .3066622 .1418291 2.16 0.031 .0286823. distance | -.1977505 .0471653 -4.19 0.000 -.2901927 -. incFast | -.0390183 .0094018 -4.15 0.000 -.0574455 -. incFancy | .0407053 .0080405 5.06 0.000 .0249462. kidFast | -.2398757 .1063674 -2.26 0.024 -.448352 -. kidFancy | -.3893862 .1143797 -3.40 0.001 -.6135662 -.
(And it does; verify from previous slide)
Nested Logit: Illustration
I There are clearly many parameters here.
I Let’s figure out what all of this means.
I I’m going to make use of Stata’s predict options to back
out various quantities.
I Note, any of these quantities could be retrieved “by hand”
using functions from above.
Nested Logit: Illustration
I predict pb will return the probability of choosing restaurant
j.
I predict p1, p1 will return the probability of branch i.
I predict condpb, condpb will return Prj|i.
I predict xbb, xbb will return the linear prediction for the
bottom-level choice.
I predict xb1, xb1 will return the linear prediction for the
top-level choice.
I predict ivb, ivb will return the inclusive value parameter.
- | 2 1 -1.22807 0 -.3007865 LosNortenos family |
- | 2 0 -1.846394 0 -.3007865 WingsNmore family |
- | 2 0 -2.804756 1.570648 -2.264743 Christophers fancy |
- | 2 0 -3.138791 1.570648 -2.264743 MadCows fancy | +-------------------------------------------------------------------------------+
Where do the numbers come from? xbb: Linear prediction for the bottom level
It’s a function of the covariates cost, rating, and distance. For the first observation, we see this is:
. display _b[cost]cost+_b[rating]rating+_b[distance]*distance -.
condpb: Conditional probability of restaurant j given branch i (from equation on previous slide):
. display exp(-.731619)/(exp(-.731619)+exp(-.8987747)) .
for "FreeBirds" and
. display exp(-.8987747)/(exp(-.731619)+exp(-.8987747)) .
for "MamasPizza."
xb1: Linear prediction for i branch
This is the linear prediction for the top-level model (or the branches):
. display -.0287502incFast + .0458373incFancy + -.0704164kidFast + -.3626381kidFancy -1.
(The parms are the alphas from the model output).