/*Stata do file to estimate generalized ordinal logit models */ /*from "Order Matters(?)* I would like to thank Richard Williams */ /*for his careful comments on our paper for his contribution of the */ /*glogit2 module*/ /*Please note that execution of this file requires:*/ /*1. The data file "Aout.dta" (available on my website)*/ /*2. The gologit2 ado module written by Richard Williams.*/ /*3. The spost suite of modules written by Scott Long and Jeremy Freese*/ use Aout /*Accessing data*/ /*Estimating porportional odds model*/ ologit AAsupport symracism racialpred Education Ideology female /*This returns: ologit AAsupport symracism racialpred Education Ideology female Iteration 0: log likelihood = -2397.9766 Iteration 1: log likelihood = -2290.2384 Iteration 2: log likelihood = -2289.5186 Iteration 3: log likelihood = -2289.5181 Ordered logistic regression Number of obs = 1744 LR chi2(5) = 216.92 Prob > chi2 = 0.0000 Log likelihood = -2289.5181 Pseudo R2 = 0.0452 ------------------------------------------------------------------------------ AAsupport | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- symracism | 2.561682 .2073908 12.35 0.000 2.155203 2.96816 racialpred | .3638676 .1779801 2.04 0.041 .015033 .7127021 Education | .5098817 .1814749 2.81 0.005 .1541973 .865566 Ideology | .117249 .0471713 2.49 0.013 .024795 .209703 female | .0753266 .0879861 0.86 0.392 -.097123 .2477762 -------------+---------------------------------------------------------------- /cut1 | .287838 .18074 -.066406 .6420819 /cut2 | 1.524076 .1826812 1.166028 1.882125 /cut3 | 2.903736 .1931875 2.525096 3.282377 ------------------------------------------------------------------------------ */ /*Implementing Brant test (see Brant 1990 or Peterson and Harrell 1990, who derived a similar test)*/ brant /* This returns: Brant Test of Parallel Regression Assumption Variable | chi2 p>chi2 df -------------+-------------------------- All | 29.33 0.001 10 -------------+-------------------------- symracism | 12.37 0.002 2 racialpred | 8.15 0.017 2 Education | 2.29 0.319 2 Ideology | 0.33 0.849 2 female | 5.79 0.055 2 ---------------------------------------- A significant test statistic provides evidence that the parallel regression assumption has been violated. */ /* Estimating a fully generalized ordinal logit model: */ /*This returns: gologit2 AAsupport symracism racialpred Education Ideology female Generalized Ordered Logit Estimates Number of obs = 1744 LR chi2(15) = 249.56 Prob > chi2 = 0.0000 Log likelihood = -2273.1974 Pseudo R2 = 0.0520 ------------------------------------------------------------------------------ AAsupport | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- 1 | symracism | 1.749177 .2895735 6.04 0.000 1.181623 2.31673 racialpred | .7460797 .2502899 2.98 0.003 .2555205 1.236639 Education | .2813807 .2468595 1.14 0.254 -.202455 .7652164 Ideology | .1215224 .0666061 1.82 0.068 -.0090232 .2520679 female | -.1073863 .1253621 -0.86 0.392 -.3530916 .1383189 _cons | .4065454 .2500273 1.63 0.104 -.0834991 .8965898 -------------+---------------------------------------------------------------- 2 | symracism | 2.601514 .2453915 10.60 0.000 2.120556 3.082473 racialpred | .0707547 .2117429 0.33 0.738 -.3442537 .4857631 Education | .5016006 .2082306 2.41 0.016 .0934761 .9097251 Ideology | .0990968 .0539581 1.84 0.066 -.0066591 .2048526 female | .1804625 .1013367 1.78 0.075 -.0181537 .3790787 _cons | -1.65261 .2132036 -7.75 0.000 -2.070482 -1.234739 -------------+---------------------------------------------------------------- 3 | symracism | 3.134594 .2806626 11.17 0.000 2.584505 3.684682 racialpred | .3918973 .2325136 1.69 0.092 -.0638209 .8476155 Education | .5957919 .2419968 2.46 0.014 .1214869 1.070097 Ideology | .1454165 .061922 2.35 0.019 .0240516 .2667814 female | .0561894 .1135124 0.50 0.621 -.1662909 .2786696 _cons | -3.342858 .2570371 -13.01 0.000 -3.846642 -2.839075 */ /* Using "autofit" option. Basically, this implements a proportionality test and then imposes constraints over logits for covariates having the proportionality property. The criteria for the constraints are outlined by Williams in the documentation for gologit2. Similarly, one could force constraints within the model using whatever criteria they deemed appropriate (hopefully grounded in some statistical basis!):*/ gologit2 AAsupport symracism racialpred Education Ideology female, autofit /*This returns: gologit2 AAsupport symracism racialpred Education Ideology female, autofit ------------------------------------------------------------------------------ Testing parallel-lines assumption using the .05 level of significance... Step 1: Constraints for parallel lines imposed for Ideology (P Value = 0.7046) Step 2: Constraints for parallel lines imposed for Education (P Value = 0.4983) Step 3: Constraints for parallel lines are not imposed for symracism (P Value = 0.00037) racialpred (P Value = 0.00334) female (P Value = 0.02925) Wald test of parallel-lines assumption for the final model: ( 1) [1]Ideology - [2]Ideology = 0 ( 2) [1]Education - [2]Education = 0 ( 3) [1]Ideology - [3]Ideology = 0 ( 4) [1]Education - [3]Education = 0 chi2( 4) = 2.10 Prob > chi2 = 0.7177 An insignificant test statistic indicates that the final model does not violate the proportional odds/parallel-lines assumption If you refit this exact same model with gologit2, instead of autofit, you can save time by using the parameter pl(Ideology Education) ------------------------------------------------------------------------------ Generalized Ordered Logit Estimates Number of obs = 1744 Wald chi2(11) = 230.24 Prob > chi2 = 0.0000 Log likelihood = -2274.2433 Pseudo R2 = 0.0516 ( 1) [1]Ideology - [2]Ideology = 0 ( 2) [1]Education - [2]Education = 0 ( 3) [2]Ideology - [3]Ideology = 0 ( 4) [2]Education - [3]Education = 0 ------------------------------------------------------------------------------ AAsupport | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- 1 | symracism | 1.788304 .2850382 6.27 0.000 1.22964 2.346969 racialpred | .7817066 .2477062 3.16 0.002 .2962114 1.267202 Education | .4784883 .1823104 2.62 0.009 .1211664 .8358101 Ideology | .1220727 .0473702 2.58 0.010 .0292289 .2149166 female | -.0978963 .125233 -0.78 0.434 -.3433485 .1475559 _cons | .2729687 .2239297 1.22 0.223 -.1659254 .7118627 -------------+---------------------------------------------------------------- 2 | symracism | 2.588423 .2444966 10.59 0.000 2.109219 3.067628 racialpred | .0632373 .2106441 0.30 0.764 -.3496175 .4760921 Education | .4784883 .1823104 2.62 0.009 .1211664 .8358101 Ideology | .1220727 .0473702 2.58 0.010 .0292289 .2149166 female | .1798536 .101292 1.78 0.076 -.018675 .3783823 _cons | -1.634714 .2032053 -8.04 0.000 -2.032989 -1.236439 -------------+---------------------------------------------------------------- 3 | symracism | 3.133411 .2798331 11.20 0.000 2.584949 3.681874 racialpred | .3762081 .2310263 1.63 0.103 -.0765952 .8290114 Education | .4784883 .1823104 2.62 0.009 .1211664 .8358101 Ideology | .1220727 .0473702 2.58 0.010 .0292289 .2149166 female | .0490204 .1132235 0.43 0.665 -.1728937 .2709344 _cons | -3.262695 .2359314 -13.83 0.000 -3.725112 -2.800278 ------------------------------------------------------------------------------ */ /*The Peterson-Harrell model (1990, eq. 5) in logit form can be estimated as:*/ gologit2 AAsupport symracism racialpred Education Ideology female, autofit gamma /*This returns: Alternative parameterization: Gammas are deviations from proportionality ------------------------------------------------------------------------------ AAsupport | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- Beta | symracism | 1.788304 .2850382 6.27 0.000 1.22964 2.346969 racialpred | .7817066 .2477062 3.16 0.002 .2962114 1.267202 Education | .4784883 .1823104 2.62 0.009 .1211664 .8358101 Ideology | .1220727 .0473702 2.58 0.010 .0292289 .2149166 female | -.0978963 .125233 -0.78 0.434 -.3433485 .1475559 -------------+---------------------------------------------------------------- Gamma_2 | symracism | .8001189 .2568966 3.11 0.002 .2966109 1.303627 racialpred | -.7184694 .2198584 -3.27 0.001 -1.149384 -.2875549 female | .2777499 .1109762 2.50 0.012 .0602406 .4952593 -------------+---------------------------------------------------------------- Gamma_3 | symracism | 1.345107 .3475998 3.87 0.000 .663824 2.02639 racialpred | -.4054985 .2927862 -1.38 0.166 -.9793489 .1683518 female | .1469167 .1447743 1.01 0.310 -.1368358 .4306692 -------------+---------------------------------------------------------------- Alpha | _cons_1 | .2729687 .2239297 1.22 0.223 -.1659254 .7118627 _cons_2 | -1.634714 .2032053 -8.04 0.000 -2.032989 -1.236439 _cons_3 | -3.262695 .2359314 -13.83 0.000 -3.725112 -2.800278 ------------------------------------------------------------------------------ Note this model is equivalent to the Williams constrained model; the gamma give deviations from proportionality.*/