# Discrete Choice Example: Adjacent Categories Logit

The Adjacent Categories Logit example uses General Social Survey occupational outcomes data included with the Discrete Choice examples. This model includes the independent data, occatt, and the dependent variables, exper, educ, and white. Once data is loaded, estimation features are specified using the dcControl structure:
```//Step One: dcControl structure
//Declare dcControl structure
struct dcControl dcCt;
```
Next, the dcSet procedures are used for data setup:
```//Step Two: Describe data names
//Dependent variable
dcSetYVar(&dcCt,y[.,1]);
dcSetYLabels(&dcCt,"occatt");

//Independent variable
dcSetXVars(&dcCt,y[.,2:4]);
dcSetXLabels(&dcCt,"exper,educ,white");

//Reference category excluded from regression
dcSetReferenceCategory(&dcCt,1);```
The dcOut structure is declared:
```//Step Three: Declare dcOut structure
struct dcout dcout1;
```
Finally, calling the adjacentCategories procedure estimates the model and results are reported using the printDCOut procedure:
```//Step Four: Call AdjacentCategories

//Print Results
call printDCOut(dcout1);
```
Running printDcOut prints the model and data summary to the output screen:
```Adjacent Categories Results

Number of Observations:   337
Degrees of Freedom:       321

1 - Menial
2 - BC
3 - Craft
4 - WC
5 - Pro

Distribution Among Outcome Categories For occatt

Dependent Variable       Proportion
Menial                    0.0920
BC                        0.2047
Craft                     0.2493
WC                        0.1217
Pro                       0.3323

Descriptive Statistics (N=337):

Independent Vars.          Mean             Std Dev          Minimum          Maximum
exper                    20.5015          13.9179          2.0000           66.0000
educ                     13.0950          2.9377           3.0000           20.0000
white                    0.9169           0.2756           0.0000           1.0000```
All coefficients, odds ratios, and marginal effect tables are printed:
```COEFFICIENTS

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

Variables      Coefficient               se            tstat             pval
Constant: BC            0.741             1.52            0.488            0.626
Constant: Craft            -1.83             1.19            -1.55            0.122
Constant: WC          -5.15**             1.59            -3.23          0.00125
Constant: Pro          -5.28**             1.68            -3.14          0.00172
exper : BC          0.00472           0.0174            0.271            0.786
exper : Craft           0.023*           0.0126             1.83           0.0674
exper : WC          0.00691            0.014            0.495            0.621
exper : Pro          0.00106           0.0144           0.0735            0.941
educ : BC          -0.0994            0.102           -0.972            0.331
educ : Craft          0.193**           0.0775             2.49           0.0126
educ : WC          0.259**           0.0935             2.77          0.00555
educ : Pro         0.426***           0.0922             4.62        3.91e-006
white : BC            1.24*            0.724             1.71           0.0878
white : Craft           -0.764            0.632            -1.21            0.227
white : WC              1.1            0.819             1.34            0.179
white : Pro            0.203            0.869            0.233            0.815
-----------------------------------------------------------------------------------------------
Comparisons to Menial
*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
exper : BC           1.0047          0.97105           1.0396
exper : Craft           1.0232          0.99836           1.0487
exper : WC           1.0069          0.97974           1.0349
exper : Pro           1.0011          0.97328           1.0296
educ : BC          0.90536           0.7409           1.1063
educ : Craft           1.2132           1.0422           1.4122
educ : WC           1.2961            1.079           1.5568
educ : Pro           1.5307           1.2775           1.8339
white : BC           3.4435          0.83244           14.245
white : Craft          0.46573          0.13484           1.6086
white : WC           3.0013          0.60334            14.93
white : Pro            1.225          0.22293           6.7313
----------------------------------------------------------------------------
Comparisons to Menial

MARGINAL EFFECTS
Partial probability with respect to mean x
Marginal Effects for X Variables in Menial category
---------------------------------------------------------------------------

Variables       Coefficient     se              tstat           pval
exper            0.00113        ( 0.000788)      1.43            0.153
educ             0.0211***      ( 0.00491)       4.29            2.33e-005
white            0.0468         ( 0.0386)        1.21            0.227
---------------------------------------------------------------------------
Comparisons to Menial
Estimate se in parentheses.
*p-val<0.1 **p-val<0.05 ***p-val<0.001

Marginal Effects for X Variables in BC category
---------------------------------------------------------------------------

Variables       Coefficient     se              tstat           pval
exper            0.00357        ( 0.00646)       0.553           0.581
educ             0.0124         ( 0.0346)        0.357           0.721
white            0.449          ( 0.289)         1.56            0.121
---------------------------------------------------------------------------
Comparisons to Menial
Estimate se in parentheses.
*p-val<0.1 **p-val<0.05 ***p-val<0.001

Marginal Effects for X Variables in Craft category
---------------------------------------------------------------------------

Variables       Coefficient     se              tstat           pval
exper            0.00723*       ( 0.00401)       1.8             0.0722
educ             0.0793**       ( 0.0347)        2.28            0.023
white           -0.106          ( 0.173)        -0.614           0.54
---------------------------------------------------------------------------
Comparisons to Menial
Estimate se in parentheses.
*p-val<0.1 **p-val<0.05 ***p-val<0.001

Marginal Effects for X Variables in WC category
---------------------------------------------------------------------------

Variables       Coefficient     se              tstat           pval
exper            0.00118        ( 0.00107)       1.1             0.272
educ             0.0326**       ( 0.0109)        2.99            0.00301
white            0.115*         ( 0.0648)        1.77            0.0774
---------------------------------------------------------------------------
Comparisons to Menial
Estimate se in parentheses.
*p-val<0.1 **p-val<0.05 ***p-val<0.001

Marginal Effects for X Variables in Pro category
---------------------------------------------------------------------------

Variables       Coefficient     se              tstat           pval
exper            0.00212        ( 0.00434)       0.489           0.625
educ             0.139***       ( 0.0337)        4.13            4.63e-005
white            0.127          ( 0.256)         0.497           0.619
---------------------------------------------------------------------------
Comparisons to Menial
Estimate se in parentheses.
*p-val<0.1 **p-val<0.05 ***p-val<0.001
```
In addition, the mode produces a number of summary statistics for diagnostics:
```********************SUMMARY STATISTICS********************

MEASURES OF FIT:

-2 Ln(Lu):                                   853.6010
-2 Ln(Lr): All coeffs equal zero            1084.7612
-2 Ln(Lr): J-1 intercepts                   1019.6881
LR Chi-Square (coeffs equal zero):           231.1602
d.f.                                     16.0000
p-value =                                 0.0000
LR Chi-Square (J-1 intercepts):              166.0872
d.f.                                     12.0000
p-value =                                 0.0000
Count R2, Percent Correctly Predicted:       147.0000
Ben-Akiva and Lerman's Adjusted R-square:      0.1570
Cragg and Uhler's pseudo R-square:             0.0325
Akaike Information Criterion:                  2.6279
Bayesian Information Criterion1:               0.1814
Hannan-Quinn Information Criterion:            2.7002

OBSERVED AND PREDICTED OUTCOMES

|                    Predicted
Observed |     Y01      Y02      Y03      Y04      Y05    Total
----------------------------------------------------------------------------
Y01 |       0       21        6        0        4       31
Y02 |       0       57        6        0        6       69
Y03 |       0       60       10        0       14       84
Y04 |       0       24        3        0       14       41
Y05 |       0       24        8        0       80      112

----------------------------------------------------------------------------
Total |       0      186       33        0      118      337
```

### Have a Specific Question?

Get a real answer from a real person

### Need Support?

Get help from our friendly experts.