This example runs the ordered logit model using the GAUSS DC application. It uses a version of the education program effectiveness data originally collected by Spector and Mazzeo (1980). The dataset includes 32 observations of 6 different variables: letter grade (ABC), grade point average (GPA ), an indicator of participation in a personalized system of instruction (PSI), student test scores on an economics test (TUCE), and indicators of if the student received an A (A) or A+ (APLUS1).
Load the data
This example uses the formula string syntax to load data using loadd
. The formula string syntax syntax allows users to load, transform and analyze data in one line.
new;
cls;
library dc;
// Load data
fname = getGAUSShome() $+ "pkgs/dc/examples/aldnel.dat";
y = loadd(fname);
Set up the model parameters
The Discrete Choice Module uses a suite of dcSet
functions to set various features of the model. An instance of the dcControl
structure must be declared for storing all parameters prior to calling any dcSet
functions.
// Step One: Declare dc control structure
struct dcControl dcCt;
// Initialize dc control structure
dcCt = dcControlCreate();
// Step Two: Describe data Labels
// Dependent variable
dcSetYVar(&dcCt, y[., 1]);
dcSetYLabel(&dcCt,"ABC");
// Independent variable Labels
dcSetXVars(&dcCt, y[., 2:4]);
dcSetXLabels(&dcCt, "GPA,TUCE,PSI");
// Category Labels
dcSetYCategoryLabels(&dcCt, "A,B,C");
Estimate the Model
The ordered logit model can be estimated using the orderedLogit
procedure. This function takes a dcControl
structure as an input and returns all output to a dcOut
structure. In addition, a complete report of results can be printed to screen using the printDCOut
procedure.
// Step Three: Declare dcOut struct
struct dcout dcout1;
// Step Four: Call orderedLogit
dcout1 = orderedLogit(dcCt);
// Print Results
call printDCOut(dcOut1);
Output
The output from orderedLogit
reads
Ordered Logit 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.0000
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-06 9.2207e-09 0.010499 PSI 0.0001372 2.4458e-07 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.001
********************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 Criterion: 2.1767 Hannan-Quinn Information Criterion: 2.0236 OBSERVED AND PREDICTED OUTCOMES | Predicted Observed | A B C Total ---------------------------------------------------------- A | 8 3 0 11 B | 3 8 2 13 C | 0 4 4 8 ---------------------------------------------------------- Total | 11 15 6 32