Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: Trouble with the nested logit syntax

From   Wameq Raza <>
Subject   st: Trouble with the nested logit syntax
Date   Thu, 9 Aug 2012 22:14:17 +0200

Dear Members,
I've been working on STATA 12 to implement a nested logit model. I've
gone through the FAQ
sections and various posting by members, but some of the things are
still not quite clear.
The background to my dataset is that I'm trying to ascertain the
determinants of health seeking
behaviour. The structure is setup at as follows:
Nest 1: Choice of Reporting an illness (Yes/No)
Nest 2: (Under the Yes option in Nest 1) Provider Categories: No Care
(falls ill, but does not seek
           care); Private Care; Public Care; Other
Nest 3: Specific Providers

The tree output below using the following command:

nlogitgen type = hwtype (noreport: norep, priv: private|rmp, pub:
public, othercare: other|nurse, nocare: none)
nlogitgen report = type(yes: priv pub othercare nocare, no:noreport)
nlogittree hwtype type report, choice(hw)

tree structure specified for the nested logit model

report   N type N       hwtype    N k
yes    179190 --- priv      59730 --- private 29865 1157
                                               +- rmp     29865 2682
                  - pub      29865 --- public  29865 346

                  - othercare   59730 --- nurse   29865 495
                                                 +- other   29865 115
                           +- nocare    29865 --- none    29865 810

no      29865 --- noreport 29865 --- norep   29865 29865
total  209055 35470

The syntax I'm trying to estimate the results:
nlogit hw || report: age || type: lntotalexp educy || hwtype:, case(id)

But after running it STATA tells me:
no cases remain after removing invalid observations

Is my syntax incorrect? I have been able to run the model when I only
ran it with Nests 2 and 3. But
in that case, I'm not being able to handle the degenerate nests. I
understand that the parameters of the
degenerate nests need to be constrained to 1, so I'm running the
follwoing syntax, but it doesn't seem
to be working:

constraint 1 [nocare_tau]_cons=1
constraint 1 [pub_tau]_cons=1
nlogit hw || type: lntotalexp educy || hwtype:, case(id) notree

I looked everywhere and having trouble locating the proper syntax. So
is there someone help me with my
two problems?

Kind regards,
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index