------------------------------------------------------------------------------------------------------------- log: d:\spost.stata8\do\st8ch5.log log type: text opened on: 26 May 2003, 12:49:16 . . // * . // * RM4STATA Ch 5: Models for Ordinal Outcomes - 5/26/2003 . // * . . // * Section 5.1.1 - a latent variable model . . * binary model with -logit- . use binlfp2, clear (Data from 1976 PSID-T Mroz) . logit lfp k5 k618 age wc hc lwg inc, nolog Logit estimates Number of obs = 753 LR chi2(7) = 124.48 Prob > chi2 = 0.0000 Log likelihood = -452.63296 Pseudo R2 = 0.1209 ------------------------------------------------------------------------------ lfp | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- k5 | -1.462913 .1970006 -7.43 0.000 -1.849027 -1.076799 k618 | -.0645707 .0680008 -0.95 0.342 -.1978499 .0687085 age | -.0628706 .0127831 -4.92 0.000 -.0879249 -.0378162 wc | .8072738 .2299799 3.51 0.000 .3565215 1.258026 hc | .1117336 .2060397 0.54 0.588 -.2920969 .515564 lwg | .6046931 .1508176 4.01 0.000 .3090961 .9002901 inc | -.0344464 .0082084 -4.20 0.000 -.0505346 -.0183583 _cons | 3.18214 .6443751 4.94 0.000 1.919188 4.445092 ------------------------------------------------------------------------------ . estimates store logit . . * binary model with -ologit- . ologit lfp k5 k618 age wc hc lwg inc, nolog Ordered logit estimates Number of obs = 753 LR chi2(7) = 124.48 Prob > chi2 = 0.0000 Log likelihood = -452.63296 Pseudo R2 = 0.1209 ------------------------------------------------------------------------------ lfp | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- k5 | -1.462913 .1970006 -7.43 0.000 -1.849027 -1.076799 k618 | -.0645707 .0680008 -0.95 0.342 -.1978499 .0687085 age | -.0628706 .0127831 -4.92 0.000 -.0879249 -.0378162 wc | .8072738 .2299799 3.51 0.000 .3565215 1.258026 hc | .1117336 .2060397 0.54 0.588 -.2920969 .515564 lwg | .6046931 .1508176 4.01 0.000 .3090961 .9002901 inc | -.0344464 .0082084 -4.20 0.000 -.0505346 -.0183583 -------------+---------------------------------------------------------------- _cut1 | -3.18214 .6443751 (Ancillary parameter) ------------------------------------------------------------------------------ . estimates store ologit . estimates table logit ologit, b(%9.3f) t label varwidth(30) -------------------------------------------------------- Variable | logit ologit -------------------------------+------------------------ # kids < 6 | -1.463 -1.463 | -7.43 -7.43 # kids 6-18 | -0.065 -0.065 | -0.95 -0.95 Wife's age in years | -0.063 -0.063 | -4.92 -4.92 Wife College: 1=yes 0=no | 0.807 0.807 | 3.51 3.51 Husband College: 1=yes 0=no | 0.112 0.112 | 0.54 0.54 Log of wife's estimated wages | 0.605 0.605 | 4.01 4.01 Family income excluding wife's | -0.034 -0.034 | -4.20 -4.20 _cut1 | -3.182 | -4.94 Constant | 3.182 | 4.94 -------------------------------------------------------- legend: b/t . . // * Section 5.2 - estimation of ordered regression model . . use ordwarm2, clear (77 & 89 General Social Survey) . ologit warm male white age ed prst if yr89==1, nolog Ordered logit estimates Number of obs = 914 LR chi2(5) = 91.02 Prob > chi2 = 0.0000 Log likelihood = -1083.2871 Pseudo R2 = 0.0403 ------------------------------------------------------------------------------ warm | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- male | -.7589487 .1265685 -6.00 0.000 -1.007018 -.510879 white | -.3579802 .18615 -1.92 0.054 -.7228275 .0068671 age | -.0227585 .0038285 -5.94 0.000 -.0302621 -.0152548 ed | .0421346 .025821 1.63 0.103 -.0084737 .0927429 prst | .0094713 .0049673 1.91 0.057 -.0002645 .019207 -------------+---------------------------------------------------------------- _cut1 | -3.528722 .4055 (Ancillary parameters) _cut2 | -1.380973 .3850552 _cut3 | .6297378 .3821996 ------------------------------------------------------------------------------ . ologit warm male white age ed prst, table nolog Ordered logit estimates Number of obs = 2293 LR chi2(5) = 258.39 Prob > chi2 = 0.0000 Log likelihood = -2866.5752 Pseudo R2 = 0.0431 ------------------------------------------------------------------------------ warm | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- male | -.7499562 .0783083 -9.58 0.000 -.9034377 -.5964747 white | -.4127267 .1180436 -3.50 0.000 -.6440879 -.1813655 age | -.0206757 .0024598 -8.41 0.000 -.0254967 -.0158547 ed | .0789344 .0158731 4.97 0.000 .0478238 .1100451 prst | .0066996 .0032863 2.04 0.041 .0002585 .0131408 -------------+---------------------------------------------------------------- _cut1 | -2.466022 .2386009 (Ancillary parameters) _cut2 | -.6564482 .2329347 _cut3 | 1.215503 .2335542 ------------------------------------------------------------------------------ warm | Probability Observed -------------+------------------------------------- SD | Pr( xb+u<_cut1) 0.1295 D | Pr(_cut1 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 ------------------------------------------------------------------------------ . estimates store ologit . oprobit warm yr89 male white age ed prst, nolog 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 ------------------------------------------------------------------------------ . estimates store oprobit . estimates table ologit oprobit, b(%9.3f) t label varwidth(30) -------------------------------------------------------- Variable | ologit oprobit -------------------------------+------------------------ Survey year: 1=1989 0=1977 | 0.524 0.319 | 6.56 6.80 Gender: 1=male 0=female | -0.733 -0.417 | -9.34 -9.16 Race: 1=white 0=not white | -0.391 -0.227 | -3.30 -3.26 Age in years | -0.022 -0.012 | -8.78 -8.47 Years of education | 0.067 0.039 | 4.20 4.15 Occupational prestige | 0.006 0.003 | 1.84 1.71 _cut1 | -2.465 -1.429 | -10.32 -10.29 _cut2 | -0.631 -0.361 | -2.70 -2.63 _cut3 | 1.262 0.768 | 5.39 5.60 -------------------------------------------------------- legend: b/t . . * sort helps with convergence in nearly nonidentified model . sort age . . // * Section 5.2.2 - predicting perfectly (with artifical data) . . gen dumprst = (prst<20 & warm==1) . tab dumprst warm, miss | Mom can have warm relations with child dumprst | SD D A SA | Total -----------+--------------------------------------------+---------- 0 | 257 723 856 417 | 2,253 1 | 40 0 0 0 | 40 -----------+--------------------------------------------+---------- Total | 297 723 856 417 | 2,293 . ologit warm yr89 male white age ed dumprst, nolog Ordered logit estimates Number of obs = 2293 LR chi2(6) = 447.02 Prob > chi2 = 0.0000 Log likelihood = -2772.2621 Pseudo R2 = 0.0746 ------------------------------------------------------------------------------ warm | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- yr89 | .5268578 .0805997 6.54 0.000 .3688853 .6848303 male | -.7251825 .0792896 -9.15 0.000 -.8805872 -.5697778 white | -.4240687 .1197416 -3.54 0.000 -.658758 -.1893795 age | -.0210592 .0024462 -8.61 0.000 -.0258536 -.0162648 ed | .072143 .0133133 5.42 0.000 .0460494 .0982366 dumprst | -34.58373 1934739 -0.00 1.000 -3792053 3791983 -------------+---------------------------------------------------------------- _cut1 | -2.776233 .243582 (Ancillary parameters) _cut2 | -.8422903 .2363736 _cut3 | 1.06148 .236561 ------------------------------------------------------------------------------ note: 40 observations completely determined. Standard errors questionable. . . // * Section 5.3.1 - testing individual coefficients . . * Wald test . ologit warm male yr89 white age ed prst, nolog 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] -------------+---------------------------------------------------------------- male | -.7332997 .0784827 -9.34 0.000 -.8871229 -.5794766 yr89 | .5239025 .0798988 6.56 0.000 .3673037 .6805013 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 ------------------------------------------------------------------------------ . test male ( 1) male = 0 chi2( 1) = 87.30 Prob > chi2 = 0.0000 . display "z*z=" -9.343*-9.343 z*z=87.291649 . . * LR test . ologit warm yr89 male white age ed prst, nolog 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 ------------------------------------------------------------------------------ . estimates store fmodel . . * estimate constrained model . ologit warm yr89 white age ed prst, nolog Ordered logit estimates Number of obs = 2293 LR chi2(5) = 212.98 Prob > chi2 = 0.0000 Log likelihood = -2889.278 Pseudo R2 = 0.0355 ------------------------------------------------------------------------------ warm | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- yr89 | .5486813 .0796222 6.89 0.000 .3926246 .704738 white | -.4248955 .1184223 -3.59 0.000 -.656999 -.192792 age | -.0197197 .0024473 -8.06 0.000 -.0245164 -.014923 ed | .0659969 .0159375 4.14 0.000 .03476 .0972337 prst | .0046902 .003286 1.43 0.153 -.0017502 .0111306 -------------+---------------------------------------------------------------- _cut1 | -2.066166 .2337297 (Ancillary parameters) _cut2 | -.2697128 .2290783 _cut3 | 1.566067 .2312319 ------------------------------------------------------------------------------ . estimates store nmodel . lrtest fmodel nmodel likelihood-ratio test LR chi2(1) = 88.73 (Assumption: nmodel nested in fmodel) Prob > chi2 = 0.0000 . . // * Section 5.3.2 - testing multiple coefficients . . ologit warm yr89 male white age ed prst, nolog 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 ------------------------------------------------------------------------------ . . * Wald test . test age white male ( 1) age = 0 ( 2) white = 0 ( 3) male = 0 chi2( 3) = 166.62 Prob > chi2 = 0.0000 . . * LR test . ologit warm yr89 male white age ed prst, nolog 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 ------------------------------------------------------------------------------ . estimates store fmodel . ologit warm yr89 ed prst, nolog Ordered logit estimates Number of obs = 2293 LR chi2(3) = 130.13 Prob > chi2 = 0.0000 Log likelihood = -2930.7047 Pseudo R2 = 0.0217 ------------------------------------------------------------------------------ warm | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- yr89 | .5160795 .0792245 6.51 0.000 .3608024 .6713566 ed | .1064872 .014975 7.11 0.000 .0771367 .1358377 prst | -.001567 .003212 -0.49 0.626 -.0078624 .0047283 -------------+---------------------------------------------------------------- _cut1 | -.5241726 .158709 (Ancillary parameters) _cut2 | 1.22832 .1587648 _cut3 | 3.016659 .1689551 ------------------------------------------------------------------------------ . estimates store nmodel . lrtest fmodel nmodel likelihood-ratio test LR chi2(3) = 171.58 (Assumption: nmodel nested in fmodel) Prob > chi2 = 0.0000 . . . // * Section 5.4 - scalar measures of fit with fitstat . . ologit warm yr89 male white age ed prst, nolog 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 ------------------------------------------------------------------------------ . fitstat Measures of Fit for ologit of warm Log-Lik Intercept Only: -2995.770 Log-Lik Full Model: -2844.912 D(2284): 5689.825 LR(6): 301.716 Prob > LR: 0.000 McFadden's R2: 0.050 McFadden's Adj R2: 0.047 Maximum Likelihood R2: 0.123 Cragg & Uhler's R2: 0.133 McKelvey and Zavoina's R2: 0.127 Variance of y*: 3.768 Variance of error: 3.290 Count R2: 0.432 Adj Count R2: 0.093 AIC: 2.489 AIC*n: 5707.825 BIC: -11982.891 BIC': -255.291 . . // * Section 5.5 - converting to a different parameterization . . ologit warm yr89 male white age ed prst, nolog 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 ------------------------------------------------------------------------------ . * intercept . lincom 0 - _b[_cut1] ( 1) - _cut1 = 0 ------------------------------------------------------------------------------ warm | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | 2.465362 .2389126 10.32 0.000 1.997102 2.933622 ------------------------------------------------------------------------------ . * cutpoint 2 . lincom _b[_cut2] - _b[_cut1] ( 1) - _cut1 + _cut2 = 0 ------------------------------------------------------------------------------ warm | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | 1.834458 .0630432 29.10 0.000 1.710895 1.95802 ------------------------------------------------------------------------------ . * cutpoint 3 . lincom _b[_cut3] - _b[_cut1] ( 1) - _cut1 + _cut3 = 0 ------------------------------------------------------------------------------ warm | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | 3.727216 .0826215 45.11 0.000 3.565281 3.889151 ------------------------------------------------------------------------------ . . // * Section 5.6 - the parallel regression assumption . . * generate data to demonstrate the assumption . clear . set obs 41 obs was 0, now 41 . gen n = 41-_n . replace n = (n-20)/2.5 (41 real changes made) . gen p1 = exp((-1*n)-3.5)/(1+exp((-1*n)-3.5)) . gen p2 = exp((-1*n))/(1+exp((-1*n))) . gen p3 = exp((-1*n)+2)/(1+exp((-1*n)+2)) . gen x = (n+8)*(9.375) . label var p1 "Pr(y<=1 | x)" . label var p2 "Pr(y<=2 | x)" . label var p3 "Pr(y<=3 | x)" . graph twoway (line p1 p2 p3 x) , ylabel(0(.2)1) xlabel(0(50)150) /// > ytitle("Pr(y<=m)") xtitle("x") /// > ysize(2.6558) xsize(4.0413) . graph export 05parallel.eps, replace (file 05parallel.eps written in .eps format) . . * an approximate LR test . use ordwarm2, clear (77 & 89 General Social Survey) . * note: omodel is an add-on Stata command--type net search omodel . omodel logit 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 ------------------------------------------------------------------------------ Approximate likelihood-ratio test of proportionality of odds across response categories: chi2(12) = 48.91 Prob > chi2 = 0.0000 . . * a Wald test . ologit warm yr89 male white age ed prst, nolog 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 ------------------------------------------------------------------------------ . 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. . . // * Section 5.7 - residuals and outliers with predict . . use ordwarm2, clear (77 & 89 General Social Survey) . drop warmlt2 warmlt3 warmlt4 . gen warmlt2 = (warm<2) if warm <. . gen warmlt3 = (warm<3) if warm <. . gen warmlt4 = (warm<4) if warm <. . . * binary logit of warm < 2 . logit warmlt2 yr89 male white age ed prst, nolog Logit estimates Number of obs = 2293 LR chi2(6) = 128.58 Prob > chi2 = 0.0000 Log likelihood = -819.61992 Pseudo R2 = 0.0727 ------------------------------------------------------------------------------ warmlt2 | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- yr89 | -.9647422 .1542064 -6.26 0.000 -1.266981 -.6625033 male | .3053643 .1291546 2.36 0.018 .052226 .5585025 white | .5526576 .2305396 2.40 0.017 .1008082 1.004507 age | .0164704 .0040571 4.06 0.000 .0085187 .0244221 ed | -.1047962 .0253348 -4.14 0.000 -.1544516 -.0551409 prst | .0014112 .0056702 0.25 0.803 -.0097023 .0125246 _cons | -1.858405 .3958164 -4.70 0.000 -2.63419 -1.082619 ------------------------------------------------------------------------------ . predict rstd_lt2, rs . . * binary logit of warm < 3 . logit warmlt3 yr89 male white age ed prst, nolog Logit estimates Number of obs = 2293 LR chi2(6) = 251.23 Prob > chi2 = 0.0000 Log likelihood = -1449.7863 Pseudo R2 = 0.0797 ------------------------------------------------------------------------------ warmlt3 | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- yr89 | -.5654063 .0928433 -6.09 0.000 -.7473757 -.3834368 male | .6905423 .0898786 7.68 0.000 .5143834 .8667012 white | .3142708 .1405978 2.24 0.025 .0387042 .5898374 age | .0253345 .0028644 8.84 0.000 .0197203 .0309486 ed | -.0528527 .0184571 -2.86 0.004 -.0890279 -.0166774 prst | -.0095322 .0038184 -2.50 0.013 -.0170162 -.0020482 _cons | -.7303287 .269163 -2.71 0.007 -1.257878 -.202779 ------------------------------------------------------------------------------ . predict rstd_lt3, rs . . * binary logit of warm < 4 . logit warmlt4 yr89 male white age ed prst, nolog Logit estimates Number of obs = 2293 LR chi2(6) = 150.77 Prob > chi2 = 0.0000 Log likelihood = -1011.9542 Pseudo R2 = 0.0693 ------------------------------------------------------------------------------ warmlt4 | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- yr89 | -.3190732 .1140756 -2.80 0.005 -.5426572 -.0954891 male | 1.083789 .1220668 8.88 0.000 .8445422 1.323035 white | .3929984 .1577582 2.49 0.013 .083798 .7021989 age | .0185905 .0037659 4.94 0.000 .0112096 .0259715 ed | -.0575547 .0253812 -2.27 0.023 -.1073008 -.0078085 prst | -.0055304 .0048413 -1.14 0.253 -.0150193 .0039584 _cons | 1.024517 .3463123 2.96 0.003 .3457571 1.703276 ------------------------------------------------------------------------------ . predict rstd_lt4, rs . . * binary logit of plot results for warm < 3 . sort prst . gen index = _n . graph twoway scatter rstd_lt3 index, yline(0) ylabel(-4(2)4) /// > xtitle("Observation Number") xlabel(0(500)2293) /// > ysize(2.6558) xsize(4.0413) msymbol(Oh) . graph export 05residplot.eps, replace (file 05residplot.eps written in .eps format) . . // * Section 5.8.1 - partial change in y* . . use ordwarm2, clear (77 & 89 General Social Survey) . ologit warm yr89 male white age ed prst, nolog 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 ------------------------------------------------------------------------------ . listcoef, std help 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 ------------------------------------------------------------------------------- b = raw coefficient z = z-score for test of b=0 P>|z| = p-value for z-test bStdX = x-standardized coefficient bStdY = y-standardized coefficient bStdXY = fully standardized coefficient SDofX = standard deviation of X . . // * Section 5.8.3 - in sample predicted probabilities with -predict- . . ologit warm yr89 male white age ed prst, nolog 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 SDwarm Dwarm Awarm SAwarm (option p assumed; predicted probabilities) . label var SDwarm "Pr(SD)" . label var Dwarm "Pr(D)" . label var Awarm "Pr(A)" . label var SAwarm "Pr(SA)" . dotplot SDwarm Dwarm Awarm SAwarm, ylabel(0(.25).75) /// > ysize(2.0124) xsize(3.039) . graph export 05pred.eps, replace (file 05pred.eps written in .eps format) . . // * Section 5.8.4 - individual predicted probabilities with -prvalue- . . ologit warm yr89 male white age ed prst, nolog 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 ------------------------------------------------------------------------------ . . * working class men in 1977 who are near retirement . prvalue, x(yr89=0 male=1 prst=20 age=64 ed=16) rest(mean) ologit: Predictions for warm Pr(y=SD|x): 0.2317 Pr(y=D|x): 0.4221 Pr(y=A|x): 0.2723 Pr(y=SA|x): 0.0739 yr89 male white age ed prst x= 0 1 .8765809 64 16 20 . * young, highly educated women with prestigious jobs . prvalue, x(yr89=1 male=0 prst=80 age=30 ed=24) rest(mean) brief Pr(y=SD|x): 0.0164 Pr(y=D|x): 0.0781 Pr(y=A|x): 0.3147 Pr(y=SA|x): 0.5908 . * an average individual in 1977 . prvalue, x(yr89=0) rest(mean) brief Pr(y=SD|x): 0.1336 Pr(y=D|x): 0.3577 Pr(y=A|x): 0.3737 Pr(y=SA|x): 0.1349 . * an average individual in 1989 . prvalue, x(yr89=1) rest(mean) brief Pr(y=SD|x): 0.0837 Pr(y=D|x): 0.2802 Pr(y=A|x): 0.4277 Pr(y=SA|x): 0.2085 . . // * Section 5.8.5 - tables of predicted probabilities with -prtab- . . 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 . . // * Section 5.8.6 - graphing predicted probabilities with -prgen- . . prgen age, from(20) to(80) generate(w89) x(male=0 yr89=1) ncases(13) 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 . desc w89* storage display value variable name type format label variable label ------------------------------------------------------------------------------- w89x float %9.0g Changing value of age w89p1 float %9.0g pr(SD) [1] w89s1 float %9.0g pr(y<=1) w89p2 float %9.0g pr(D) [2] w89s2 float %9.0g pr(y<=2) w89p3 float %9.0g pr(A) [3] w89s3 float %9.0g pr(y<=3) w89p4 float %9.0g pr(SA) [4] w89s4 float %9.0g pr(y<=4) . label var w89p1 "SD" . label var w89p2 "D" . label var w89p3 "A" . label var w89p4 "SA" . label var w89s1 "SD" . label var w89s2 "SD or D" . label var w89s3 "SD, D or A" . . * step 1: graph predicted probabilities . graph twoway connected w89p1 w89p2 w89p3 w89p4 w89x, /// > title("Panel A: Predicted Probabilities") /// > xtitle("Age") xlabel(20(10)80) ylabel(0(.25).50) /// > yscale(noline) ylabel("") xline(44.93) /// > ytitle("") name(tmp1, replace) . . * step 2: graph cumulative probabilities . graph twoway connected w89s1 w89s2 w89s3 w89x, /// > title("Panel B: Cumulative Probabilities") /// > xtitle("Age") xlabel(20(10)80) ylabel(0(.25)1) xline(44.93) /// > yscale(noline) ylabel("") name(tmp2, replace) /// > ytitle("") . . * step 3: combine graphs . graph combine tmp1 tmp2, col(1) iscale(*.9) imargin(small) /// > ysize(4.31) xsize(3.287) . . * step 4: save graph as eps . graph export 05prgen.eps, replace (file 05prgen.eps written in .eps format) . . // * Section 5.8.7 - changes in predicted probabilities with -prchange- . . * marginal change using -prchange- . prchange age, 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 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 . . * marginal change using -mfx- . mfx compute, at(male=0 yr89=1) predict(outcome(1)) Marginal effects after ologit y = Pr(warm==1) (predict, outcome(1)) = .06099996 ------------------------------------------------------------------------------ variable | dy/dx Std. Err. z P>|z| [ 95% C.I. ] X ---------+-------------------------------------------------------------------- yr89*| -.0378526 .00601 -6.30 0.000 -.049633 -.026072 1 male*| .0581355 .00731 7.95 0.000 .043803 .072468 0 white*| .0197511 .0055 3.59 0.000 .008972 .03053 .876581 age | .001241 .00016 7.69 0.000 .000925 .001557 44.9355 ed | -.0038476 .00097 -3.96 0.000 -.005754 -.001941 12.2181 prst | -.0003478 .00019 -1.83 0.068 -.000721 .000025 39.5853 ------------------------------------------------------------------------------ (*) dy/dx is for discrete change of dummy variable from 0 to 1 . . * discrete change with -prchange- . prchange male age prst, x(male=0 yr89=1) rest(mean) ologit: Changes in Predicted Probabilities for warm male Avg|Chg| SD D A SA 0->1 .08469636 .05813552 .11125721 -.05015317 -.11923955 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 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 . * using -delta- to compute effect of 10-year increase in age . ologit warm yr89 male white age ed prst, nolog 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 ------------------------------------------------------------------------------ . prchange age, x(male=0 yr89=1) rest(mean) delta(10) ologit: Changes in Predicted Probabilities for warm (Note: d = 10) age Avg|Chg| SD D A SA Min->Max .16441458 .10941909 .21941006 -.05462247 -.27420671 -+d/2 .02225603 .01242571 .03208634 -.00179818 -.04271388 -+sd/2 .0373125 .0208976 .05372739 -.00300205 -.07162295 MargEfct .00222662 .00124098 .00321226 -.00018032 -.00427292 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 . . // * Section 5.8.8 - odds ratios using listcoef . . ologit warm yr89 male white age ed prst, nolog 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 ------------------------------------------------------------------------------ . listcoef male age, help ologit (N=2293): Factor Change in Odds Odds of: >m vs <=m ---------------------------------------------------------------------- warm | b z P>|z| e^b e^bStdX SDofX -------------+-------------------------------------------------------- male | -0.73330 -9.343 0.000 0.4803 0.6936 0.4989 age | -0.02167 -8.778 0.000 0.9786 0.6952 16.7790 ---------------------------------------------------------------------- b = raw coefficient z = z-score for test of b=0 P>|z| = p-value for z-test e^b = exp(b) = factor change in odds for unit increase in X e^bStdX = exp(b*SD of X) = change in odds for SD increase in X SDofX = standard deviation of X . listcoef male age, help percent ologit (N=2293): Percentage Change in Odds Odds of: >m vs <=m ---------------------------------------------------------------------- warm | b z P>|z| % %StdX SDofX -------------+-------------------------------------------------------- male | -0.73330 -9.343 0.000 -52.0 -30.6 0.4989 age | -0.02167 -8.778 0.000 -2.1 -30.5 16.7790 ---------------------------------------------------------------------- b = raw coefficient z = z-score for test of b=0 P>|z| = p-value for z-test % = percent change in odds for unit increase in X %StdX = percent change in odds for SD increase in X SDofX = standard deviation of X . listcoef male, reverse ologit (N=2293): Factor Change in Odds Odds of: <=m vs >m ---------------------------------------------------------------------- warm | b z P>|z| e^b e^bStdX SDofX -------------+-------------------------------------------------------- male | -0.73330 -9.343 0.000 2.0819 1.4417 0.4989 ---------------------------------------------------------------------- . . log close log: d:\spost.stata8\do\st8ch5.log log type: text closed on: 26 May 2003, 12:50:02 -------------------------------------------------------------------------------------------------------------