This example runs the stereotypical multinomial 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 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
// Dependent variable
dcSetYVar(&dcCt, y[., 1]);
dcSetYLabel(&dcCt, "ABC");
// Independent variables
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 stereoLogit
. 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 stereoLogit
dcout1 = stereoLogit(dcCt);
// Print Results
call printDCOut(dcOut1);
Output
The output from stereoLogit
reads
Stereo Logistic Results Number of Observations: 32 Degrees of Freedom: 26 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 Constant: A 11.3** 4.93 2.3 0.0213 Constant: C 16** 6.28 2.55 0.0107 GPA -4.38** 2.1 -2.09 0.037 TUCE -0.0693 0.177 -0.391 0.695 PSI -2.54* 1.31 -1.94 0.0525 Distance: B 0.655** 0.259 2.53 0.0114 --------------------------------------------------------------------------- *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.012486 0.00020319 0.76723 TUCE 0.93308 0.65965 1.3198 PSI 0.078949 0.0060662 1.0275 Distance: B 1.9242 1.1586 3.1956 ---------------------------------------------------------------------------- MARGINAL EFFECTS
Partial probability with respect to mean x Marginal Effects for X Variables in A category --------------------------------------------------------------------------- Variables Coefficient se tstat pval
GPA -0.644** ( 0.255) -2.53 0.0171
TUCE -0.0102 ( 0.0265) -0.384 0.704
PSI -0.373* ( 0.214) -1.75 0.0914
--------------------------------------------------------------------------- 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 -2.79* ( 1.54) -1.82 0.0796
TUCE -0.0441 ( 0.119) -0.37 0.714
PSI -1.62 ( 1.21) -1.34 0.191
--------------------------------------------------------------------------- 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 -1.38* ( 0.767) -1.8 0.0817
TUCE -0.0219 ( 0.0606) -0.36 0.721
PSI -0.801 ( 0.671) -1.19 0.242
--------------------------------------------------------------------------- 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.3305 -2 Ln(Lr): All coeffs equal zero 70.3112 -2 Ln(Lr): J-1 intercepts 69.0937 LR Chi-Square (coeffs equal zero): 17.9806 d.f. 6.0000 p-value = 0.0000 LR Chi-Square (J-1 intercepts): 16.7631 d.f. 4.0000 p-value = 0.0021 Count R2, Percent Correctly Predicted: 20.0000 Adjusted Percent Correctly Predicted: 0.3684 Madalla's pseudo R-square: 0.4078 McFadden's pseudo R-square: 0.2426 Ben-Akiva and Lerman's Adjusted R-square: 0.1558 Cragg and Uhler's pseudo R-square: 0.0898 Akaike Information Criterion: 2.0103 Bayesian Information Criterion: 2.2852 Hannan-Quinn Information Criterion: 2.1014 OBSERVED AND PREDICTED OUTCOMES | Predicted Observed | A B C Total ---------------------------------------------------------- A | 8 3 0 11 B | 2 9 2 13 C | 1 4 3 8 ---------------------------------------------------------- Total | 11 16 5 32