Binary Logit Example

This example demonstrates the use of a binary logit model. It models grade (A) achievement rates in a Economics course in relationship to cumulative grade point average (GPA), literacy test score (TUCE), and optional participation in a special economics course (PSI). The first step to setting up all Discrete Choice models is to declare and initialize the dcControl structure:
```//Step one: Declare dc control structure
struct dcControl dcCt;

//Initialize dc control structure
dcCt = dcControlCreate();
```
Next, load and setup the model data using the dcSet procedures:
```//Load data

//Step two: Describe data names
//Name of dependent variable
dcSetYVar(&dcCt,y[.,5]);
dcsetYLabel(&dcCt,"A");

//Name of independent variable
dcSetXVars(&dcCt,y[.,2:4]);
dcsetXLabels(&dcCt,"GPA,TUCE,PSI");```
Following data setup, declare the dcOut structure:
```//Step three: Declare dcOut struct
struct dcout dcout1;
```
Finally, call the binaryLogit procedure:
```//Step four: Call binary logit procedure
dcout1 = binaryLogit(dcCt);
call printDCOut(dcOut1);
```
The example prints the model and data description to screen:
```Binary Logit Results
2015-05-14 14:56:37

Number of Observations:   32
Degrees of Freedom:       28

1 - Y0
2 - Y1

Distribution Among Outcome Categories For A

Dependent Variable       Proportion
Y0                        0.6563
Y1                        0.3438

Descriptive Statistics (N=32):

Independent Vars.          Mean             Std Dev          Minimum          Maximum
GPA                      3.1172           0.4521           2.0600           4.0000
TUCE                     21.9375          3.7796           12.0000          29.0000
PSI                      0.4375           0.4883           0.0000           1.0000
```
All coefficients, odds ratios, and marginal effects are printed:
```COEFFICIENTS

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

Variables      Coefficient               se            tstat             pval
Constant: Y0            -13**             4.93            -2.64          0.00828
GPA           2.83**             1.26             2.24           0.0252
TUCE           0.0952            0.142            0.672            0.501
PSI           2.38**             1.06             2.23           0.0255
--------------------------------------------------------------------------------
*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
GPA            16.88           1.4201           200.63
TUCE           1.0998          0.83336           1.4515
PSI           10.791           1.3393           86.941
----------------------------------------------------------------------------

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

Variables       Coefficient     se              tstat           pval
GPA              0.534**        ( 0.237)         2.25            0.0321
TUCE             0.018          ( 0.0262)        0.685           0.499
PSI              0.449**        ( 0.197)         2.28            0.0299
---------------------------------------------------------------------------

Estimate se in parantheses.
*p-val<0.1 **p-val<0.05 ***p-val<0.001 ```
In addition a number of summary statistics for model diagnostics are printed:
```********************SUMMARY STATISTICS********************

MEASURES OF FIT:

-2 Ln(Lu):                                    25.7793
-2 Ln(Lr): All coeffs equal zero              44.3614
-2 Ln(Lr): J-1 intercepts                     41.1835
LR Chi-Square (coeffs equal zero):            18.5822
d.f.                                      4.0000
p-value =                                 0.0000
LR Chi-Square (J-1 intercepts):               15.4042
d.f.                                      3.0000
p-value =                                 0.0015
Count R2, Percent Correctly Predicted:        26.0000
Ben-Akiva and Lerman's Adjusted R-square:      0.2283
Cragg and Uhler's pseudo R-square:             0.2358
Akaike Information Criterion:                  1.0556
Bayesian Information Criterion1:               0.1832
Hannan-Quinn Information Criterion:            1.1163

OBSERVED AND PREDICTED OUTCOMES

|       Predicted
Observed |     Y01      Y02    Total
-------------------------------------------------
Y01 |      18        3       21
Y02 |       3        8       11

-------------------------------------------------
Total |      21       11       32
```

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.