Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Nested logit with three levels, some degenerate branches


From   Wafa Hakim Orman <[email protected]>
To   [email protected]
Subject   st: Nested logit with three levels, some degenerate branches
Date   Fri, 20 Feb 2009 08:13:33 -0600

Hi all,

I apologize if anyone is getting this twice -- I'm resending it because it didn't seem to show up the first time I sent it.

Been having a load of trouble with a nested logit model that ought to be really simple.

I'm trying to run a model with 3 levels. I am modeling people's choice to switch their religious denominations, and then which one they switch to. So I have a nested logit tree that looks like: (simplified for brevity's sake)


. nlogittree relswitch denom switch, choice(chosen)

tree structure specified for the nested logit model

 switch   N               denom   N       relswitch           N    k
-------------------------------------------------------------
 yes    36113 --- protestant  13132 --- 3          	3283   42
                                         |- 4            3283  111
                                         |- 5            3283  150
                                         |+- 6           3283   83
               |- catholic   3283 --- 7            3283  187
               |- other       3283 --- 9            3283  407
               |- none       3283 --- 10           3283  748
               |- jewish     3283 --- 8            3283    8
               +- stay       3283 --- 0            3283    0
 no     51722 --- protestant   18808 --- 3            4702    0
                                         |- 4            4702    0
                                         |- 5            4702    0
                                         |+- 6           4702    0
               |- catholic   4702 --- 7            4702    0
               |- other       4702--- 9              4702     0
               |- none       4702 --- 10           4702    0
               |- jewish     4702 --- 8            4702    0
               +- stay       4702 --- 0            4702 4702
-------------------------------------------------------------
                                           total

People choose whether to switch their denomination or stay in the one they were raised. If they switch, they choose between Catholic, Protestant, Jewish, Other, & None. If they choose Protestant, they then choose between Methodist, Lutheran, Episcopal, & Presbyterian (options 3, 4, 5 & 6). Out of these, the "stay" branch is degenerate from the very first nest onwards and the Catholic, Jewish, Other etc ones are degenerate for the bottom nest. I have constraints that set all of these taus to 1. They are:

constraint 1 [catholic_tau]_cons=1
constraint 4 [other_tau]_cons=1
constraint 5 [jewish_tau]_cons=1
constraint 7 [stay_tau]_cons=1

I use "None" as the base category.

These are my nested logit commands:

nlogitgen denom = relswitch(protestant: 3|4|5|6, catholic: 7, other:9, none:10, jewish:8, stay:0) nlogitgen switch = religionswitchever(yes: 1, no: 0) ***these then generate the tree depicted above nlogit chosen z1 z2 || denom: age female income, base(none) || switch: collegedegree || relswitch: , case(ID) noconst constraints(1 4 5 7)

z1 & z2 vary by denomination; all other independent variables vary by individual.

The relswitch variable contains the 9 options. chosen is the indicator variable showing which was chosen.

For some reason I keep getting the error:
at least one alternative of switch is contained in muliple alternatives of denom; this is not
allowed
r(459);


I was able to make the model work when I had only two nests, so I was only looking at those who switched. But now that I have 3, since I want to model the switch decision too, I am obviously messing up something with the data setup or the syntax.

What am I doing wrong? Any help would be greatly appreciated.

Best regards,
Wafa Orman.

--
Wafa Hakim Orman
Assistant Professor
Department of Economics and Information Systems
College of Business Administration
University of Alabama in Huntsville
301 Sparkman Drive
Huntsville, AL 35899
(256) 824-5674
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index