Discrete Choice Example - Conditional Logit

Conditional Logit Example

This conditionalLogit example uses Powers and Xie (2000) categorical data. The independent data, mode, measures mode of transportation choice: train, bus, or car. It also includes several attributes of these categories: terminal waiting time (ttme), in vehicle choice (invc), in vehicle time (invt), and generalized cost (GC). The first step to performing analysis is to load the data:
new;
cls;
library dc;

//Load Data
loadm y = powersxie_mat;
Once this data is loaded, estimation features are specified using the dcControl structure. This structure must be declared then initialized using the dcControlCreate procedure:
//Step One: dcControl structure
//Declare dcControl structure
struct dcControl dcCt;

//Initialize dcControl structure 
dcCt = dcControlCreate();
Prior to estimation, the dcSet procedures are used to setup model parameters and data:
//Step Two: Describe data 
//Dependent variable
dcSetYVar(&dcCt,y[.,2]);
dcSetYLabel(&dcCt,"mode");
dcSetCategoryVarLabels(&dcCt,"choiceno");

//Category Labels
dcSetCategoryVar(&dcCt,y[.,1]);
dcSetYCategoryLabels(&dcCt,"train,bus,car");

//Attribute variables 
dcSetAttributeVars(&dcCt,y[.,3:6]);
dcSetAttributeLabels(&dcCt,"ttme,invc,invt,GC");
Next, the dcOut structure is declared:
//Step Three: Declare dcOut structure 
struct dcout dcout1;
Finally, calling the conditionalLogit procedure estimates the model and results are reported using the printDCOut procedure:
//Step Four: Call conditionalLogit 
dcout1 = conditionalLogit(dcCt);

//Print Results
call printDCOut(dcout1);
The printDCOut procedure prints a model and data summary to the output screen:
Conditional Logit Results

Number of Observations:   152
Degrees of Freedom:       148


  1 - train
  2 - bus
  3 - car


Distribution Among Outcome Categories For mode 


Dependent Variable       Proportion  
train                     0.4145     
bus                       0.1974     
car                       0.3882
In addition, coefficient estimates, odds ratios, and marginal effects are printed:
COEFFICIENTS

Coefficient Estimates
---------------------------------------------------------------------------

       Variables      Coefficient               se            tstat             pval 
            ttme         -0.00224          0.00714           -0.314            0.754 
            invc         -0.435**            0.133            -3.28          0.00105 
            invt       -0.0772***           0.0194            -3.99        6.57e-005 
              GC          0.431**            0.133             3.24          0.00121 
---------------------------------------------------------------------------
*p-val<0.1 **p-val<0.05 ***p-val<0.001

 ODDS RATIO

Odds Ratio
----------------------------------------------------------------------------

       Variables       Odds Ratio  95% Lower Bound  95% Upper Bound 
            ttme          0.99776          0.98389           1.0118 
            invc          0.64719           0.4989          0.83957 
            invt          0.92567          0.89122          0.96146 
              GC            1.539           1.1854           1.9981 
----------------------------------------------------------------------------

MARGINAL EFFECTS  
             Partial probability with respect to mean attributes
Marginal Effects for Attribute: ttme
------------------------------------------------------------

Variables       train           bus             car             
train           -0.00029         9.5e-005        0.000195       
                ( 0.000928)     ( 0.000295)     ( 0.000633)     
bus              9.5e-005       -0.000218        0.000123       
                ( 0.000295)     ( 0.000683)     ( 0.000388)     
car              0.000195        0.000123       -0.000318       
                ( 0.000633)     ( 0.000388)     ( 0.00102)      
------------------------------------------------------------

Estimate se in parentheses.
*p-val<0.1 **p-val<0.05 ***p-val<0.001

Marginal Effects for Attribute: invc
--------------------------------------------------------

Variables       train           bus             car             
train           -0.0564***       0.0184***       0.0379***      
                ( 0.0159)       ( 0.00526)      ( 0.0111)       
bus              0.0184***      -0.0423***       0.0238**       
                ( 0.00526)      ( 0.0123)       ( 0.00738)      
car              0.0379***       0.0238**       -0.0618***      
                ( 0.0111)       ( 0.00738)      ( 0.0181)       
--------------------------------------------------------

Estimate se in parentheses.
*p-val<0.1 **p-val<0.05 ***p-val<0.001

Marginal Effects for Attribute: invt
------------------------------------------------------------

Variables       train           bus             car             
train           -0.01***         0.00327***      0.00674***     
                ( 0.00225)      ( 0.000769)     ( 0.00159)      
bus              0.00327***     -0.0075***       0.00423***     
                ( 0.000769)     ( 0.00172)      ( 0.00103)      
car              0.00674***      0.00423***     -0.011***       
                ( 0.00159)      ( 0.00103)      ( 0.00254)      
------------------------------------------------------------

Estimate se in parentheses.
*p-val<0.1 **p-val<0.05 ***p-val<0.001

Marginal Effects for Attribute: GC
--------------------------------------------------------

Variables       train           bus             car             
train            0.0559***      -0.0183***      -0.0376**       
                ( 0.0161)       ( 0.00528)      ( 0.0113)       
bus             -0.0183***       0.0419***      -0.0236**       
                ( 0.00528)      ( 0.0122)       ( 0.00731)      
car             -0.0376**       -0.0236**        0.0612***      
                ( 0.0113)       ( 0.00731)      ( 0.0182)       
--------------------------------------------------------

Estimate se in parentheses.
*p-val<0.1 **p-val<0.05 ***p-val<0.001
Finally, the example also returns a number of summary statistics for model diagnostics:
********************SUMMARY STATISTICS********************

MEASURES OF FIT:

  -2 Ln(Lu):                                   192.6971 
  -2 Ln(Lr): All coeffs equal zero             333.9781 
  -2 Ln(Lr): J-1 intercepts                    320.0034 
  LR Chi-Square (coeffs equal zero):           141.2811 
       d.f.                                      4.0000 
       p-value =                                 0.0000 
  LR Chi-Square (J-1 intercepts):              127.3064 
       d.f.                                      2.0000 
       p-value =                                 0.0000 
  Count R2, Percent Correctly Predicted:       123.0000 
  Adjusted Percent Correctly Predicted:          0.6742 
  Madalla's pseudo R-square:                     0.5672 
  McFadden's pseudo R-square:                    0.3978 
  Ben-Akiva and Lerman's Adjusted R-square:      0.3978 
  Cragg and Uhler's pseudo R-square:             0.1818 
  Akaike Information Criterion:                  1.3204 
  Bayesian Information Criterion1:               0.0796 
  Hannan-Quinn Information Criterion:            1.3527 


OBSERVED AND PREDICTED OUTCOMES

           |           Predicted
  Observed |     Y01      Y02      Y03    Total 
  ----------------------------------------------------------
       Y01 |      47        0       16       63 
       Y02 |       0       23        7       30 
       Y03 |       3        3       53       59 

  ----------------------------------------------------------
     Total |      50       26       76      152

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy