Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: More on clogit: two questions


From   Julia Gamas <[email protected]>
To   [email protected]
Subject   st: More on clogit: two questions
Date   Wed, 19 Jan 2005 08:42:50 -0500

Hi again,
the reason I've separated cost into public and private is because I'm assuming
that they are perceived differently by the user (Ben-Akiva&Lerman 1985 have an
example of such a model in their text book).  So my question would then be, how
CAN I include alternative specific variables into the conditional logit model
in Stata?
Thanks for any help.
Julia

> Date: Tue, 18 Jan 2005 10:24:57 -0500
> From: Julia Gamas <[email protected]>
> Subject: st: clogit: two questions
> 
> Dear all,
> I have two questions about clogit: one, about whether or not I "fed" the
> data
> correctly to Stata, the second, about the sign on my coefficients.  I do
> appologize if there is a simple answer that I overlooked.
> 
> 1.  I've "fed" data that is alternative specific to find the choice=1 of
> using
> private transportation versus choice=0 of using public transit.  I have
> sociodemographic variables and generic variables too, but my concern is with
> the alternative specific variable of mode cost.  The format I used was the
> following for all ID's, can anybody tell me if this is wrong and if so, how
> to
> fix it (I couldn't find more information in the Stata manual that might
> help).
> 
> Id  Mode  Choice    Car-Cost     Public-transit-Cost
> 32  1        1       120          0
> 32  2        0         0         20
> 
> 
> Did I do the right thing by putting in the cost of using a car when the mode
> is
> a car and zero in car cost when the mode is public?
> 
> 2.  I obtain a POSITIVE coefficient from public transit cost.  My
> interpretation
> is that the more public tranist costs, the less we are likely to want to use
> it
> and we may substitute to a car.  I interpret this assuming that the model is
> estimating V1-V2 (utility of driving - utility of using public transit) as
> in
> the logit equations.  This would imply that the coefficient for public
> transit
> cost is negative in the utility of using public transit, but changes sign to
> positive when we subtract that utility from utility of driving.  I wanted to
> check with you if this interpretation is correct, or do I, in fact, have the
> wrong sign?
> 
> Any help you can give me would be immensely appreciated.
> 
> Sincerely,
> 
> Julia A. Gamas
> Mexico City Project, EAPS
> 77 Massachusetts Avenue 54-1823
> Cambridge, MA 02139
> 
> Date: Tue, 18 Jan 2005 10:01:21 -0600
> From: Leonelo Bautista <[email protected]>
> Subject: st: RE: clogit: two questions
> 
> Julia,
> - -clogit- is used for matched data. I guess your ID variable identifies the
> matching pair and that you are using this variable in the -group- option 
> - -group(id))-. I think you should have only one variable for transportation
> cost. So, for the first subject of the pair cost==120 and for the second
> subject cost==20. In the way you have your data now, the outcome variable
> (mode) is completely identifiable by the independent variables (all choice=1
> have public cost=0 and all choice=0 have private cost=0). I don't think you
> can get meaningful results in this way.
> 
> Leonelo Bautista
> 

> 
> Date: Tue, 18 Jan 2005 11:38:34 -0500
> From: Julia Gamas <[email protected]>
> Subject: st: clogit two question addendum-code
> 
> Dear all,
> someone asked that I post the code I used.  It is a long program so I'm
> pasting
> in the relevant parts: 
> 
> . /*Total private*/
> . generate privatecost=0
> 
> . replace privatecost=parkingcost+taxicost+carcost if tmode==1
> (23856 real changes made, 4 to missing)
> 
> . save Logitmodes, replace
> file Logitmodes.dta saved
> 
> . /*Total cost of using public transit:*/
> . generate publiccost=0 
> 
> . replace publiccost=(vp40_6+vp40_8+vp40_9+vp40_10)/100 if tmode==2
> (11888 real changes made)
> 
> . save Logitmodes, replace
> file Logitmodes.dta saved
> 
> ************
> 
> . generate pphhpriv=pphh*private
> 
> . generate en1priv=en1*private
> 
> . generate en2priv=en2*private
> 
> . generate incpppriv=incpp*private
> 
> . generate vehicspriv=privehics*private
> 
> . generate locpriv=location*private
> 
> . generate hhincpriv=survhhinc*private
> 
> . generate sexpriv=sex*private
> 
> . generate headpriv=hofh*private
> 
> . generate emppriv=empl*private
> 
> **********************************
> 
> . clogit choice private incpppriv vehicspriv pphhpriv locpriv blckpriv
> sexpriv
> headpriv emppriv pub
> > lictime privatetime, group (numob)
> note: 7614 groups (7614 obs) dropped due to all positive or
>       all negative outcomes.
> 
> Iteration 0:   log likelihood = -23280.907  
> Iteration 1:   log likelihood =  -17006.85  
> Iteration 2:   log likelihood = -16748.949  
> Iteration 3:   log likelihood =  -16745.97  
> Iteration 4:   log likelihood = -16745.968  
> Iteration 5:   log likelihood = -16745.968  
> 
> Conditional (fixed-effects) logistic regression   Number of obs   =     
> 68660
>                                                   LR chi2(11)     =  
> 14099.55
>                                                   Prob > chi2     =    
> 0.0000
> Log likelihood = -16745.968                       Pseudo R2       =    
> 0.2963
> 
> -
>
------------------------------------------------------------------------------
>       choice |      Coef.   Std. Err.      z    P>|z|     [95% Conf.
> Interval]
> -
>
-------------+----------------------------------------------------------------
>      private |  -.3507557   .0679412    -5.16   0.000     -.483918  
> -.2175933
>    incpppriv |   .0048378   .0005038     9.60   0.000     .0038504   
> .0058252
>   vehicspriv |   1.362893   .0289785    47.03   0.000     1.306096    
> 1.41969
>     pphhpriv |  -.2289017   .0083926   -27.27   0.000    -.2453508  
> -.2124525
>      locpriv |   -.147314    .029848    -4.94   0.000     -.205815   
> -.088813
>     blckpriv |  -.0042336   .0005498    -7.70   0.000    -.0053111  
> -.0031561
>      sexpriv |  -.1134412   .0298782    -3.80   0.000    -.1720013  
> -.0548811
>     headpriv |   1.589408   .0398303    39.90   0.000     1.511342   
> 1.667474
>      emppriv |   .8384917   .0303313    27.64   0.000     .7790434   
> .8979399
>   publictime |   .0041342   .0006889     6.00   0.000      .002784   
> .0054844
>  privatetime |  -.0099765   .0007839   -12.73   0.000    -.0115128  
> -.0084401
> -
>
------------------------------------------------------------------------------
> 
> . clogit, or
> 
> Conditional (fixed-effects) logistic regression   Number of obs   =     
> 68660
>                                                   LR chi2(11)     =  
> 14099.55
>                                                   Prob > chi2     =    
> 0.0000
> Log likelihood = -16745.968                       Pseudo R2       =    
> 0.2963
> 
> -
>
------------------------------------------------------------------------------
>       choice | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf.
> Interval]
> -
>
-------------+----------------------------------------------------------------
>      private |   .7041558   .0478412    -5.16   0.000     .6163637   
> .8044525
>    incpppriv |    1.00485   .0005062     9.60   0.000     1.003858   
> 1.005842
>   vehicspriv |    3.90748    .113233    47.03   0.000     3.691732   
> 4.135836
>     pphhpriv |   .7954067   .0066755   -27.27   0.000       .78243   
> .8085987
>      locpriv |   .8630229   .0257595    -4.94   0.000     .8139836   
> .9150167
>     blckpriv |   .9957754   .0005474    -7.70   0.000      .994703   
> .9968489
>      sexpriv |   .8927567   .0266739    -3.80   0.000     .8419781   
> .9465977
>     headpriv |   4.900848   .1952023    39.90   0.000     4.532811   
> 5.298768
>      emppriv |   2.312876   .0701525    27.64   0.000     2.179387   
> 2.454541
>   publictime |   1.004143   .0006917     6.00   0.000     1.002788   
> 1.005499
>  privatetime |   .9900731   .0007761   -12.73   0.000     .9885532   
> .9915954
> -
>
------------------------------------------------------------------------------
> 
************************************************************************

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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