[Limdep Nlogit List] Run Models by Factor or Group Level

Richard Turner richard.turner at imarketresearch.com
Wed Apr 11 06:07:04 AEST 2018


Greetings,

I have a factor/categorical variable with 52 levels. I would like to run a
model by each level. Is this possible using "PROC/ENDPROC" in NLOGIT? After
reading this documentation
<https://protect-au.mimecast.com/s/tDCyCP7yOZt9ODz7Czfy5Z?domain=people.stern.nyu.edu>,
it wasn't clear to me how to iterate over the levels of my factor
(Additionally,
my factor levels are not enumerated sequentially).

I simplified my data so that my factor variable only had two levels:  1 and
2.

I tried using the below code:
CALC ; i=1$
PROC
CALC ; List; i;i=i+1$
Sample;all$
REJECT; FACTOR_VAR#i$
DISCRETECHOICE
;LHS=CHO, CSET
;RHS=
NALvl1, NALvl2, NALvl3, NALvl4, NALvl5, NALvl6, NALvl7, NALvl8,
NALvl9, NALvl10, NALvl11, NALvl12, NALvl13, NALvl14, NALvl15$
Sample;all$
GO TO ; i <= 2 $
ENDPROC
EXECUTE

After running the code I get this output and only one model is estimated:
[CALC] I       =        1.0000000
[CALC] I       =        2.0000000
Calculator: Computed   2 scalar results
Error     29: REJECT:0 obs. in resulting sample. Current sample restored.

Regards,
_____________________________________________

Richard


More information about the Limdep mailing list