Introduction
This ordered logit example uses the Greene course performance data.The independent data, ABC, categorizes student grades in an economics course as A,B,or C. The dependent variables are cumulative grade point average (GPA), literacy test scores (TUCE), and participation in a special economics course (PSI).
Step 1: Load the data
new;
cls;
library dc;
// Load Data
loadm y = aldnel_mat;
Step 2: Initialize control structure
Once this data is loaded, estimation features are specified using the dcControl
structure. This structure must be declared then initialized:
// Declare dcControl structure
struct dcControl dcCt;
// Fill with default settings
dcCt = dcControlCreate();
Step 3: Specify model parameters and data
Prior to estimation, the dcSet
procedures are used to setup model parameters and data:
// Dependent variable
dcSetYVar(&dcCt,y[.,1]);
dcSetYLabels(&dcCt,"ABC");
// Category Labels
dcSetYCategoryLabels(&dcCt,"A,B,C");
// Independent variables
dcSetXVars(&dcCt,y[.,2:4]);
dcSetXLabels(&dcCt,"GPA,TUCE,PSI");
Step 4: Declare results structure
Next, the dcOut
structure is declared:
// Declare dcOut structure to hold results
struct dcout dcout1;
Step 5: Perform estimation and print results
Finally, calling the orderedLogit
procedure estimates the model and results are reported using the printDCOut
procedure:
// Estimate ordered logit model
dcout1 = orderedLogit(dcCt);
// Print Results
call printDCOut(dcout1);
The printDCOut
procedure prints a model and data summary to the output screen:
Ordered Probit Results Number of Observations: 32 Degrees of Freedom: 27 1 - A 2 - B 3 - C Distribution Among Outcome Categories For ABC Dependent Variable Proportion A 0.3438 B 0.4063 C 0.2500 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.0000In addition, coefficient estimates, odds ratios, and marginal effects are printed:
COEFFICIENTS Coefficient Estimates -------------------------------------------------------------- Variables Coefficient se tstat pval GPA -3.23** 1.07 -3.03 0.00245 TUCE 0.00499 0.106 0.047 0.963 PSI -1.44* 0.824 -1.75 0.08 Threshold : 1 -11.5** 3.56 -3.24 0.00119 Threshold : 2 -8.89** 3.23 -2.75 0.00589 -------------------------------------------------------------- *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 0.23615 0.046937 1.1881 TUCE 9.8391e-006 9.2206e-009 0.010499 PSI 0.0001372 2.4458e-007 0.076969 ------------------------------------------------------------- MARGINAL EFFECTS Partial probability with respect to mean x Marginal Effects for X Variables in A category ------------------------------------------------------------- Variables Coefficient se tstat pval GPA -0.914** (0.394) -2.32 0.0274 TUCE 0.00141 (0.0301) 0.0469 0.963 PSI -0.408 (0.272) -1.5 0.144 -------------------------------------------------------------- Estimate se in parentheses. *p-val<0.1 **p-val<0.05 ***p-val<0.001 Marginal Effects for X Variables in B category ----------------------------------------------------------- Variables Coefficient se tstat pval GPA -1.82** (0.819) -2.22 0.0341 TUCE 0.00281 (0.0598) 0.047 0.963 PSI -0.813 (0.525) -1.55 0.132 ----------------------------------------------------------- Estimate se in parentheses. *p-val<0.1 **p-val<0.05 ***p-val<0.001 Marginal Effects for X Variables in C category ---------------------------------------------------------- Variables Coefficient se tstat pval GPA -0.497** (0.226) -2.2 0.0357 TUCE 0.000768 (0.0164) 0.047 0.963 PSI -0.222 (0.133) -1.67 0.105 ---------------------------------------------------------- Estimate se in parentheses. *p-val<0.1 **p-val<0.05 ***p-val<0.001Finally, the example also returns a number of summary statistics for model diagnostics:
********************SUMMARY STATISTICS******************** MEASURES OF FIT: -2 Ln(Lu): 52.3256 -2 Ln(Lr): All coeffs equal zero 70.3112 -2 Ln(Lr): J-1 intercepts 69.0937 LR Chi-Square (coeffs equal zero): 17.9855 d.f. 5.0000 p-value = 0.0000 LR Chi-Square (J-1 intercepts): 16.7680 d.f. 3.0000 p-value = 0.0008 Count R2, Percent Correctly Predicted: 20.0000 Adjusted Percent Correctly Predicted: 0.3684 Madalla's pseudo R-square: 0.4079 McFadden's pseudo R-square: 0.2427 Ben-Akiva and Lerman's Adjusted R-square: 0.1558 Cragg and Uhler's pseudo R-square: 0.0899 Akaike Information Criterion: 1.9477 Bayesian Information Criterion1: 0.2290 Hannan-Quinn Information Criterion: 2.0236 OBSERVED AND PREDICTED OUTCOMES | Predicted Observed | Y01 Y02 Y03 Total ---------------------------------------------------------- Y01 | 8 3 0 11 Y02 | 3 8 2 13 Y03 | 0 4 4 8 ---------------------------------------------------------- Total | 11 15 6 32