--------------------------------------------------------------------------------------------------------- name: log: C:\Users\ehudes\Documents\My Documents on C\Methods Core\2015\2015_StataConference\StataConf > Columbus2015.log log type: text opened on: 14 Dec 2015, 11:39:00 . * StataConfColumbus2015.do esh 09dec2015 . * document commands and examples from the 2015 Stata conference in Columbus . . version 14 . window manage maintitle STATA_CONFRENCE_2015 . * #1 Dwamena . which midas C:\Users\ehudes\My Documents\My Documents on C\ado\stbplus\m\midas.ado *! version 2.00 December 21, 2008 *! version 1.00 August 15, 2007 *! Ben A. Dwamena: bdwamena@umich.edu . search midasinla . search inla . * new command not found . . * #2 Gregory . search teffects . search treatoprobit . search switchoprobit . search treatoprobitsim . * the -treat- commands not yet there.. . . * #3 RWilliams . search xtbond . search xtabond . search xtdpdsys . search xtdpdml . net install xtdpdml, from(http://www3.nd.edu/~rwilliam/stata) checking xtdpdml consistency and verifying not already installed... all files already exist and are up to date. . which xtdpdml C:\Users\ehudes\My Documents\My Documents on C\ado\stbplus\x\xtdpdml.ado *! xtdpdml.ado Beta 1.20 Richard Williams 8/18/2015 . . // Example 1: -xtdpdml- vs. -sem- . // SEM coding (Adapted from Allison 2014 Appendix B) . use http://statisticalhorizons.com/wp-content/uploads/wages.dta, clear . keep wks lwage union ed id t . des, short Contains data from http://statisticalhorizons.com/wp-content/uploads/wages.dta obs: 4,165 vars: 6 30 Mar 2009 10:28 size: 99,960 Sorted by: Note: Dataset has changed since last saved. . summ Variable | Obs Mean Std. Dev. Min Max -------------+--------------------------------------------------------- wks | 4,165 46.81152 5.129098 5 52 union | 4,165 .3639856 .4812023 0 1 ed | 4,165 12.84538 2.787995 4 17 lwage | 4,165 6.676346 .4615122 4.60517 8.537 t | 4,165 4 2.00024 1 7 -------------+--------------------------------------------------------- id | 4,165 298 171.7821 1 595 . reshape wide wks lwage union, i(id) j(t) (note: j = 1 2 3 4 5 6 7) Data long -> wide ----------------------------------------------------------------------------- Number of obs. 4165 -> 595 Number of variables 6 -> 23 j variable (7 values) t -> (dropped) xij variables: wks -> wks1 wks2 ... wks7 lwage -> lwage1 lwage2 ... lwage7 union -> union1 union2 ... union7 ----------------------------------------------------------------------------- . sem (wks2 <- wks1@b1 lwage1@b2 union1@b3 ed@b4 Alpha@1 E2@1 ) /// > (wks3 <- wks2@b1 lwage2@b2 union2@b3 ed@b4 Alpha@1 E3@1) /// > (wks4 <- wks3@b1 lwage3@b2 union3@b3 ed@b4 Alpha@1 E4@1) /// > (wks5 <- wks4@b1 lwage4@b2 union4@b3 ed@b4 Alpha@1 E5@1) /// > (wks6 <- wks5@b1 lwage5@b2 union5@b3 ed@b4 Alpha@1 E6@1) /// > (wks7 <- wks6@b1 lwage6@b2 union6@b3 ed@b4 Alpha@1), /// > var(e.wks2@0 e.wks3@0 e.wks4@0 e.wks5@0 e.wks6@0) var(Alpha) /// > cov(Alpha*(ed)@0) cov(Alpha*(E2 E3 E4 E5 E6)@0) /// > cov(_OEx*(E2 E3 E4 E5 E6)@0) cov(E2*(E3 E4 E5 E6)@0) /// > cov(E3*(E4 E5 E6)@0) cov(E4*(E5 E6)@0) cov(E5*(E6)@0) /// > cov(union3*(E2)) cov(union4*(E2 E3)) cov(union5*(E2 E3 E4)) /// > cov(union6*(E2 E3 E4 E5)) /// > iterate(250) technique(nr 25 bhhh 25) noxconditional Endogenous variables Observed: wks2 wks3 wks4 wks5 wks6 wks7 Exogenous variables Observed: wks1 lwage1 union1 ed lwage2 union2 lwage3 union3 lwage4 union4 lwage5 union5 lwage6 union6 Latent: Alpha E2 E3 E4 E5 E6 Fitting target model: (setting technique to nr) Iteration 0: log likelihood = -27640.159 Iteration 1: log likelihood = -20212.067 Iteration 2: log likelihood = -12616.013 (not concave) Iteration 3: log likelihood = -12513.625 Iteration 4: log likelihood = -12453.79 Iteration 5: log likelihood = -12263.052 Iteration 6: log likelihood = -12228.051 Iteration 7: log likelihood = -12227.33 Iteration 8: log likelihood = -12227.322 Iteration 9: log likelihood = -12227.322 Structural equation model Number of obs = 595 Estimation method = ml Log likelihood = -12227.322 ( 1) - [wks2]wks1 + [wks3]wks2 = 0 ( 2) - [wks2]wks1 + [wks4]wks3 = 0 ( 3) - [wks2]wks1 + [wks5]wks4 = 0 ( 4) - [wks2]wks1 + [wks6]wks5 = 0 ( 5) - [wks2]wks1 + [wks7]wks6 = 0 ( 6) [wks2]lwage1 - [wks7]lwage6 = 0 ( 7) [wks2]union1 - [wks7]union6 = 0 ( 8) [wks2]ed - [wks7]ed = 0 ( 9) [wks2]Alpha = 1 (10) [wks2]E2 = 1 (11) [wks3]ed - [wks7]ed = 0 (12) [wks3]lwage2 - [wks7]lwage6 = 0 (13) [wks3]union2 - [wks7]union6 = 0 (14) [wks3]Alpha = 1 (15) [wks3]E3 = 1 (16) [wks4]ed - [wks7]ed = 0 (17) [wks4]lwage3 - [wks7]lwage6 = 0 (18) [wks4]union3 - [wks7]union6 = 0 (19) [wks4]Alpha = 1 (20) [wks4]E4 = 1 (21) [wks5]ed - [wks7]ed = 0 (22) [wks5]lwage4 - [wks7]lwage6 = 0 (23) [wks5]union4 - [wks7]union6 = 0 (24) [wks5]Alpha = 1 (25) [wks5]E5 = 1 (26) [wks6]ed - [wks7]ed = 0 (27) [wks6]lwage5 - [wks7]lwage6 = 0 (28) [wks6]union5 - [wks7]union6 = 0 (29) [wks6]Alpha = 1 (30) [wks6]E6 = 1 (31) [wks7]Alpha = 1 (32) [var(e.wks2)]_cons = 0 (33) [var(e.wks3)]_cons = 0 (34) [var(e.wks4)]_cons = 0 (35) [var(e.wks5)]_cons = 0 (36) [var(e.wks6)]_cons = 0 ----------------------------------------------------------------------------------- | OIM | Coef. Std. Err. z P>|z| [95% Conf. Interval] ------------------+---------------------------------------------------------------- Structural | wks2 <- | wks1 | .1871266 .0201939 9.27 0.000 .1475473 .2267059 lwage1 | .6417879 .4842305 1.33 0.185 -.3072865 1.590862 union1 | -1.19136 .5168948 -2.30 0.021 -2.204455 -.1782652 ed | -.1122268 .0559478 -2.01 0.045 -.2218824 -.0025712 Alpha | 1 5.01e-16 2.0e+15 0.000 1 1 E2 | 1 6.66e-16 1.5e+15 0.000 1 1 _cons | 36.1404 2.886827 12.52 0.000 30.48233 41.79848 ----------------+---------------------------------------------------------------- wks3 <- | wks2 | .1871266 .0201939 9.27 0.000 .1475473 .2267059 ed | -.1122268 .0559478 -2.01 0.045 -.2218824 -.0025712 lwage2 | .6417879 .4842305 1.33 0.185 -.3072865 1.590862 union2 | -1.19136 .5168948 -2.30 0.021 -2.204455 -.1782652 Alpha | 1 1.13e-15 8.9e+14 0.000 1 1 E3 | 1 1.55e-16 6.4e+15 0.000 1 1 _cons | 35.95343 2.92939 12.27 0.000 30.21193 41.69493 ----------------+---------------------------------------------------------------- wks4 <- | wks3 | .1871266 .0201939 9.27 0.000 .1475473 .2267059 ed | -.1122268 .0559478 -2.01 0.045 -.2218824 -.0025712 lwage3 | .6417879 .4842305 1.33 0.185 -.3072865 1.590862 union3 | -1.19136 .5168948 -2.30 0.021 -2.204455 -.1782652 Alpha | 1 1.11e-16 9.0e+15 0.000 1 1 E4 | 1 1.85e-15 5.4e+14 0.000 1 1 _cons | 36.03656 2.988439 12.06 0.000 30.17933 41.8938 ----------------+---------------------------------------------------------------- wks5 <- | wks4 | .1871266 .0201939 9.27 0.000 .1475473 .2267059 ed | -.1122268 .0559478 -2.01 0.045 -.2218824 -.0025712 lwage4 | .6417879 .4842305 1.33 0.185 -.3072865 1.590862 union4 | -1.19136 .5168948 -2.30 0.021 -2.204455 -.1782652 Alpha | 1 4.51e-16 2.2e+15 0.000 1 1 E5 | 1 9.58e-16 1.0e+15 0.000 1 1 _cons | 35.71918 3.03504 11.77 0.000 29.77061 41.66775 ----------------+---------------------------------------------------------------- wks6 <- | wks5 | .1871266 .0201939 9.27 0.000 .1475473 .2267059 ed | -.1122268 .0559478 -2.01 0.045 -.2218824 -.0025712 lwage5 | .6417879 .4842305 1.33 0.185 -.3072865 1.590862 union5 | -1.19136 .5168948 -2.30 0.021 -2.204455 -.1782652 Alpha | 1 1.47e-15 6.8e+14 0.000 1 1 E6 | 1 3.07e-16 3.3e+15 0.000 1 1 _cons | 35.46433 3.073924 11.54 0.000 29.43955 41.48911 ----------------+---------------------------------------------------------------- wks7 <- | wks6 | .1871266 .0201939 9.27 0.000 .1475473 .2267059 ed | -.1122268 .0559478 -2.01 0.045 -.2218824 -.0025712 lwage6 | .6417879 .4842305 1.33 0.185 -.3072865 1.590862 union6 | -1.19136 .5168948 -2.30 0.021 -2.204455 -.1782652 Alpha | 1 (constrained) _cons | 35.17662 3.107714 11.32 0.000 29.08561 41.26762 ------------------+---------------------------------------------------------------- mean(wks1)| 46.28067 .2561475 180.68 0.000 45.77863 46.78271 mean(lwage1)| 6.375173 .0159105 400.69 0.000 6.343989 6.406357 mean(union1)| .3613445 .0196941 18.35 0.000 .3227449 .3999442 mean(ed)| 12.84538 .1142829 112.40 0.000 12.62139 13.06937 mean(lwage2)| 6.465212 .0148568 435.17 0.000 6.436093 6.494331 mean(union2)| .3478992 .0195266 17.82 0.000 .3096278 .3861705 mean(lwage3)| 6.596717 .0182971 360.53 0.000 6.560855 6.632579 mean(union3)| .3697479 .0197753 18.70 0.000 .330989 .4085068 mean(lwage4)| 6.696079 .0180538 370.90 0.000 6.660694 6.731464 mean(union4)| .3731092 .0198254 18.82 0.000 .3342522 .4119663 mean(lwage5)| 6.786454 .0173682 390.74 0.000 6.752413 6.820495 mean(union5)| .3663866 .0197511 18.55 0.000 .3276751 .405098 mean(lwage6)| 6.864045 .0173685 395.20 0.000 6.830003 6.898087 mean(union6)| .3630252 .0196669 18.46 0.000 .3244788 .4015716 ------------------+---------------------------------------------------------------- var(e.wks2)| 0 (constrained) var(e.wks3)| 0 (constrained) var(e.wks4)| 0 (constrained) var(e.wks5)| 0 (constrained) var(e.wks6)| 0 (constrained) var(e.wks7)| 17.84645 1.142007 15.74283 20.23116 var(wks1)| 39.03887 2.263361 34.84553 43.73684 var(lwage1)| .1506209 .0087326 .134442 .1687468 var(union1)| .2307747 .0133796 .2059861 .2585463 var(ed)| 7.77105 .450543 6.936326 8.706225 var(lwage2)| .1313318 .0076142 .1172249 .1471364 var(union2)| .2268653 .013153 .2024967 .2541665 var(lwage3)| .1991972 .0115489 .1778005 .2231688 var(union3)| .2326821 .0134656 .2077317 .2606293 var(lwage4)| .1939345 .0112438 .1731031 .2172727 var(union4)| .2338621 .0135468 .2087627 .2619792 var(lwage5)| .1794845 .010406 .1602053 .2010839 var(union5)| .2321135 .0134399 .2072114 .2600082 var(lwage6)| .1794915 .0104064 .1602115 .2010917 var(union6)| .2301376 .0133299 .2054398 .2578045 var(Alpha)| 4.42182 .550008 3.465168 5.64258 var(E2)| 18.72352 1.208949 16.49783 21.24948 var(E3)| 14.63032 .9690006 12.84922 16.65831 var(E4)| 11.99507 .8136526 10.50181 13.70067 var(E5)| 16.3144 1.05624 14.37017 18.52168 var(E6)| 16.40029 1.074012 14.42476 18.64638 ------------------+---------------------------------------------------------------- cov(wks1,lwage1)| .3160156 .1002513 3.15 0.002 .1195267 .5125044 cov(wks1,union1)| -.4005791 .1241417 -3.23 0.001 -.6438924 -.1572657 cov(wks1,ed)| .0669275 .7140575 0.09 0.925 -1.3326 1.466454 cov(wks1,lwage2)| .2564592 .0934207 2.75 0.006 .073358 .4395604 cov(wks1,union2)| -.4489062 .1233842 -3.64 0.000 -.6907348 -.2070775 cov(wks1,lwage3)| .3639035 .1152918 3.16 0.002 .1379357 .5898713 cov(wks1,union3)| -.5946638 .125862 -4.72 0.000 -.8413487 -.3479789 cov(wks1,lwage4)| .3591906 .1137593 3.16 0.002 .1362265 .5821547 cov(wks1,union4)| -.5523482 .1259305 -4.39 0.000 -.7991675 -.3055289 cov(wks1,lwage5)| .3079751 .1092505 2.82 0.005 .0938481 .5221021 cov(wks1,union5)| -.5858504 .1257223 -4.66 0.000 -.8322616 -.3394392 cov(wks1,lwage6)| .2700058 .1090836 2.48 0.013 .0562058 .4838058 cov(wks1,union6)| -.4554523 .1243507 -3.66 0.000 -.6991751 -.2117294 cov(wks1,Alpha)| 3.987204 .8105242 4.92 0.000 2.398606 5.575803 cov(lwage1,union1)| .0115422 .0076579 1.51 0.132 -.003467 .0265514 cov(lwage1,ed)| .4263685 .0476731 8.94 0.000 .3329308 .5198061 cov(lwage1,lwage2)| .1324666 .0079207 16.72 0.000 .1169423 .1479908 cov(lwage1,union2)| .0103209 .00759 1.36 0.174 -.0045553 .0251971 cov(lwage1,lwage3)| .1488585 .0093631 15.90 0.000 .1305072 .1672098 cov(lwage1,union3)| .0060017 .0076721 0.78 0.434 -.0090353 .0210388 cov(lwage1,lwage4)| .1446785 .00918 15.76 0.000 .126686 .162671 cov(lwage1,union4)| .0035012 .0076918 0.46 0.649 -.0115745 .0185768 cov(lwage1,lwage5)| .1400468 .0088543 15.82 0.000 .1226927 .1574009 cov(lwage1,union5)| .0001804 .0076592 0.02 0.981 -.0148314 .0151923 cov(lwage1,lwage6)| .1342128 .0087012 15.42 0.000 .1171587 .1512668 cov(lwage1,union6)| .0028048 .0076309 0.37 0.713 -.0121515 .0177611 cov(lwage1,Alpha)| -.0003782 .0684584 -0.01 0.996 -.1345541 .1337978 cov(union1,ed)| -.3794224 .0570614 -6.65 0.000 -.4912607 -.267584 cov(union1,lwage2)| .0145458 .0071619 2.03 0.042 .0005087 .028583 cov(union1,union2)| .210423 .0127439 16.51 0.000 .1854453 .2354006 cov(union1,lwage3)| -.0014845 .00879 -0.17 0.866 -.0187125 .0157435 cov(union1,union3)| .19923 .0125215 15.91 0.000 .1746884 .2237717 cov(union1,lwage4)| -.0062153 .0086766 -0.72 0.474 -.0232211 .0107906 cov(union1,union4)| .2013666 .0125987 15.98 0.000 .1766735 .2260596 cov(union1,lwage5)| -.0028476 .0083443 -0.34 0.733 -.0192022 .013507 cov(union1,union5)| .1903738 .0122768 15.51 0.000 .1663116 .2144359 cov(union1,lwage6)| -.0008375 .0083437 -0.10 0.920 -.017191 .0155159 cov(union1,union6)| .1879984 .0121878 15.43 0.000 .1641108 .211886 cov(union1,Alpha)| -.1158943 .1094339 -1.06 0.290 -.3303808 .0985922 cov(ed,lwage2)| .4218367 .0448814 9.40 0.000 .3338707 .5098026 cov(ed,union2)| -.3462072 .0562533 -6.15 0.000 -.4564617 -.2359527 cov(ed,lwage3)| .5264575 .0553845 9.51 0.000 .4179058 .6350091 cov(ed,union3)| -.3334976 .0567458 -5.88 0.000 -.4447173 -.2222779 cov(ed,lwage4)| .5504323 .0551552 9.98 0.000 .44233 .6585346 cov(ed,union4)| -.3844318 .0574487 -6.69 0.000 -.4970292 -.2718344 cov(ed,lwage5)| .5402925 .0532427 10.15 0.000 .4359386 .6446463 cov(ed,union5)| -.3482034 .0568414 -6.13 0.000 -.4596104 -.2367963 cov(ed,lwage6)| .5240153 .0529695 9.89 0.000 .4201971 .6278335 cov(ed,union6)| -.3697903 .0568717 -6.50 0.000 -.4812567 -.2583239 cov(lwage2,union2)| .0128665 .007096 1.81 0.070 -.0010414 .0267744 cov(lwage2,lwage3)| .1401847 .0087747 15.98 0.000 .1229865 .1573829 cov(lwage2,union3)| .0081786 .0071679 1.14 0.254 -.0058702 .0222275 cov(lwage2,lwage4)| .1379011 .0086468 15.95 0.000 .1209537 .1548486 cov(lwage2,union4)| .006576 .007186 0.92 0.360 -.0075084 .0206604 cov(lwage2,lwage5)| .1338988 .0083516 16.03 0.000 .11753 .1502677 cov(lwage2,union5)| .0049744 .0071539 0.70 0.487 -.0090471 .0189959 cov(lwage2,lwage6)| .1281621 .008199 15.63 0.000 .1120922 .1442319 cov(lwage2,union6)| .0064767 .0071286 0.91 0.364 -.0074952 .0204486 cov(lwage2,Alpha)| .0005449 .0642147 0.01 0.993 -.1253137 .1264035 cov(union2,lwage3)| -.0021053 .0087154 -0.24 0.809 -.0191872 .0149767 cov(union2,union3)| .2055761 .0126326 16.27 0.000 .1808167 .2303355 cov(union2,lwage4)| -.0066879 .0086035 -0.78 0.437 -.0235504 .0101746 cov(union2,union4)| .2045169 .0126239 16.20 0.000 .1797746 .2292592 cov(union2,lwage5)| -.0024133 .0082731 -0.29 0.771 -.0186284 .0138017 cov(union2,union5)| .1966561 .0123818 15.88 0.000 .1723882 .2209239 cov(union2,lwage6)| .0020342 .0082731 0.25 0.806 -.0141808 .0182493 cov(union2,union6)| .1941821 .01229 15.80 0.000 .1700942 .21827 cov(union2,Alpha)| -.1059059 .1120147 -0.95 0.344 -.3254506 .1136388 cov(lwage3,union3)| -.0037036 .0088192 -0.42 0.675 -.020989 .0135817 cov(lwage3,lwage4)| .17669 .0108349 16.31 0.000 .1554539 .1979261 cov(lwage3,union4)| -.0063626 .0088464 -0.72 0.472 -.0237012 .010976 cov(lwage3,lwage5)| .1670235 .0103428 16.15 0.000 .1467519 .1872951 cov(lwage3,union5)| -.0076785 .0088104 -0.87 0.383 -.0249465 .0095896 cov(lwage3,lwage6)| .1616886 .0101995 15.85 0.000 .141698 .1816792 cov(lwage3,union6)| -.0075154 .0087767 -0.86 0.392 -.0247173 .0096866 cov(lwage3,Alpha)| .025392 .0785008 0.32 0.746 -.1284667 .1792507 cov(union3,lwage4)| -.0067806 .0087075 -0.78 0.436 -.023847 .0102858 cov(union3,union4)| .2114736 .0128889 16.41 0.000 .1862119 .2367353 cov(union3,lwage5)| -.0039441 .0083725 -0.47 0.638 -.0203539 .0124657 cov(union3,union5)| .2021532 .0126037 16.04 0.000 .1774504 .226856 cov(union3,lwage6)| .0036388 .0083746 0.43 0.664 -.0127751 .0200527 cov(union3,union6)| .1976268 .0124618 15.86 0.000 .173202 .2220515 cov(union3,Alpha)| -.0744916 .1153352 -0.65 0.518 -.3005444 .1515613 cov(union3,E2)| -.099842 .0416344 -2.40 0.016 -.181444 -.01824 cov(lwage4,union4)| -.0097286 .0087373 -1.11 0.266 -.0268535 .0073963 cov(lwage4,lwage5)| .1691689 .0103247 16.38 0.000 .1489329 .1894049 cov(lwage4,union5)| -.0101923 .0087023 -1.17 0.242 -.0272484 .0068638 cov(lwage4,lwage6)| .1649837 .0102103 16.16 0.000 .1449718 .1849955 cov(lwage4,union6)| -.009188 .0086679 -1.06 0.289 -.0261767 .0078007 cov(lwage4,Alpha)| .0544782 .0762579 0.71 0.475 -.0949844 .2039409 cov(union4,lwage5)| -.0060207 .0083987 -0.72 0.473 -.0224819 .0104405 cov(union4,union5)| .2095123 .0128283 16.33 0.000 .1843692 .2346553 cov(union4,lwage6)| .0012983 .0083968 0.15 0.877 -.0151592 .0177558 cov(union4,union6)| .2068453 .0127315 16.25 0.000 .181892 .2317985 cov(union4,Alpha)| -.072569 .1163971 -0.62 0.533 -.3007032 .1555651 cov(union4,E2)| -.0776065 .043444 -1.79 0.074 -.1627552 .0075421 cov(union4,E3)| .0216793 .0332503 0.65 0.514 -.0434901 .0868488 cov(lwage5,union5)| -.0075831 .0083658 -0.91 0.365 -.0239798 .0088135 cov(lwage5,lwage6)| .1664092 .0100342 16.58 0.000 .1467425 .1860759 cov(lwage5,union6)| -.0063176 .0083335 -0.76 0.448 -.0226509 .0100157 cov(lwage5,Alpha)| .028581 .0733717 0.39 0.697 -.1152248 .1723869 cov(union5,lwage6)| -.0017817 .0083623 -0.21 0.831 -.0181714 .014608 cov(union5,union6)| .2142615 .0129069 16.60 0.000 .1889646 .2395585 cov(union5,Alpha)| -.093772 .1200464 -0.78 0.435 -.3290586 .1415147 cov(union5,E2)| -.1154353 .0542068 -2.13 0.033 -.2216787 -.0091919 cov(union5,E3)| .0008031 .0428352 0.02 0.985 -.0831524 .0847586 cov(union5,E4)| -.0241652 .0359835 -0.67 0.502 -.0946917 .0463612 cov(lwage6,union6)| -.0001818 .0083309 -0.02 0.983 -.01651 .0161464 cov(lwage6,Alpha)| .0338507 .0728029 0.46 0.642 -.1088403 .1765417 cov(union6,Alpha)| -.0833252 .1204062 -0.69 0.489 -.3193169 .1526666 cov(union6,E2)| -.0673204 .0573886 -1.17 0.241 -.1798 .0451591 cov(union6,E3)| -.0039586 .0475236 -0.08 0.934 -.0971031 .0891859 cov(union6,E4)| .0198606 .0397133 0.50 0.617 -.0579761 .0976972 cov(union6,E5)| .0445872 .0347707 1.28 0.200 -.0235622 .1127366 ----------------------------------------------------------------------------------- LR test of model vs. saturated: chi2(71) = 110.23, Prob > chi2 = 0.0020 . . use http://statisticalhorizons.com/wp-content/uploads/wages.dta, clear . xtset id t panel variable: id (strongly balanced) time variable: t, 1 to 7 delta: 1 unit . xtdpdml wks L1.lwage, inv(ed) pre(L.union) Highlights parameterization: ------------------------------------------------------------------------------ | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- wks2 | wks1 | .1871266 .0201939 9.27 0.000 .1475473 .2267059 lwage1 | .6417879 .4842305 1.33 0.185 -.3072865 1.590862 union1 | -1.19136 .5168948 -2.30 0.021 -2.204455 -.1782652 ed | -.1122268 .0559478 -2.01 0.045 -.2218824 -.0025712 ------------------------------------------------------------------------------ Number of units = 595. Number of periods = 6. LR test of model vs. saturated: chi2(71) = 110.23, Prob > chi2 = 0.0020 Wald test of all coeff = 0: chi2(4) = 90.09, Prob > chi2 = 0.0000 . . // Example 2: -xtdpdml- vs. -xtabond- . webuse abdata, clear . keep if year>=1978&year<=1982 (331 observations deleted) . xtabond n l(0/1).w l(0/2).(k ys) yr1976-yr1984, lags(2) note: yr1976 dropped from div() because of collinearity note: yr1977 dropped from div() because of collinearity note: yr1978 dropped from div() because of collinearity note: yr1979 dropped from div() because of collinearity note: yr1982 dropped from div() because of collinearity note: yr1983 dropped from div() because of collinearity note: yr1984 dropped from div() because of collinearity note: yr1976 dropped because of collinearity note: yr1977 dropped because of collinearity note: yr1978 dropped because of collinearity note: yr1979 dropped because of collinearity note: yr1980 dropped because of collinearity note: yr1983 dropped because of collinearity note: yr1984 dropped because of collinearity Arellano-Bond dynamic panel-data estimation Number of obs = 280 Group variable: id Number of groups = 140 Time variable: year Obs per group: min = 2 avg = 2 max = 2 Number of instruments = 16 Wald chi2(12) = 475.34 Prob > chi2 = 0.0000 One-step results ------------------------------------------------------------------------------ n | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- n | L1. | .8636287 .641197 1.35 0.178 -.3930943 2.120352 L2. | -.2688295 .1869653 -1.44 0.150 -.6352747 .0976156 | w | --. | -.615574 .112091 -5.49 0.000 -.8352683 -.3958797 L1. | .2269372 .280154 0.81 0.418 -.3221545 .776029 | k | --. | .3643567 .0840049 4.34 0.000 .1997101 .5290034 L1. | -.2013362 .2793717 -0.72 0.471 -.7488946 .3462223 L2. | .0299686 .1133592 0.26 0.791 -.1922114 .2521487 | ys | --. | .5747433 .2051002 2.80 0.005 .1727543 .9767324 L1. | -.6897782 .3395952 -2.03 0.042 -1.355373 -.0241838 L2. | -.0620578 .24562 -0.25 0.801 -.5434642 .4193485 | yr1981 | -.0330116 .0230122 -1.43 0.151 -.0781146 .0120914 yr1982 | -.0505324 .0323458 -1.56 0.118 -.113929 .0128642 _cons | 2.594037 1.504732 1.72 0.085 -.3551828 5.543257 ------------------------------------------------------------------------------ Instruments for differenced equation GMM-type: L(2/.).n Standard: D.w LD.w D.k LD.k L2D.k D.ys LD.ys L2D.ys D.yr1980 D.yr1981 Instruments for level equation Standard: _cons . xtdpdml n l(0/1).w l(0/2).(k ys) , ylags(1 2) tfix Highlights parameterization: ------------------------------------------------------------------------------ | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- n3 | n2 | 1.08463 . . . . . n1 | -.1491957 .1070985 -1.39 0.164 -.359105 .0607135 w3 | -.6802938 .1080128 -6.30 0.000 -.8919949 -.4685927 w2 | .5356601 .1340632 4.00 0.000 .272901 .7984192 k3 | .339605 .0581485 5.84 0.000 .2256361 .453574 k2 | -.2532091 .0595624 -4.25 0.000 -.3699492 -.136469 k1 | -.0273114 .0715233 -0.38 0.703 -.1674945 .1128716 ys3 | .4468998 .1964799 2.27 0.023 .0618063 .8319932 ys2 | -.4225085 .2243788 -1.88 0.060 -.8622828 .0172658 ys1 | .1668381 .2403144 0.69 0.488 -.3041695 .6378456 ------------------------------------------------------------------------------ Number of units = 140. Number of periods = 3. Wald test of all coeff = 0: chi2(9) = 353.22, Prob > chi2 = 0.0000 Warning: Convergence not achieved . . /* > net from http://www.moralbenito.com > search xtmoralb > */ . . * #4 Ender - 15 years a consultant . . * #5 Cattaneo - Robust estimation in regression-discontinuity designs . *net install rdrobust, from(https://sites.google.com/site/rdpackages/) . net install rdrobust, from(http://www-personal.umich.edu/~cattaneo/software/rdrobust/stata) replace checking rdrobust consistency and verifying not already installed... all files already exist and are up to date. . which rdrobust C:\Users\ehudes\My Documents\My Documents on C\ado\stbplus\r\rdrobust.ado *!version 6.0 14Oct2014 . which rdplot C:\Users\ehudes\My Documents\My Documents on C\ado\stbplus\r\rdplot.ado *!version 6.1 16Feb2015 . *copy "http://www-personal.umich.edu/~cattaneo/software/rdrobust/stata/rdrobust_illustration.do" rdrobu > st_illustration.do . . * #6 Liu - Estimations in panel data with indiv effects and AR(p) remainder disturbunces . capture noisily which xtregarp command xtregarp not found as either built-in or ado-file . * not found! . which xtregar C:\Program Files (x86)\Stata14\ado\base\x\xtregar.ado *! version 1.6.4 15oct2015 . * the above is Stata cmd . . * #7 Pope : IRT models in Stata . . * #8 Wells : meta-analysis for the effects of interviewer supportiveness on accuracy of children's repo > rts . . * #9 Bauldry : Confirmatory tetrad analysis . net from https://github.com/sbauldry/tetrad/raw/master --------------------------------------------------------------------------------------------------------- https://github.com/sbauldry/tetrad/raw/master/ Shawn Bauldry, University of Alabama at Birmingham --------------------------------------------------------------------------------------------------------- PACKAGES you could -net describe-: tetrad A command for Confirmatory Tetrad Analysis. --------------------------------------------------------------------------------------------------------- . // example 1 . clear . qui set obs 500 . qui gen xi = rnormal(0,1) . forval i = 1/5 { 2. qui gen x`i' = xi + rnormal(0, sqrt(0.5)) 3. } . qui sem (Xi -> x1 x2 x3 x4 x5) . qui estat framework, fitted . mat sigma1 = r(Sigma) . qui sem (Xi -> x3 x4 x5) (x1 x2 -> Xi) . qui estat framework, fitted . mat sigma2 = r(Sigma) . . **Stata code invoking tetrad command . /* Stata code for simulation and obtaining implied-covariance matrices */ . tetrad x1 x2 x3 x4 x5, icm1(sigma1) icm2(sigma2) /// > reps(5) tlist(1) Model-Implied Tetrads Model 1 tetrad residual AVar t-value vanish -------------------------------------------------- 1234 0.000000 0.000371 0.0000 1 1342 0.000000 0.000371 0.0000 1 1423 -0.000000 0.000371 -0.0000 1 1235 0.000000 0.000351 0.0000 1 1352 -0.000000 0.000351 -0.0000 1 1523 0.000000 0.000351 0.0000 1 1245 0.000000 0.000361 0.0000 1 1452 -0.000000 0.000361 -0.0000 1 1524 -0.000000 0.000364 -0.0000 1 1345 0.000000 0.000355 0.0000 1 1453 -0.000000 0.000355 -0.0000 1 1534 -0.000000 0.000356 -0.0000 1 2345 0.000000 0.000364 0.0000 1 2453 0.000000 0.000364 0.0000 1 2534 -0.000000 0.000365 -0.0000 1 -------------------------------------------------- Model-Implied Tetrads Model 2 tetrad residual AVar t-value vanish -------------------------------------------------- 1234 0.019738 0.000387 1.0028 0 1342 0.000000 0.000387 0.0000 1 1423 -0.019738 0.000343 -1.0656 0 1235 0.020552 0.000368 1.0717 0 1352 0.000000 0.000368 0.0000 1 1523 -0.020552 0.000325 -1.1407 0 1245 0.020062 0.000377 1.0327 0 1452 -0.000000 0.000377 -0.0000 1 1524 -0.020062 0.000337 -1.0933 0 1345 0.000000 0.000356 0.0000 1 1453 0.000000 0.000356 0.0000 1 1534 -0.000000 0.000356 -0.0000 1 2345 0.000000 0.000365 0.0000 1 2453 0.000000 0.000365 0.0000 1 2534 -0.000000 0.000365 -0.0000 1 -------------------------------------------------- Confirmatory Tetrad Analysis Results Model 1 Model 2 M1 - M2 rep Chi-sq df p-val Chi-sq df p-val Chi-sq df p-val -------------------------------------------------------------------------------- 1 8.7911 5 0.1177 6.4709 4 0.1666 2.3202 1 0.1277 2 8.6167 5 0.1254 6.3709 4 0.1731 2.2458 1 0.1340 3 8.7527 5 0.1193 6.4679 4 0.1668 2.2848 1 0.1306 4 8.7838 5 0.1180 6.3947 4 0.1715 2.3891 1 0.1222 5 8.7451 5 0.1197 6.1928 4 0.1852 2.5523 1 0.1101 -------------------------------------------------------------------------------- . . // example 2 . /* > Figure : Multi-trait multi-method model for example 3. > x1 - x3 are three readings of systolic blood pressure. > y1 - y3 are three reading of diastolic blood pressure. > R1 - R3 are latent method factors for each reading occasion. > */ . /* Stata code for model */ . /* qui sem (SBP -> sbp13@1 sbp23@1 sbp33@1) /// > (DBP -> dbp13@1 dbp23@1 dbp33@1) /// > (R1 -> sbp13@1 dbp13@1) /// > (R2 -> sbp23@1 dbp23@1) /// > (R3 -> sbp33@1 dbp33@1), /// > cov(SBP*R1@0 DBP*R1@0) /// > cov(SBP*R2@0 DBP*R2@0) /// > cov(SBP*R3@0 DBP*R3@0) /// > cov(R1*R2@0 R1*R3@0 R2*R3@0) > qui estat framework, fitted > mat sigma1 = r(Sigma) */ . . /* Stata code invoking tetrad bootstrap command */ . /* tetrad_bootstrap sbp13 sbp23 sbp33 /// > dbp13 dbp23 dbp33, ///icm1(sigma1) reps(1000) */ . . * #10 Hemken . webuse auto, clear (1978 Automobile Data) . regress weight c.displacement##c.displacement Source | SS df MS Number of obs = 74 -------------+---------------------------------- F(2, 71) = 161.95 Model | 36166360.5 2 18083180.2 Prob > F = 0.0000 Residual | 7927817.89 71 111659.407 R-squared = 0.8202 -------------+---------------------------------- Adj R-squared = 0.8151 Total | 44094178.4 73 604029.841 Root MSE = 334.15 ----------------------------------------------------------------------------------------------- weight | Coef. Std. Err. t P>|t| [95% Conf. Interval] ------------------------------+---------------------------------------------------------------- displacement | 13.29262 2.111409 6.30 0.000 9.082588 17.50265 | c.displacement#c.displacement | -.0127504 .0046103 -2.77 0.007 -.0219431 -.0035577 | _cons | 999.2722 211.5229 4.72 0.000 577.5075 1421.037 ----------------------------------------------------------------------------------------------- . predict yhat (option xb assumed; fitted values) . twoway (scatter weight displacement) (line yhat displacement, sort) . scatter weight displacement || line yhat displacement, sort . . net from http://www.ssc.wisc.edu/~hemken/Stataworkshops/ --------------------------------------------------------------------------------------------------------- http://www.ssc.wisc.edu/~hemken/Stataworkshops/ Stata Packages from Doug Hemken --------------------------------------------------------------------------------------------------------- Social Science Computing Cooperative University of Wisconsin - Madison PACKAGES you could -net describe-: stdParm post-estimation recentering, rescaling, standardizing (for generalized linear model > s, stdBeta data transformation and re-estimation for centering, rescaling, standarizing --------------------------------------------------------------------------------------------------------- . ** then -net describe- and install -stdParm- . search stdParm . sysuse auto, clear (1978 Automobile Data) . regress price c.displacement##c.displacement // cannot be done in R! Source | SS df MS Number of obs = 74 -------------+---------------------------------- F(2, 71) = 19.60 Model | 225889623 2 112944811 Prob > F = 0.0000 Residual | 409175773 71 5763039.06 R-squared = 0.3557 -------------+---------------------------------- Adj R-squared = 0.3375 Total | 635065396 73 8699525.97 Root MSE = 2400.6 ----------------------------------------------------------------------------------------------- price | Coef. Std. Err. t P>|t| [95% Conf. Interval] ------------------------------+---------------------------------------------------------------- displacement | -36.00091 15.16877 -2.37 0.020 -66.24659 -5.755233 | c.displacement#c.displacement | .1156958 .0331214 3.49 0.001 .0496536 .1817381 | _cons | 7801.936 1519.622 5.13 0.000 4771.896 10831.98 ----------------------------------------------------------------------------------------------- . stdParm Recentering and rescaling: displacement ----------------------------------------------------------- Variable | Original Centered Standardized -------------+--------------------------------------------- displacement | -36.000911 9.6520416 .30053158 | c. | displacement#| c. | displacement | .11569584 .11569584 .33083191 | _cons | 7801.9361 -962.60105 -.32636121 ----------------------------------------------------------- . quietly regress price i.rep78 . stdParm Recentering and rescaling: ----------------------------------------------------------- Variable | Original Centered Standardized -------------+--------------------------------------------- rep78 | 2 | 1403.125 1403.125 .48176954 3 | 1864.7333 1864.7333 .64026492 4 | 1507 1507 .51743551 5 | 1348.5 1348.5 .46301379 | _cons | 4564.5 -1581.5435 -.54303036 ----------------------------------------------------------- . quietly regress price c.weight##c.mpg . stdParm Recentering and rescaling: weight mpg ----------------------------------------------------------- Variable | Original Centered Standardized -------------+--------------------------------------------- weight | 5.0670077 .98475137 .25948245 mpg | 396.78438 -181.98425 -.35696623 | c.weight#| c.mpg | -.19167955 -.19167955 -.29221218 | _cons | -5944.8806 -686.28559 -.23267895 ----------------------------------------------------------- . stdParm, stats(N r2)star Recentering and rescaling: weight mpg -------------------------------------------------------------------- Variable | Original Centered Standardized -------------+------------------------------------------------------ weight | 5.0670077*** .98475137 .25948245 mpg | 396.78438* -181.98425 -.35696623 | c.weight#| c.mpg | -.19167955** -.19167955** -.29221218** | _cons | -5944.8806 -686.28559 -.23267895 -------------+------------------------------------------------------ N | 74 74 74 r2 | .35969597 .35969597 .35969597 -------------------------------------------------------------------- legend: * p<0.05; ** p<0.01; *** p<0.001 . quietly logit foreign c.price##c.weight . stdParm Assuming option nodepvar Recentering and rescaling: price weight ----------------------------------------------------------- Variable | Original Centered Standardized -------------+--------------------------------------------- price | .00331766 .00113549 3.3491337 weight | -.00141654 -.00587217 -4.5638148 | c.price#| c.weight | -7.227e-07 -7.227e-07 -1.6566669 | _cons | -4.5154515 -1.7920268 -1.7920268 ----------------------------------------------------------- . stdParm, eform Assuming option nodepvar Recentering and rescaling: price weight ----------------------------------------------------------- Variable | Original Centered Standardized -------------+--------------------------------------------- price | 1.0033232 1.0011361 28.478052 weight | .99858446 .99414503 .01042222 | c.price#| c.weight | .99999928 .99999928 .19077378 | _cons | .01093867 .16662211 .16662211 ----------------------------------------------------------- . quietly glm price rep78##c.weight##c.mpg . stdParm Recentering and rescaling: weight mpg ----------------------------------------------------------- Variable | Original Centered Standardized -------------+--------------------------------------------- rep78 | 2 | -133422.9 -1926.1734 -.66136066 3 | -11413.246 959.58601 .32947835 4 | 25006.684 3046.0979 1.045892 5 | -20490.712 4856.9477 1.6676557 | weight | 7.7801714 -2.5883765 -.70463185 | rep78#| c.weight | 2 | 36.685806 5.4986566 1.4968953 3 | .68871171 5.6969347 1.5508724 4 | -11.187116 4.0013154 1.0892752 5 | 8.3599662 8.3599662 2.2758275 | mpg | 1084.7671 -391.88633 -.7893605 | rep78#c.mpg | 2 | 5393.397 951.82899 1.9172299 3 | -230.17721 483.07693 .97304197 4 | -1601.3585 561.72642 1.1314624 5 | (omitted) (omitted) (omitted) | c.weight#| c.mpg | -.48701825 -.48701825 -.77777208 | rep78#| c.weight#| c.mpg | 2 | -1.4648831 -1.4648831 -2.3394302 3 | .23523988 .23523988 .37568 4 | .7134117 .7134117 1.1393243 5 | (omitted) (omitted) (omitted) | _cons | -11169.843 -2069.3845 -.71053286 ----------------------------------------------------------- . . * #11 BWilliams : control charts . clear . input VisitID str12 MonthYear AbxYes VisitID MonthYear AbxYes 1. 1 2013m5 0 2. 2 2013m11 1 3. 3 2010m8 1 4. 4 2012m8 0 5. 5 2011m2 0 6. 6 2011m5 0 7. 7 2012m5 0 8. 8 2012m9 0 9. 9 2013m2 1 10. 10 2013m5 0 11. 11 2010m7 1 12. 12 2012m3 0 13. 13 2012m2 0 14. 14 2012m11 0 15. 15 2013m2 0 16. 16 2013m5 0 17. end . . * #12 Childs : data workflow with Stata and Python . . * #13 Blevins : dist-free estimation of heteroskedastic binary response models . which dfbr C:\Users\ehudes\My Documents\My Documents on C\ado\stbplus\d\dfbr.ado *! version 1.1.0 2012-11-30 *! Distribution free estimation of heteroskedastic binary response models *! Jason R. Blevins and Shakeeb Khan . search moremata . which locreg C:\Users\ehudes\My Documents\My Documents on C\ado\stbplus\l\locreg.ado *! version 2.1.8 12feb2010 Markus Froelich and Blaise Melly . which ivqte C:\Users\ehudes\My Documents\My Documents on C\ado\stbplus\i\ivqte.ado *! version 2.1.15 17feb2010 Markus Froelich and Blaise Melly . ssc install moremata checking moremata consistency and verifying not already installed... all files already exist and are up to date. . ssc install moremata, replace checking moremata consistency and verifying not already installed... all files already exist and are up to date. . net install dfbr, from(http://jblevins.org/) checking dfbr consistency and verifying not already installed... all files already exist and are up to date. . which dfbr C:\Users\ehudes\My Documents\My Documents on C\ado\stbplus\d\dfbr.ado *! version 1.1.0 2012-11-30 *! Distribution free estimation of heteroskedastic binary response models *! Jason R. Blevins and Shakeeb Khan . help dfbr . . * #14 Akhtar-Danesh : Markov-switching regression models . which rcsgen C:\Users\ehudes\My Documents\My Documents on C\ado\stbplus\r\rcsgen.ado *! version 1.5.7 25jun2015 . search rcsgen . which rcsgen C:\Users\ehudes\My Documents\My Documents on C\ado\stbplus\r\rcsgen.ado *! version 1.5.7 25jun2015 . which rcsgen_example C:\Users\ehudes\My Documents\My Documents on C\ado\stbplus\r\rcsgen_example.ado . clear . rcsgen_example 1 (1978 Automobile Data) Variables rcs1 to rcs3 were created Source | SS df MS Number of obs = 74 -------------+---------------------------------- F(3, 70) = 48.82 Model | 1653.29883 3 551.099611 Prob > F = 0.0000 Residual | 790.160626 70 11.2880089 R-squared = 0.6766 -------------+---------------------------------- Adj R-squared = 0.6628 Total | 2443.45946 73 33.4720474 Root MSE = 3.3598 ------------------------------------------------------------------------------ mpg | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- rcs1 | -.0107974 .0027735 -3.89 0.000 -.016329 -.0052658 rcs2 | -3.27e-09 3.25e-09 -1.01 0.317 -9.75e-09 3.20e-09 rcs3 | 1.75e-09 2.59e-09 0.67 0.502 -3.42e-09 6.91e-09 _cons | 49.96475 6.008402 8.32 0.000 37.98137 61.94813 ------------------------------------------------------------------------------ note: confidence intervals calculated using t(70) critical values . rcsgen_example 2 (German breast cancer data) failure event: censrec == 1 obs. time interval: (0, rectime] exit on or before: failure ------------------------------------------------------------------------------ 686 total observations 0 exclusions ------------------------------------------------------------------------------ 686 observations remaining, representing 299 failures in single-record/single-failure data 771400 total analysis time at risk and under observation at risk from t = 0 earliest observed entry t = 0 last observed exit t = 2659 Variables agercs1 to agercs3 were created failure _d: censrec == 1 analysis time _t: rectime Iteration 0: log likelihood = -1788.1731 Iteration 1: log likelihood = -1774.9862 Iteration 2: log likelihood = -1772.3726 Iteration 3: log likelihood = -1772.3006 Iteration 4: log likelihood = -1772.3006 Refining estimates: Iteration 0: log likelihood = -1772.3006 Cox regression -- Breslow method for ties No. of subjects = 686 Number of obs = 686 No. of failures = 299 Time at risk = 771400 LR chi2(4) = 31.75 Log likelihood = -1772.3006 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ _t | Haz. Ratio Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- agercs1 | .8640753 .0242883 -5.20 0.000 .8177587 .9130153 agercs2 | .9996048 .0001002 -3.95 0.000 .9994085 .9998011 agercs3 | 1.000397 .000114 3.48 0.001 1.000173 1.00062 hormon | .6609958 .0848601 -3.22 0.001 .5139485 .8501154 ------------------------------------------------------------------------------ note: confidence intervals calculated using Z critical values . search partpred . rcsgen_example 2 (German breast cancer data) failure event: censrec == 1 obs. time interval: (0, rectime] exit on or before: failure ------------------------------------------------------------------------------ 686 total observations 0 exclusions ------------------------------------------------------------------------------ 686 observations remaining, representing 299 failures in single-record/single-failure data 771400 total analysis time at risk and under observation at risk from t = 0 earliest observed entry t = 0 last observed exit t = 2659 Variables agercs1 to agercs3 were created failure _d: censrec == 1 analysis time _t: rectime Iteration 0: log likelihood = -1788.1731 Iteration 1: log likelihood = -1774.9862 Iteration 2: log likelihood = -1772.3726 Iteration 3: log likelihood = -1772.3006 Iteration 4: log likelihood = -1772.3006 Refining estimates: Iteration 0: log likelihood = -1772.3006 Cox regression -- Breslow method for ties No. of subjects = 686 Number of obs = 686 No. of failures = 299 Time at risk = 771400 LR chi2(4) = 31.75 Log likelihood = -1772.3006 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ _t | Haz. Ratio Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- agercs1 | .8640753 .0242883 -5.20 0.000 .8177587 .9130153 agercs2 | .9996048 .0001002 -3.95 0.000 .9994085 .9998011 agercs3 | 1.000397 .000114 3.48 0.001 1.000173 1.00062 hormon | .6609958 .0848601 -3.22 0.001 .5139485 .8501154 ------------------------------------------------------------------------------ note: confidence intervals calculated using Z critical values . which partpred_examples C:\Users\ehudes\My Documents\My Documents on C\ado\stbplus\p\partpred_examples.ado . partpred_examples 1 . webuse brcancer (German breast cancer data) . stset rectime, failure(censrec=1) scale(365.25) failure event: censrec == 1 obs. time interval: (0, rectime] exit on or before: failure t for analysis: time/365.25 ------------------------------------------------------------------------------ 686 total observations 0 exclusions ------------------------------------------------------------------------------ 686 observations remaining, representing 299 failures in single-record/single-failure data 2111.978 total analysis time at risk and under observation at risk from t = 0 earliest observed entry t = 0 last observed exit t = 7.279945 . gen age = x1 . gen age2 = age^2 . stcox age age2 hormon failure _d: censrec == 1 analysis time _t: rectime/365.25 Iteration 0: log likelihood = -1788.1731 Iteration 1: log likelihood = -1779.3911 Iteration 2: log likelihood = -1779.189 Iteration 3: log likelihood = -1779.1887 Refining estimates: Iteration 0: log likelihood = -1779.1887 Cox regression -- Breslow method for ties No. of subjects = 686 Number of obs = 686 No. of failures = 299 Time at risk = 2111.978097 LR chi2(3) = 17.97 Log likelihood = -1779.1887 Prob > chi2 = 0.0004 ------------------------------------------------------------------------------ _t | Haz. Ratio Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- age | .86758 .0385239 -3.20 0.001 .7952668 .9464685 age2 | 1.00134 .0004182 3.21 0.001 1.000521 1.00216 hormon | .6850356 .0881101 -2.94 0.003 .5323908 .8814461 ------------------------------------------------------------------------------ . partpred hr_age, for(age age2) ref(age 60 age2 3600) ci(hr_age_lci hr_age_uci) eform note: confidence intervals calculated using Z critical values . twoway (rarea hr_age_lci hr_age_uci age, sort pstyle(ci)) (line hr_age age, sort) , legend(off) xtitle( > age) ytitle(Hazard Ratio) . partpred_examples 2 . webuse brcancer (German breast cancer data) . stset rectime, failure(censrec=1) scale(365.25) failure event: censrec == 1 obs. time interval: (0, rectime] exit on or before: failure t for analysis: time/365.25 ------------------------------------------------------------------------------ 686 total observations 0 exclusions ------------------------------------------------------------------------------ 686 observations remaining, representing 299 failures in single-record/single-failure data 2111.978 total analysis time at risk and under observation at risk from t = 0 earliest observed entry t = 0 last observed exit t = 7.279945 . gen age = x1 . gen age2 = age^2 . stcox (c.age c.age2)##hormon failure _d: censrec == 1 analysis time _t: rectime/365.25 Iteration 0: log likelihood = -1788.1731 Iteration 1: log likelihood = -1778.0689 Iteration 2: log likelihood = -1774.2487 Iteration 3: log likelihood = -1774.1378 Iteration 4: log likelihood = -1774.1376 Refining estimates: Iteration 0: log likelihood = -1774.1376 Cox regression -- Breslow method for ties No. of subjects = 686 Number of obs = 686 No. of failures = 299 Time at risk = 2111.978097 LR chi2(5) = 28.07 Log likelihood = -1774.1376 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------- _t | Haz. Ratio Std. Err. z P>|z| [95% Conf. Interval] --------------+---------------------------------------------------------------- age | .7963818 .0387126 -4.68 0.000 .7240089 .8759892 age2 | 1.002176 .0004669 4.67 0.000 1.001262 1.003092 1.hormon | .0000989 .0003166 -2.88 0.004 1.86e-07 .0525852 | hormon#c.age | 1 | 1.408267 .1671809 2.88 0.004 1.115926 1.777192 | hormon#c.age2 | 1 | .9968092 .0010816 -2.95 0.003 .9946915 .9989314 ------------------------------------------------------------------------------- . partpred hr_hormon if hormon==1, for(1.hormon 1.hormon#c.age 1.hormon#c.age2) ci(hr_hormon_lci hr_hormo > n_uci) eform (440 missing values generated) note: confidence intervals calculated using Z critical values . twoway (rarea hr_hormon_lci hr_hormon_uci age, sort pstyle(ci)) (line hr_hormon age, sort) , legend(off > ) xtitle(age) ytitle(Hazard Ratio) . . * #15 Rajbhandari - Estimating Markov-switching regression models . which mswitch // StataCorp command C:\Program Files (x86)\Stata14\ado\base\m\mswitch.ado *! version 1.1.0 05sep2014 . search hamilton . search gnp . use http://www.stata-press.com/data/r14/rgnp.dta, clear (Data from Hamilton (1989)) . mswitch ar rgnp, ar(1/4) nolog Performing EM optimization: Performing gradient-based optimization: Markov-switching autoregression Sample: 1952q2 - 1984q4 No. of obs = 131 Number of states = 2 AIC = 2.9048 Unconditional probabilities: transition HQIC = 2.9851 SBIC = 3.1023 Log likelihood = -181.26339 ------------------------------------------------------------------------------ rgnp | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- rgnp | ar | L1. | .0134871 .1199941 0.11 0.911 -.2216971 .2486713 L2. | -.0575212 .137663 -0.42 0.676 -.3273357 .2122933 L3. | -.2469833 .1069103 -2.31 0.021 -.4565235 -.037443 L4. | -.2129214 .1105311 -1.93 0.054 -.4295583 .0037155 -------------+---------------------------------------------------------------- State1 | _cons | -.3588127 .2645396 -1.36 0.175 -.8773007 .1596753 -------------+---------------------------------------------------------------- State2 | _cons | 1.163517 .0745187 15.61 0.000 1.017463 1.309571 -------------+---------------------------------------------------------------- sigma | .7690048 .0667396 .6487179 .9115957 -------------+---------------------------------------------------------------- p11 | .754671 .0965189 .5254555 .8952432 -------------+---------------------------------------------------------------- p21 | .0959153 .0377362 .0432569 .1993221 ------------------------------------------------------------------------------ . . * #16 Cox : Betweenc and beyond - irregular series, interpolation, variograms, smoothing . search mipolate . search variogram . which variog C:\Users\ehudes\My Documents\My Documents on C\ado\stbplus\v\variog.ado *! 3.0.0 NJC 4 March 2005 . which variog2 C:\Users\ehudes\My Documents\My Documents on C\ado\stbplus\v\variog2.ado *! 1.0.0 NJC 4 March 2005 . capture noi which vgram command vgram not found as either built-in or ado-file . * not yet posted! . webuse air2 (TIMESLAB: Airline passengers) . sum Variable | Obs Mean Std. Dev. Min Max -------------+--------------------------------------------------------- air | 144 280.2986 119.9663 104 622 time | 144 1954.958 3.476109 1949 1960.917 t | 144 72.5 41.71331 1 144 . variog air . help variog . variog air, recast(connected) xlabel(0(12)72) . des Contains data from http://www.stata-press.com/data/r14/air2.dta obs: 144 TIMESLAB: Airline passengers vars: 3 3 Mar 2014 10:01 size: 1,440 --------------------------------------------------------------------------------------------------------- storage display value variable name type format label variable label --------------------------------------------------------------------------------------------------------- air int %8.0g Airline Passengers (1949-1960) time float %9.0g Time (in months) t float %9.0g --------------------------------------------------------------------------------------------------------- Sorted by: t . poisson air time Iteration 0: log likelihood = -955.65639 Iteration 1: log likelihood = -955.65625 Iteration 2: log likelihood = -955.65625 Poisson regression Number of obs = 144 LR chi2(1) = 6368.32 Prob > chi2 = 0.0000 Log likelihood = -955.65625 Pseudo R2 = 0.7692 ------------------------------------------------------------------------------ air | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- time | .1174735 .001508 77.90 0.000 .1145179 .1204291 _cons | -224.1014 2.950097 -75.96 0.000 -229.8835 -218.3193 ------------------------------------------------------------------------------ . predict yhat (option n assumed; predicted number of events) . scatter air time, sort || line yhat time, sort . gen resid = air-yhat . label var resid "response residual" . variog resid . sum air Variable | Obs Mean Std. Dev. Min Max -------------+--------------------------------------------------------- air | 144 280.2986 119.9663 104 622 . sum resid Variable | Obs Mean Std. Dev. Min Max -------------+--------------------------------------------------------- resid | 144 1.06e-06 45.63855 -125.1975 126.589 . ret list scalars: r(N) = 144 r(sum_w) = 144 r(mean) = 1.05963812934e-06 r(Var) = 2082.877120804578 r(sd) = 45.63854862727975 r(min) = -125.197509765625 r(max) = 126.5889892578125 r(sum) = .000152587890625 . gen resid_var = r(Var) . sum res* Variable | Obs Mean Std. Dev. Min Max -------------+--------------------------------------------------------- resid | 144 1.06e-06 45.63855 -125.1975 126.589 resid_var | 144 2082.877 0 2082.877 2082.877 . scatter air time, sort || line yhat time, sort . variog resid . . * #17 Frazier : Public program sensitivity -- ROC cureves, classification effciency of state Medicaid . . * #18 Yang : Small sample inference with linear mixed-effects models . use http://www.stata-press.com/data/r14/t43.dta, clear (T4.3 -- Winer, Brown, Michels) . tabdisp person drug, cellvar(score) ---------------------------------- | drug person | 1 2 3 4 ----------+----------------------- 1 | 30 28 16 34 2 | 14 18 10 22 3 | 24 20 18 30 4 | 38 34 20 44 5 | 26 28 14 30 ---------------------------------- . anova score person drug, repeated(drug) Number of obs = 20 R-squared = 0.9244 Root MSE = 3.06594 Adj R-squared = 0.8803 Source | Partial SS df MS F Prob>F -----------+---------------------------------------------------- Model | 1379 7 197 20.96 0.0000 | person | 680.8 4 170.2 18.11 0.0001 drug | 698.2 3 232.73333 24.76 0.0000 | Residual | 112.8 12 9.4 -----------+---------------------------------------------------- Total | 1491.8 19 78.515789 Between-subjects error term: person Levels: 5 (4 df) Lowest b.s.e. variable: person Repeated variable: drug Huynh-Feldt epsilon = 1.0789 *Huynh-Feldt epsilon reset to 1.0000 Greenhouse-Geisser epsilon = 0.6049 Box's conservative epsilon = 0.3333 ------------ Prob > F ------------ Source | df F Regular H-F G-G Box -----------+---------------------------------------------------- drug | 3 24.76 0.0000 0.0000 0.0006 0.0076 Residual | 12 ---------------------------------------------------------------- . mixed score i.drug || person:, reml Performing EM optimization: Performing gradient-based optimization: Iteration 0: log restricted-likelihood = -49.640099 Iteration 1: log restricted-likelihood = -49.640099 Computing standard errors: Mixed-effects REML regression Number of obs = 20 Group variable: person Number of groups = 5 Obs per group: min = 4 avg = 4.0 max = 4 Wald chi2(3) = 74.28 Log restricted-likelihood = -49.640099 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ score | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- drug | 2 | -.8 1.939072 -0.41 0.680 -4.600511 3.000511 3 | -10.8 1.939072 -5.57 0.000 -14.60051 -6.999489 4 | 5.6 1.939072 2.89 0.004 1.799489 9.400511 | _cons | 26.4 3.149604 8.38 0.000 20.22689 32.57311 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ person: Identity | var(_cons) | 40.20004 30.10272 9.264606 174.4319 -----------------------------+------------------------------------------------ var(Residual) | 9.399997 3.837532 4.22305 20.92325 ------------------------------------------------------------------------------ LR test vs. linear model: chibar2(01) = 15.03 Prob >= chibar2 = 0.0001 . mixed score i.drug || person:, reml dfmethod(repeated) Performing EM optimization: Performing gradient-based optimization: Iteration 0: log restricted-likelihood = -49.640099 Iteration 1: log restricted-likelihood = -49.640099 Computing standard errors: Computing degrees of freedom: Mixed-effects REML regression Number of obs = 20 Group variable: person Number of groups = 5 Obs per group: min = 4 avg = 4.0 max = 4 DF method: Repeated DF: min = 4.00 avg = 10.00 max = 12.00 F(3, 12.00) = 24.76 Log restricted-likelihood = -49.640099 Prob > F = 0.0000 ------------------------------------------------------------------------------ score | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- drug | 2 | -.8 1.939072 -0.41 0.687 -5.024874 3.424874 3 | -10.8 1.939072 -5.57 0.000 -15.02487 -6.575126 4 | 5.6 1.939072 2.89 0.014 1.375126 9.824874 | _cons | 26.4 3.149604 8.38 0.001 17.6553 35.1447 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ person: Identity | var(_cons) | 40.20004 30.10272 9.264606 174.4319 -----------------------------+------------------------------------------------ var(Residual) | 9.399997 3.837532 4.22305 20.92325 ------------------------------------------------------------------------------ LR test vs. linear model: chibar2(01) = 15.03 Prob >= chibar2 = 0.0001 . mixed , dftable(pvalue) Mixed-effects REML regression Number of obs = 20 Group variable: person Number of groups = 5 Obs per group: min = 4 avg = 4.0 max = 4 DF method: Repeated DF: min = 4.00 avg = 10.00 max = 12.00 F(3, 12.00) = 24.76 Log restricted-likelihood = -49.640099 Prob > F = 0.0000 ------------------------------------------------------------------- score | Coef. Std. Err. DF t P>|t| -------------+----------------------------------------------------- drug | 2 | -.8 1.939072 12.0 -0.41 0.687 3 | -10.8 1.939072 12.0 -5.57 0.000 4 | 5.6 1.939072 12.0 2.89 0.014 | _cons | 26.4 3.149604 4.0 8.38 0.001 ------------------------------------------------------------------- ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ person: Identity | var(_cons) | 40.20004 30.10272 9.264606 174.4319 -----------------------------+------------------------------------------------ var(Residual) | 9.399997 3.837532 4.22305 20.92325 ------------------------------------------------------------------------------ LR test vs. linear model: chibar2(01) = 15.03 Prob >= chibar2 = 0.0001 . estat df Degrees of freedom ------------------------ | Repeated -------------+---------- score | drug | 1 | (empty) 2 | 12 3 | 12 4 | 12 | _cons | 4 ------------------------ . . use http://www.stata-press.com/data/r14/vptscores.dta (Vigilance Performance Test Scores With Missing Data) . sum Variable | Obs Mean Std. Dev. Min Max -------------+--------------------------------------------------------- score | 30 5.133333 2.661777 1 11 signal | 32 1.5 .5080005 1 2 hour | 32 2.5 1.135924 1 4 subject | 32 4.5 2.327951 1 8 . tabdisp hour subject , cellvar(score) by(signal) concise ---------------------------------------------------------- Signal | and | Monitorin | Subject ID g period | 1 2 3 4 5 6 7 8 ----------+----------------------------------------------- Auditory | 1 | 3 6 3 3 2 | 4 5 4 3 3 | 7 7 6 4 | 7 8 9 8 ----------+----------------------------------------------- Visual | 1 | 1 2 2 2 2 | 2 3 4 3 3 | 5 6 5 6 4 | 10 9 11 ---------------------------------------------------------- . * bingo! this is example 3 from 18.yang . * b s y a . * hour subject score signal . gen b=hour . gen s=subject . gen y=score (2 missing values generated) . gen a=signal . mixed y a##b || s:, reml Performing EM optimization: Performing gradient-based optimization: Iteration 0: log restricted-likelihood = -32.972532 Iteration 1: log restricted-likelihood = -32.9724 Iteration 2: log restricted-likelihood = -32.9724 Computing standard errors: Mixed-effects REML regression Number of obs = 30 Group variable: s Number of groups = 8 Obs per group: min = 3 avg = 3.8 max = 4 Wald chi2(7) = 321.61 Log restricted-likelihood = -32.9724 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ y | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- 2.a | -2 .6288677 -3.18 0.001 -3.232558 -.767442 | b | 2 | .25 .5359916 0.47 0.641 -.8005243 1.300524 3 | 3.108222 .5862035 5.30 0.000 1.959284 4.25716 4 | 4.25 .5359916 7.93 0.000 3.199476 5.300524 | a#b | 2 2 | 1 .7580066 1.32 0.187 -.4856656 2.485666 2 3 | .6417778 .7943057 0.81 0.419 -.9150328 2.198588 2 4 | 4.044205 .7943057 5.09 0.000 2.487395 5.601016 | _cons | 3.75 .4446766 8.43 0.000 2.87845 4.62155 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ s: Identity | var(_cons) | .2163751 .2345718 .0258477 1.811312 -----------------------------+------------------------------------------------ var(Residual) | .574574 .2062107 .2843515 1.161011 ------------------------------------------------------------------------------ LR test vs. linear model: chibar2(01) = 1.55 Prob >= chibar2 = 0.1069 . estat df, method(residual repeated anova satt kroger) Degrees of freedom ---------------------------------------------------------------------------- | Residual Repeated ANOVA Satterthwaite Kenward-Roger -------------+-------------------------------------------------------------- y | a | 1 | (empty) 2 | 22 6 16 18.29179 18.29179 | b | 1 | (empty) 2 | 22 16 16 16.01983 16.01983 3 | 22 16 16 16.66069 16.66069 4 | 22 16 16 16.01983 16.01983 | a#b | 1 1 | (empty) 1 2 | (empty) 1 3 | (empty) 1 4 | (empty) 2 1 | (empty) 2 2 | 22 16 16 16.01983 16.01983 2 3 | 22 16 16 16.36871 16.36871 2 4 | 22 16 16 16.36871 16.36871 | _cons | 22 6 7 18.29179 18.29179 ---------------------------------------------------------------------------- . estat df, method(kroger) post Degrees of freedom ---------------------------- | Kenward-Roger -------------+-------------- y | a | 1 | (empty) 2 | 18.29179 | b | 1 | (empty) 2 | 16.01983 3 | 16.66069 4 | 16.01983 | a#b | 1 1 | (empty) 1 2 | (empty) 1 3 | (empty) 1 4 | (empty) 2 1 | (empty) 2 2 | 16.01983 2 3 | 16.36871 2 4 | 16.36871 | _cons | 18.29179 ---------------------------- . mixed y a##b || s:, reml dfmethod(kroger) Performing EM optimization: Performing gradient-based optimization: Iteration 0: log restricted-likelihood = -32.972532 Iteration 1: log restricted-likelihood = -32.9724 Iteration 2: log restricted-likelihood = -32.9724 Computing standard errors: Computing degrees of freedom: Mixed-effects REML regression Number of obs = 30 Group variable: s Number of groups = 8 Obs per group: min = 3 avg = 3.8 max = 4 DF method: Kenward-Roger DF: min = 16.02 avg = 16.76 max = 18.29 F(7, 16.08) = 43.84 Log restricted-likelihood = -32.9724 Prob > F = 0.0000 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- 2.a | -2 .6288677 -3.18 0.005 -3.319693 -.6803071 | b | 2 | .25 .5359916 0.47 0.647 -.8861371 1.386137 3 | 3.108222 .5911044 5.26 0.000 1.859163 4.357281 4 | 4.25 .5359916 7.93 0.000 3.113863 5.386137 | a#b | 2 2 | 1 .7580066 1.32 0.206 -.6067405 2.606741 2 3 | .6417778 .7979294 0.80 0.433 -1.046666 2.330221 2 4 | 4.044205 .7979294 5.07 0.000 2.355762 5.732649 | _cons | 3.75 .4446766 8.43 0.000 2.816836 4.683164 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ s: Identity | var(_cons) | .2163751 .2345718 .0258477 1.811312 -----------------------------+------------------------------------------------ var(Residual) | .574574 .2062107 .2843515 1.161011 ------------------------------------------------------------------------------ LR test vs. linear model: chibar2(01) = 1.55 Prob >= chibar2 = 0.1069 . test 2.a, small ( 1) [y]2.a = 0 F( 1, 18.29) = 10.11 Prob > F = 0.0051 . testparm a#b, small ( 1) [y]2.a#2.b = 0 ( 2) [y]2.a#3.b = 0 ( 3) [y]2.a#4.b = 0 F( 3, 16.35) = 9.66 Prob > F = 0.0007 . lincom 2.a+2.a#4.b ( 1) [y]2.a + [y]2.a#4.b = 0 ------------------------------------------------------------------------------ y | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | 2.044205 .6721771 3.04 0.002 .7267621 3.361648 ------------------------------------------------------------------------------ . lincom 2.a+2.a#4.b, small ( 1) [y]2.a + [y]2.a#4.b = 0 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | 2.044205 .6764554 3.02 0.007 .6311736 3.457237 ------------------------------------------------------------------------------ . contrast a Contrasts of marginal linear predictions Margins : asbalanced ------------------------------------------------ | df chi2 P>chi2 -------------+---------------------------------- y | a | 1 1.79 0.1810 ------------------------------------------------ . contrast a, small Contrasts of marginal linear predictions Margins : asbalanced ----------------------------------------------------------- | df ddf F P>F -------------+--------------------------------------------- y | a | 1 5.95 1.78 0.2307 ----------------------------------------------------------- . test 2.a, small ( 1) [y]2.a = 0 F( 1, 18.29) = 10.11 Prob > F = 0.0051 . testparm 2.a a#b, small ( 1) [y]2.a = 0 ( 2) [y]2.a#2.b = 0 ( 3) [y]2.a#3.b = 0 ( 4) [y]2.a#4.b = 0 F( 4, 15.38) = 7.42 Prob > F = 0.0016 . test 2.a+2.a#2.b+2.a#3.b+2.a#4.b=0, small ( 1) [y]2.a + [y]2.a#2.b + [y]2.a#3.b + [y]2.a#4.b = 0 F( 1, 18.85) = 6.06 Prob > F = 0.0237 . // why are we using .25 for the interaction terms coefficients? . test 2.a + .25*[y]2.a#2.b + .25*[y]2.a#3.b + .25*[y]2.a#4.b = 0, small ( 1) [y]2.a + .25*[y]2.a#2.b + .25*[y]2.a#3.b + .25*[y]2.a#4.b = 0 F( 1, 5.95) = 1.78 Prob > F = 0.2307 . test 2.a + .25*2.a#2.b + .25*2.a#3.b + .25*2.a#4.b = 0, small ( 1) [y]2.a + .25*[y]2.a#2.b + .25*[y]2.a#3.b + .25*[y]2.a#4.b = 0 F( 1, 5.95) = 1.78 Prob > F = 0.2307 . * last is ok. [y] not necessary . contrast a Contrasts of marginal linear predictions Margins : asbalanced ------------------------------------------------ | df chi2 P>chi2 -------------+---------------------------------- y | a | 1 1.79 0.1810 ------------------------------------------------ . contrast a , small Contrasts of marginal linear predictions Margins : asbalanced ----------------------------------------------------------- | df ddf F P>F -------------+--------------------------------------------- y | a | 1 5.95 1.78 0.2307 ----------------------------------------------------------- . * so -contrast, small- works!!! . mat list r(table) r(table)[9,1] y: 2. a b -.57850427 se .43332895 t -1.3350233 pvalue .23070162 ll -1.6411295 ul .48412101 df 5.9467098 crit 2.452237 eform 0 . mixed y a##b || s:, reml dfmethod(kroger) Performing EM optimization: Performing gradient-based optimization: Iteration 0: log restricted-likelihood = -32.972532 Iteration 1: log restricted-likelihood = -32.9724 Iteration 2: log restricted-likelihood = -32.9724 Computing standard errors: Computing degrees of freedom: Mixed-effects REML regression Number of obs = 30 Group variable: s Number of groups = 8 Obs per group: min = 3 avg = 3.8 max = 4 DF method: Kenward-Roger DF: min = 16.02 avg = 16.76 max = 18.29 F(7, 16.08) = 43.84 Log restricted-likelihood = -32.9724 Prob > F = 0.0000 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- 2.a | -2 .6288677 -3.18 0.005 -3.319693 -.6803071 | b | 2 | .25 .5359916 0.47 0.647 -.8861371 1.386137 3 | 3.108222 .5911044 5.26 0.000 1.859163 4.357281 4 | 4.25 .5359916 7.93 0.000 3.113863 5.386137 | a#b | 2 2 | 1 .7580066 1.32 0.206 -.6067405 2.606741 2 3 | .6417778 .7979294 0.80 0.433 -1.046666 2.330221 2 4 | 4.044205 .7979294 5.07 0.000 2.355762 5.732649 | _cons | 3.75 .4446766 8.43 0.000 2.816836 4.683164 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ s: Identity | var(_cons) | .2163751 .2345718 .0258477 1.811312 -----------------------------+------------------------------------------------ var(Residual) | .574574 .2062107 .2843515 1.161011 ------------------------------------------------------------------------------ LR test vs. linear model: chibar2(01) = 1.55 Prob >= chibar2 = 0.1069 . scalar m1 = e(ll) . mixed y b || s:, reml dfmethod(kroger) Performing EM optimization: Performing gradient-based optimization: Iteration 0: log restricted-likelihood = -50.2296 Iteration 1: log restricted-likelihood = -50.098308 Iteration 2: log restricted-likelihood = -50.098222 Iteration 3: log restricted-likelihood = -50.098222 Computing standard errors: Computing degrees of freedom: Mixed-effects REML regression Number of obs = 30 Group variable: s Number of groups = 8 Obs per group: min = 3 avg = 3.8 max = 4 DF method: Kenward-Roger DF: min = 21.75 avg = 24.52 max = 27.30 F(1, 21.75) = 96.95 Log restricted-likelihood = -50.098222 Prob > F = 0.0000 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- b | 2.067797 .2100074 9.85 0.000 1.631973 2.50362 _cons | .1016949 .5604342 0.18 0.857 -1.047625 1.251014 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ s: Identity | var(_cons) | 2.51e-21 3.58e-20 1.72e-33 3.65e-09 -----------------------------+------------------------------------------------ var(Residual) | 1.631961 .4361601 .9665328 2.755517 ------------------------------------------------------------------------------ LR test vs. linear model: chibar2(01) = 0.00 Prob >= chibar2 = 1.0000 . scalar m2 = e(ll) . di m1 -32.9724 . di m2 -50.098222 . di m1-m2 17.125822 . . * #19 Snyder : Project-based statistics course for applied biostatistics . // Acock "A gentle intro to Stata" (4th ed., 2014) . // HM Bush (2012) Biostatistics: an applied into to practioners . . * #20 Buchanan : Color schemes in Stata - . search brewscheme . which brewscheme C:\Users\ehudes\My Documents\My Documents on C\ado\stbplus\b\brewscheme.ado *! brewscheme *! v 0.0.11 *! 08NOV2015 . . * #21 Lopez Pineda : Colombian industrial structure 1974-2005 . // panel data analysis . . exit end of do-file name: log: C:\Users\ehudes\Documents\My Documents on C\Methods Core\2015\2015_StataConference\StataConf > Columbus2015.log log type: text closed on: 14 Dec 2015, 11:40:48 ---------------------------------------------------------------------------------------------------------