Bookmark and Share

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


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

st: need your help with nlogit model


From   Lanlan Wang <[email protected]>
To   [email protected]
Subject   st: need your help with nlogit model
Date   Sat, 31 Mar 2012 12:35:39 +0800

Dear all,

Hope to get your help with the nlogit model. I am stuck with this
model and don't know whether it is a command or database problem.

I try to look at which factors may have relationship with individual
choices of the transportation mode in their home-to-work trips.
Transportation modes in the data include: car, walk, bicycle, bus,
subway, and other. Based on these alternatives, the structure of the
decision tree looks like:

                                                    /\
                                                   /  \
                                                  /    \
                                                car   /\
                                                       /  \
                                                   (walk, bicycle,
bus, subway, other)


The factors which may have relationship with individual mode choice
are classified into four types:
1) whether the individual owns a car (owncar)
2) trip-related factors (such as trip distance)
3) individual and family characteristics (age, gender, per capita income, etc.)
4) accessibility factors (such as how many bus stops around the
origination and destination places, distance to the closest subway
stations, etc.)

The data structure is like:

TripID   Mode    decision    owncar   tripdistance    age
1             1             0             1              20.5           37
1             2             1             1              20.5           37
1             3             0             1              20.5           37
1             4             0             1              20.5           37
1             5             0             1              20.5           37
1             6             0             1              20.5           37
2             1             0             0              12              23
2             2             0             0              12              23
2             3             1             0              12              23
2             4             0             0              12              23
2             5             0             0              12              23
2             6             0             0              12              23
3             1             0             0              9                46


I used stata 12 and program is:


nlogitgen tree = mode(car:2, nonauto:1|3|4|5|6)
nlogittree mode tree, choice(decision)

 tree            N             mode          N        k
---------------------------------------
 car              37169 ---  2            35215  6350
 nonauot    223014 ---  1            35215  5759
                                  |- 3            35215 11766
                                  |- 4            35215  4549
                                  |- 5            35215  5332
                                  |- 6            35215  1459
---------------------------------------
                                 total          211290 35215

----------------------------------------
constraint 1 [car_tau]_cons=1
nlogit decision  trip-related-factors
individual-family-characteristics accessibility-factors || tree:
owncar, base(nonauto) || mode:, case(tripid) constraints(1)
-----------------------------------------------
stata gave me the following information:

-------------------------------------------------------
"note: 1 case (210106 obs) dropped due to no positive outcome or
       multiple positive outcomes per case
   no cases remain after removing invalid observations"
-------------------------------------------------------

I double checked the "case", and for each case, there is only one mode
selected (and the value of (choice) for other mode alternatives is
equal to zero).

I don’t know what I’m doing wrong. Can anyone help me please?


Thank you very much,

lanlan

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index