Note: This chapter uses a suite of commands, called spost, written by J. Scott Long and Jeremy Freese. The commands must be downloaded prior to their use, and this can be done by typing search spost in the Stata command line (see How can I use the search command to search for programs and get additional help? for more information about using search).
Table 5.1, page 126.
use https://stats.idre.ucla.edu/stat/stata/examples/long/ordwarm2, clear describe Contains data from https://stats.idre.ucla.edu/stat/stata/examples/long/ordwarm2.dta obs: 2,293 77 & 89 General Social Survey vars: 10 3 May 2001 09:54 size: 32,102 (96.9% of memory free) (_dta has notes) ------------------------------------------------------------------------------- storage display value variable name type format label variable label ------------------------------------------------------------------------------- warm byte %10.0g SD2SA Mom can have warm relations with child yr89 byte %10.0g yrlbl Survey year: 1=1989 0=1977 male byte %10.0g sexlbl Gender: 1=male 0=female white byte %10.0g racelbl Race: 1=white 0=not white age byte %10.0g Age in years ed byte %10.0g Years of education prst byte %10.0g Occupational prestige warmlt2 byte %10.0g SD 1=SD; 0=D,A,SA warmlt3 byte %10.0g SDD 1=SD,D; 0=A,SA warmlt4 byte %10.0g SDDA 1=SD,D,A; 0=SA ------------------------------------------------------------------------------- Sorted by: warm sum warm yr89 male white age ed prst Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- warm | 2293 2.607501 .9282156 1 4 yr89 | 2293 .3986044 .4897178 0 1 male | 2293 .4648932 .4988748 0 1 white | 2293 .8765809 .3289894 0 1 age | 2293 44.93546 16.77903 18 89 -------------+-------------------------------------------------------- ed | 2293 12.21805 3.160827 0 20 prst | 2293 39.58526 14.49226 12 82
Table 5.2, page 127.
*lrm reg warm yr89 male white age ed prst Source | SS df MS Number of obs = 2293 -------------+------------------------------ F( 6, 2286) = 52.82 Model | 240.438 6 40.073 Prob > F = 0.0000 Residual | 1734.31298 2286 .758667096 R-squared = 0.1218 -------------+------------------------------ Adj R-squared = 0.1195 Total | 1974.75098 2292 .861584198 Root MSE = .87101 ------------------------------------------------------------------------------ warm | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- yr89 | .2624768 .0377971 6.94 0.000 .1883566 .3365969 male | -.3357608 .0366127 -9.17 0.000 -.4075583 -.2639632 white | -.1770232 .0559223 -3.17 0.002 -.2866869 -.0673596 age | -.0101114 .0011623 -8.70 0.000 -.0123907 -.007832 ed | .0312009 .0075313 4.14 0.000 .016432 .0459698 prst | .0026999 .0015574 1.73 0.083 -.0003542 .0057541 _cons | 2.780412 .1100734 25.26 0.000 2.564558 2.996266 ------------------------------------------------------------------------------
NOTE: Further discussion of the calculation for the threshold can found at http://www.stata.com/support/faqs/stat/ologit_con.html .
*ordered probit, setting the threshold = 0 oprobit warm yr89 male white age ed prst Iteration 0: log likelihood = -2995.7704 Iteration 1: log likelihood = -2848.7542 Iteration 2: log likelihood = -2848.611 Ordered probit estimates Number of obs = 2293 LR chi2(6) = 294.32 Prob > chi2 = 0.0000 Log likelihood = -2848.611 Pseudo R2 = 0.0491 ------------------------------------------------------------------------------ warm | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- yr89 | .3188147 .0468519 6.80 0.000 .2269867 .4106427 male | -.4170287 .0455459 -9.16 0.000 -.5062971 -.3277603 white | -.2265002 .0694773 -3.26 0.001 -.3626733 -.0903272 age | -.0122213 .0014427 -8.47 0.000 -.0150489 -.0093937 ed | .0387234 .0093241 4.15 0.000 .0204485 .0569982 prst | .003283 .001925 1.71 0.088 -.0004899 .0070559 -------------+---------------------------------------------------------------- _cut1 | -1.428578 .1387742 (Ancillary parameters) _cut2 | -.3605589 .1369219 _cut3 | .7681637 .1370564 ------------------------------------------------------------------------------ *constant = -_cut1 lincom _b[_cut2] - _b[_cut1] ( 1) - _cut1 + _cut2 = 0 ------------------------------------------------------------------------------ warm | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | 1.068019 .0347528 30.73 0.000 .9999052 1.136134 ------------------------------------------------------------------------------ lincom _b[_cut3] - _b[_cut1] ( 1) - _cut1 + _cut3 = 0 ------------------------------------------------------------------------------ warm | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | 2.196742 .0442095 49.69 0.000 2.110093 2.283391 ------------------------------------------------------------------------------ *ordered probit, setting beta_0 = 0 oprobit warm yr89 male white age ed prst Iteration 0: log likelihood = -2995.7704 Iteration 1: log likelihood = -2848.7542 Iteration 2: log likelihood = -2848.611 Ordered probit estimates Number of obs = 2293 LR chi2(6) = 294.32 Prob > chi2 = 0.0000 Log likelihood = -2848.611 Pseudo R2 = 0.0491 ------------------------------------------------------------------------------ warm | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- yr89 | .3188147 .0468519 6.80 0.000 .2269867 .4106427 male | -.4170287 .0455459 -9.16 0.000 -.5062971 -.3277603 white | -.2265002 .0694773 -3.26 0.001 -.3626733 -.0903272 age | -.0122213 .0014427 -8.47 0.000 -.0150489 -.0093937 ed | .0387234 .0093241 4.15 0.000 .0204485 .0569982 prst | .003283 .001925 1.71 0.088 -.0004899 .0070559 -------------+---------------------------------------------------------------- _cut1 | -1.428578 .1387742 (Ancillary parameters) _cut2 | -.3605589 .1369219 _cut3 | .7681637 .1370564 ------------------------------------------------------------------------------ *ordered logistic ologit warm yr89 male white age ed prst Iteration 0: log likelihood = -2995.7704 Iteration 1: log likelihood = -2846.4532 Iteration 2: log likelihood = -2844.9142 Iteration 3: log likelihood = -2844.9123 Ordered logit estimates Number of obs = 2293 LR chi2(6) = 301.72 Prob > chi2 = 0.0000 Log likelihood = -2844.9123 Pseudo R2 = 0.0504 ------------------------------------------------------------------------------ warm | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- yr89 | .5239025 .0798988 6.56 0.000 .3673037 .6805013 male | -.7332997 .0784827 -9.34 0.000 -.8871229 -.5794766 white | -.3911595 .1183808 -3.30 0.001 -.6231815 -.1591374 age | -.0216655 .0024683 -8.78 0.000 -.0265032 -.0168278 ed | .0671728 .015975 4.20 0.000 .0358624 .0984831 prst | .0060727 .0032929 1.84 0.065 -.0003813 .0125267 -------------+---------------------------------------------------------------- _cut1 | -2.465362 .2389126 (Ancillary parameters) _cut2 | -.630904 .2333155 _cut3 | 1.261854 .2340179 ------------------------------------------------------------------------------
Table 5.3, page 129.
quietly ologit warm yr89 male white age ed prst listcoef, std ologit (N=2293): Unstandardized and Standardized Estimates Observed SD: .9282156 Latent SD: 1.9410634 ------------------------------------------------------------------------------- warm | b z P>|z| bStdX bStdY bStdXY SDofX -------------+----------------------------------------------------------------- yr89 | 0.52390 6.557 0.000 0.2566 0.2699 0.1322 0.4897 male | -0.73330 -9.343 0.000 -0.3658 -0.3778 -0.1885 0.4989 white | -0.39116 -3.304 0.001 -0.1287 -0.2015 -0.0663 0.3290 age | -0.02167 -8.778 0.000 -0.3635 -0.0112 -0.1873 16.7790 ed | 0.06717 4.205 0.000 0.2123 0.0346 0.1094 3.1608 prst | 0.00607 1.844 0.065 0.0880 0.0031 0.0453 14.4923 ------------------------------------------------------------------------------- quietly oprobit warm yr89 male white age ed prst listcoef, std oprobit (N=2293): Unstandardized and Standardized Estimates Observed SD: .9282156 Latent SD: 1.0760449 ------------------------------------------------------------------------------- warm | b z P>|z| bStdX bStdY bStdXY SDofX -------------+----------------------------------------------------------------- yr89 | 0.31881 6.805 0.000 0.1561 0.2963 0.1451 0.4897 male | -0.41703 -9.156 0.000 -0.2080 -0.3876 -0.1933 0.4989 white | -0.22650 -3.260 0.001 -0.0745 -0.2105 -0.0693 0.3290 age | -0.01222 -8.471 0.000 -0.2051 -0.0114 -0.1906 16.7790 ed | 0.03872 4.153 0.000 0.1224 0.0360 0.1137 3.1608 prst | 0.00328 1.705 0.088 0.0476 0.0031 0.0442 14.4923 -------------------------------------------------------------------------------
Table 5.4, page 131.
ologit warm yr89 male white age ed prst Iteration 0: log likelihood = -2995.7704 Iteration 1: log likelihood = -2846.4532 Iteration 2: log likelihood = -2844.9142 Iteration 3: log likelihood = -2844.9123 Ordered logit estimates Number of obs = 2293 LR chi2(6) = 301.72 Prob > chi2 = 0.0000 Log likelihood = -2844.9123 Pseudo R2 = 0.0504 ------------------------------------------------------------------------------ warm | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- yr89 | .5239025 .0798988 6.56 0.000 .3673037 .6805013 male | -.7332997 .0784827 -9.34 0.000 -.8871229 -.5794766 white | -.3911595 .1183808 -3.30 0.001 -.6231815 -.1591374 age | -.0216655 .0024683 -8.78 0.000 -.0265032 -.0168278 ed | .0671728 .015975 4.20 0.000 .0358624 .0984831 prst | .0060727 .0032929 1.84 0.065 -.0003813 .0125267 -------------+---------------------------------------------------------------- _cut1 | -2.465362 .2389126 (Ancillary parameters) _cut2 | -.630904 .2333155 _cut3 | 1.261854 .2340179 ------------------------------------------------------------------------------ predict sd d a sa (option p assumed; predicted probabilities) tabstat sd d a sa, stats(min mean max range) stats | sd d a sa ---------+---------------------------------------- min | .0153572 .073616 .1279493 .0268523 mean | .1293539 .3152335 .3738817 .1815308 max | .4657959 .4289543 .4407727 .6067042 range | .4504387 .3553383 .3128235 .5798519 --------------------------------------------------
Figure 5.3, page 132.
quietly ologit warm yr89 male white age ed prst prgen age, from(20) to(80) x(male = 0 yr89 = 1) ncases(7) generate(w89) ologit: Predicted values as age varies from 20 to 80. yr89 male white age ed prst x= 1 0 .8765809 44.935456 12.218055 39.585259 label var w89p1 "SD" label var w89p2 "D" label var w89p3 "A" label var w89p4 "SA" label var w89s1 "SD" label var w89s2 "SD & D" label var w89s3 "SD, D & A"
Panel A: Predicted Probabilities
graph twoway (scatter w89p1 w89p2 w89p3 w89p4 w89x, msymbol(Oh Dh Sh Th) c(l l l l) xtitle("Age") /// ytitle("Predicted Probability") xlabel(20(20)80) ylabel(0 .25 .50 ) )
Panel B: Cumulative Probabilities
graph twoway (scatter w89s1 w89s2 w89s3 w89x, msymbol(Oh Dh Sh) c(l l l) xtitle("Age") /// ytitle("Cumulative Probability") xlabel(20(20)80) ylabel(0(.25)1) )
Table 5.5, page 134.
quietly ologit warm yr89 male white age ed prst prtab yr89 male, novarlbl ologit: Predicted probabilities for warm Predicted probability of outcome 1 (SD) -------------------------- | male yr89 | Women Men ----------+--------------- 1977 | 0.0989 0.1859 1989 | 0.0610 0.1191 -------------------------- Predicted probability of outcome 2 (D) -------------------------- | male yr89 | Women Men ----------+--------------- 1977 | 0.3083 0.4026 1989 | 0.2282 0.3394 -------------------------- Predicted probability of outcome 3 (A) -------------------------- | male yr89 | Women Men ----------+--------------- 1977 | 0.4129 0.3162 1989 | 0.4406 0.3904 -------------------------- Predicted probability of outcome 4 (SA) -------------------------- | male yr89 | Women Men ----------+--------------- 1977 | 0.1799 0.0953 1989 | 0.2703 0.1510 -------------------------- yr89 male white age ed prst x= .39860445 .46489315 .8765809 44.935456 12.218055 39.585259
NOTE: The output from prtab needs to be rearranged to match Table 5.5 exactly.
Table 5.6, page 135.
quietly ologit warm yr89 male white age ed prst prchange age ed prst, x(male = 0 yr89 = 1) rest(mean) ologit: Changes in Predicted Probabilities for warm age Avg|Chg| SD D A SA Min->Max .16441458 .10941909 .21941006 -.05462247 -.27420671 -+1/2 .00222661 .00124099 .00321223 -.0001803 -.00427291 -+sd/2 .0373125 .0208976 .05372739 -.00300205 -.07162295 MargEfct .00222662 .00124098 .00321226 -.00018032 -.00427292 ed Avg|Chg| SD D A SA Min->Max .14300264 -.09153163 -.19447364 .04167268 .2443326 -+1/2 .0069032 -.00384806 -.00995836 .00055891 .01324749 -+sd/2 .02181124 -.01217654 -.03144595 .00176239 .04186009 MargEfct .00690351 -.00384759 -.00995944 .00055906 .01324796 prst Avg|Chg| SD D A SA Min->Max .04278038 -.02352008 -.06204067 .00013945 .08542132 -+1/2 .00062411 -.00034784 -.00090037 .00005054 .00119767 -+sd/2 .00904405 -.00504204 -.01304607 .00073212 .01735598 MargEfct .00062411 -.00034784 -.00090038 .00005054 .00119767 SD D A SA Pr(y|x) .06099996 .22815652 .44057754 .27026597 yr89 male white age ed prst x= 1 0 .876581 44.9355 12.2181 39.5853 sd(x)= .489718 .498875 .328989 16.779 3.16083 14.4923
Table 5.7, page 137.
NOTE: You may have to increase the matrix size in order to run this model. Type help matsize for more information.
quietly ologit warm yr89 male white age ed prst prchange ologit: Changes in Predicted Probabilities for warm yr89 Avg|Chg| SD D A SA 0->1 .06372773 -.04993673 -.07751873 .05391335 .0735421 male Avg|Chg| SD D A SA 0->1 .08961766 .07461427 .10462105 -.08137083 -.09786447 white Avg|Chg| SD D A SA 0->1 .04694162 .03452424 .05935898 -.03557652 -.05830672 age Avg|Chg| SD D A SA Min->Max .18319855 .18012119 .1862759 -.17905769 -.18733941 -+1/2 .00266841 .00214228 .00319454 -.00240716 -.00292964 -+sd/2 .0446563 .03602537 .05328724 -.0401054 -.0492072 MargEfct .00266844 .00214226 .00319461 -.00240723 -.00292964 ed Avg|Chg| SD D A SA Min->Max .16156666 -.15235534 -.17077798 .15631917 .16681415 -+1/2 .00827261 -.00664248 -.00990272 .0074617 .00908352 -+sd/2 .02612717 -.02101015 -.03124419 .02353376 .02872056 MargEfct .00827335 -.00664198 -.00990472 .0074635 .00908319 prst Avg|Chg| SD D A SA Min->Max .05186236 -.04070839 -.06301633 .04440692 .05931778 -+1/2 .00074795 -.00060046 -.00089544 .00067475 .00082116 -+sd/2 .01083777 -.00870322 -.01297233 .00977433 .0119012 MargEfct .00074795 -.00060046 -.00089543 .00067473 .00082116 SD D A SA Pr(y|x) .11125716 .32816544 .39936733 .16121005 yr89 male white age ed prst x= .398604 .464893 .876581 44.9355 12.2181 39.5853 sd(x)= .489718 .498875 .328989 16.779 3.16083 14.4923
Table 5.8, page 142.
NOTE: We do not know why the z-scores are slightly different from those shown in the text.
gen mle1 = (warm>1) gen mle2 = (warm>2) gen mle3 = (warm>3) ologit warm yr89 male white age ed prst Iteration 0: log likelihood = -2995.7704 Iteration 1: log likelihood = -2846.4532 Iteration 2: log likelihood = -2844.9142 Iteration 3: log likelihood = -2844.9123 Ordered logit estimates Number of obs = 2293 LR chi2(6) = 301.72 Prob > chi2 = 0.0000 Log likelihood = -2844.9123 Pseudo R2 = 0.0504 ------------------------------------------------------------------------------ warm | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- yr89 | .5239025 .0798988 6.56 0.000 .3673037 .6805013 male | -.7332997 .0784827 -9.34 0.000 -.8871229 -.5794766 white | -.3911595 .1183808 -3.30 0.001 -.6231815 -.1591374 age | -.0216655 .0024683 -8.78 0.000 -.0265032 -.0168278 ed | .0671728 .015975 4.20 0.000 .0358624 .0984831 prst | .0060727 .0032929 1.84 0.065 -.0003813 .0125267 -------------+---------------------------------------------------------------- _cut1 | -2.465362 .2389126 (Ancillary parameters) _cut2 | -.630904 .2333155 _cut3 | 1.261854 .2340179 ------------------------------------------------------------------------------ logit mle1 yr89 male white age ed prst Iteration 0: log likelihood = -883.91038 Iteration 1: log likelihood = -824.35787 Iteration 2: log likelihood = -819.6587 Iteration 3: log likelihood = -819.61993 Iteration 4: log likelihood = -819.61992 Logit estimates Number of obs = 2293 LR chi2(6) = 128.58 Prob > chi2 = 0.0000 Log likelihood = -819.61992 Pseudo R2 = 0.0727 ------------------------------------------------------------------------------ mle1 | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- yr89 | .9647422 .1542064 6.26 0.000 .6625033 1.266981 male | -.3053643 .1291546 -2.36 0.018 -.5585025 -.052226 white | -.5526576 .2305396 -2.40 0.017 -1.004507 -.1008082 age | -.0164704 .0040571 -4.06 0.000 -.0244221 -.0085187 ed | .1047962 .0253348 4.14 0.000 .0551409 .1544516 prst | -.0014112 .0056702 -0.25 0.803 -.0125246 .0097023 _cons | 1.858405 .3958164 4.70 0.000 1.082619 2.63419 ------------------------------------------------------------------------------ logit mle2 yr89 male white age ed prst Iteration 0: log likelihood = -1575.4005 Iteration 1: log likelihood = -1450.7598 Iteration 2: log likelihood = -1449.7869 Iteration 3: log likelihood = -1449.7863 Logit estimates Number of obs = 2293 LR chi2(6) = 251.23 Prob > chi2 = 0.0000 Log likelihood = -1449.7863 Pseudo R2 = 0.0797 ------------------------------------------------------------------------------ mle2 | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- yr89 | .5654063 .0928433 6.09 0.000 .3834368 .7473757 male | -.6905423 .0898786 -7.68 0.000 -.8667012 -.5143834 white | -.3142708 .1405978 -2.24 0.025 -.5898374 -.0387042 age | -.0253345 .0028644 -8.84 0.000 -.0309486 -.0197203 ed | .0528527 .0184571 2.86 0.004 .0166774 .0890279 prst | .0095322 .0038184 2.50 0.013 .0020482 .0170162 _cons | .7303287 .269163 2.71 0.007 .202779 1.257878 ------------------------------------------------------------------------------ logit mle3 yr89 male white age ed prst Iteration 0: log likelihood = -1087.3382 Iteration 1: log likelihood = -1015.4742 Iteration 2: log likelihood = -1011.973 Iteration 3: log likelihood = -1011.9542 Iteration 4: log likelihood = -1011.9542 Logit estimates Number of obs = 2293 LR chi2(6) = 150.77 Prob > chi2 = 0.0000 Log likelihood = -1011.9542 Pseudo R2 = 0.0693 ------------------------------------------------------------------------------ mle3 | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- yr89 | .3190732 .1140756 2.80 0.005 .0954891 .5426572 male | -1.083789 .1220668 -8.88 0.000 -1.323035 -.8445422 white | -.3929984 .1577582 -2.49 0.013 -.7021989 -.083798 age | -.0185905 .0037659 -4.94 0.000 -.0259715 -.0112096 ed | .0575547 .0253812 2.27 0.023 .0078085 .1073008 prst | .0055304 .0048413 1.14 0.253 -.0039584 .0150193 _cons | -1.024517 .3463123 -2.96 0.003 -1.703276 -.3457571 ------------------------------------------------------------------------------
Table 5.9, page 144.
NOTE: The brant, detail command produces the same results as Table 5.8.
quietly ologit warm yr89 male white age ed prst brant, detail Estimated coefficients from j-1 binary regressions y>1 y>2 y>3 yr89 .9647422 .56540626 .31907316 male -.30536425 -.69054232 -1.0837888 white -.55265759 -.31427081 -.39299842 age -.0164704 -.02533448 -.01859051 ed .10479624 .05285265 .05755466 prst -.00141118 .00953216 .00553043 _cons 1.8584045 .73032873 -1.0245168 Brant Test of Parallel Regression Assumption Variable | chi2 p>chi2 df -------------+-------------------------- All | 49.18 0.000 12 -------------+-------------------------- yr89 | 13.01 0.001 2 male | 22.24 0.000 2 white | 1.27 0.531 2 age | 7.38 0.025 2 ed | 4.31 0.116 2 prst | 4.33 0.115 2 ---------------------------------------- A significant test statistic provides evidence that the parallel regression assumption has been violated.