Actual StataMP numerical output. Log header and machine paths omitted. . * BEGIN distributed . newey logacc unem L(1/2).unem trend i.month, lag(4) Regression with Newey–West standard errors Number of obs = 106 Maximum lag = 4 F( 15, 90) = 20.39 Prob > F = 0.0000 ------------------------------------------------------------------------------ | Newey–West logacc | Coefficient std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- unem | --. | -.0218345 .0073752 -2.96 0.004 -.0364866 -.0071823 L1. | -.0027711 .0075824 -0.37 0.716 -.0178349 .0122927 L2. | .0028242 .0079337 0.36 0.723 -.0129375 .0185858 | trend | .0018359 .0002514 7.30 0.000 .0013365 .0023352 | month | 2 | -.0278513 .0173526 -1.61 0.112 -.0623254 .0066228 3 | .0858646 .0211742 4.06 0.000 .0437983 .1279309 4 | .0161909 .0224788 0.72 0.473 -.0284671 .060849 5 | .024709 .0236216 1.05 0.298 -.0222195 .0716375 6 | .0199826 .0238524 0.84 0.404 -.0274043 .0673695 7 | .0517578 .0243261 2.13 0.036 .0034297 .1000858 8 | .0574206 .0247672 2.32 0.023 .0082163 .106625 9 | .0372946 .0256213 1.46 0.149 -.0136065 .0881957 10 | .0792432 .0234326 3.38 0.001 .0326903 .1257961 11 | .0723805 .0203447 3.56 0.001 .0319622 .1127987 12 | .0954734 .026761 3.57 0.001 .0423079 .1486388 | _cons | 10.67207 .0367848 290.12 0.000 10.59899 10.74515 ------------------------------------------------------------------------------ . * END distributed . record impact unem . record lag1 L.unem . record lag2 L2.unem . * BEGIN cumulative . lincom unem+L.unem+L2.unem ( 1) unem + L.unem + L2.unem = 0 ------------------------------------------------------------------------------ logacc | Coefficient Std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- (1) | -.0217814 .004154 -5.24 0.000 -.0300341 -.0135287 ------------------------------------------------------------------------------ . * END cumulative . * BEGIN persistence . newey logacc L.logacc trend i.month, lag(4) Regression with Newey–West standard errors Number of obs = 107 Maximum lag = 4 F( 13, 93) = 89.01 Prob > F = 0.0000 ------------------------------------------------------------------------------ | Newey–West logacc | Coefficient std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- logacc | L1. | .6783359 .0825587 8.22 0.000 .5143906 .8422811 | trend | .0009218 .0002548 3.62 0.000 .0004158 .0014278 | month | 2 | .0483082 .0297704 1.62 0.108 -.01081 .1074264 3 | .1997367 .0275006 7.26 0.000 .1451259 .2543474 4 | .0552554 .0260082 2.12 0.036 .0036083 .1069026 5 | .1104394 .0284036 3.89 0.000 .0540355 .1668434 6 | .0892604 .0262674 3.40 0.001 .0370985 .1414224 7 | .1146895 .0273063 4.20 0.000 .0604647 .1689143 8 | .1192549 .0261609 4.56 0.000 .0673045 .1712053 9 | .0964702 .0260498 3.70 0.000 .0447404 .1482 10 | .1440678 .0263677 5.46 0.000 .0917067 .1964288 11 | .1062293 .0262052 4.05 0.000 .0541909 .1582677 12 | .1384194 .0333721 4.15 0.000 .0721489 .2046899 | _cons | 3.276324 .8753799 3.74 0.000 1.537993 5.014655 ------------------------------------------------------------------------------ . * END persistence . record persistence L.logacc . . postclose results . use "output/meeting_10_estimates.dta", clear . export delimited using "output/meeting_10_estimates.csv", replace (file output/meeting_10_estimates.csv not found) file output/meeting_10_estimates.csv saved . display "ECO603_MEETING_10_COMPLETE" ECO603_MEETING_10_COMPLETE Actual StataMP numerical output. Log header and machine paths omitted. . * BEGIN dynamic . newey logacc L.logacc trend i.month unem spdlaw beltlaw wkends, lag(4) Regression with Newey–West standard errors Number of obs = 107 Maximum lag = 4 F( 17, 89) = 87.90 Prob > F = 0.0000 ------------------------------------------------------------------------------ | Newey–West logacc | Coefficient std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- logacc | L1. | .3326578 .1071252 3.11 0.003 .1198023 .5455133 | trend | .0008893 .0002853 3.12 0.002 .0003223 .0014562 | month | 2 | .0146527 .0239401 0.61 0.542 -.0329158 .0622212 3 | .1430085 .0223102 6.41 0.000 .0986787 .1873384 4 | .038098 .017672 2.16 0.034 .002984 .073212 5 | .072244 .0204505 3.53 0.001 .0316094 .1128787 6 | .062745 .0200754 3.13 0.002 .0228557 .1026344 7 | .0893948 .0204455 4.37 0.000 .0487701 .1300196 8 | .0938234 .0183948 5.10 0.000 .0572734 .1303733 9 | .0761947 .017798 4.28 0.000 .0408305 .111559 10 | .1188968 .0206093 5.77 0.000 .0779465 .1598471 11 | .0991803 .0200293 4.95 0.000 .0593825 .1389781 12 | .1255027 .0242489 5.18 0.000 .0773206 .1736849 | unem | -.0125834 .0044189 -2.85 0.005 -.0213638 -.0038031 spdlaw | -.0414191 .0141509 -2.93 0.004 -.0695366 -.0133016 beltlaw | .0652123 .0154671 4.22 0.000 .0344794 .0959452 wkends | .0032099 .002814 1.14 0.257 -.0023815 .0088014 _cons | 7.018421 1.156725 6.07 0.000 4.720033 9.316809 ------------------------------------------------------------------------------ . * END dynamic . record dynamic L.logacc . record law beltlaw . * BEGIN prais . prais logacc trend i.month unem spdlaw beltlaw wkends Iteration 0: rho = 0.0000 Iteration 1: rho = 0.3553 Iteration 2: rho = 0.3819 Iteration 3: rho = 0.3855 Iteration 4: rho = 0.3860 Iteration 5: rho = 0.3861 Iteration 6: rho = 0.3861 Iteration 7: rho = 0.3861 Iteration 8: rho = 0.3861 Prais–Winsten AR(1) regression with iterated estimates Source | SS df MS Number of obs = 108 -------------+---------------------------------- F(16, 91) = 640.24 Model | 10.9813963 16 .686337271 Prob > F = 0.0000 Residual | .097552142 91 .001072002 R-squared = 0.9912 -------------+---------------------------------- Adj R-squared = 0.9896 Total | 11.0789485 107 .103541575 Root MSE = .03274 ------------------------------------------------------------------------------ logacc | Coefficient Std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- trend | .0009183 .000368 2.50 0.014 .0001874 .0016493 | month | 2 | -.0298558 .0139349 -2.14 0.035 -.0575357 -.0021759 3 | .0815099 .015585 5.23 0.000 .0505523 .1124675 4 | .0161941 .0167108 0.97 0.335 -.017 .0493881 5 | .0286477 .0170886 1.68 0.097 -.0052966 .0625921 6 | .0275122 .0171963 1.60 0.113 -.0066461 .0616706 7 | .054312 .0167468 3.24 0.002 .0210466 .0875774 8 | .0612811 .0169516 3.62 0.000 .0276088 .0949535 9 | .0487127 .0173537 2.81 0.006 .0142417 .0831836 10 | .088227 .0168678 5.23 0.000 .0547211 .1217328 11 | .0849744 .0163305 5.20 0.000 .0525358 .117413 12 | .1094368 .0143486 7.63 0.000 .080935 .1379385 | unem | -.019975 .0047144 -4.24 0.000 -.0293397 -.0106104 spdlaw | -.045256 .0179614 -2.52 0.013 -.080934 -.0095779 beltlaw | .1008944 .0201055 5.02 0.000 .0609572 .1408315 wkends | .0042874 .0028062 1.53 0.130 -.0012867 .0098615 _cons | 10.61796 .0628171 169.03 0.000 10.49318 10.74274 -------------+---------------------------------------------------------------- rho | .3861376 ------------------------------------------------------------------------------ Durbin–Watson statistic (original) = 1.200475 Durbin–Watson statistic (transformed) = 2.028900 . * END prais . record prais beltlaw . * A controlled quarterly simulation, not estimated inflation data. . clear . set seed 6031212 . set obs 440 Number of observations (_N) was 0, now 440. . generate quarter=tq(1960q1)+_n-1 . format quarter %tq . tsset quarter Time variable: quarter, 1960q1 to 2069q4 Delta: 1 quarter . generate double shock=rnormal() . generate double inflation=0 . forvalues i=2/440 { 2. quietly replace inflation=.6*inflation[_n-1]+.8*shock+rnormal() in `i' 3. } . keep in 201/440 (200 observations deleted) . tsset quarter Time variable: quarter, 2010q1 to 2069q4 Delta: 1 quarter . tempname lp . postfile `lp' horizon coefficient se using "output/meeting_12_lp.dta", replace (file output/meeting_12_lp.dta not found) . forvalues h=0/8 { 2. quietly newey F`h'.inflation shock L.inflation, lag(8) 3. post `lp' (`h') (_b[shock]) (_se[shock]) 4. } . postclose `lp' . * BEGIN projection . newey F4.inflation shock L.inflation, lag(8) Regression with Newey–West standard errors Number of obs = 235 Maximum lag = 8 F( 2, 232) = 2.50 Prob > F = 0.0842 ------------------------------------------------------------------------------ | Newey–West F4.inflation | Coefficient std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- shock | -.17841 .1013114 -1.76 0.080 -.3780179 .0211979 | inflation | L1. | .0652363 .0710399 0.92 0.359 -.0747295 .2052021 | _cons | -.2784281 .1669179 -1.67 0.097 -.6072968 .0504406 ------------------------------------------------------------------------------ . * END projection . record horizon4 shock . use "output/meeting_12_lp.dta", clear . export delimited using "output/meeting_12_lp.csv", replace (file output/meeting_12_lp.csv not found) file output/meeting_12_lp.csv saved . . postclose results . use "output/meeting_12_estimates.dta", clear . export delimited using "output/meeting_12_estimates.csv", replace (file output/meeting_12_estimates.csv not found) file output/meeting_12_estimates.csv saved . display "ECO603_MEETING_12_COMPLETE" ECO603_MEETING_12_COMPLETE Actual StataMP numerical output; machine-specific log header omitted. . * BEGIN audit . count 420 . summarize score str el income Variable | Obs Mean Std. dev. Min Max -------------+--------------------------------------------------------- score | 420 654.1565 19.05335 605.55 706.75 str | 420 19.64043 1.891812 14 25.8 el | 420 15.76816 18.28593 0 85.53972 income | 420 15.31659 7.22589 5.335 55.328 . count if el>20 118 . * END audit . * BEGIN normal_equations . regress score str Source | SS df MS Number of obs = 420 -------------+---------------------------------- F(1, 418) = 22.58 Model | 7794.11004 1 7794.11004 Prob > F = 0.0000 Residual | 144315.484 418 345.252353 R-squared = 0.0512 -------------+---------------------------------- Adj R-squared = 0.0490 Total | 152109.594 419 363.030056 Root MSE = 18.581 ------------------------------------------------------------------------------ score | Coefficient Std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- str | -2.279808 .4798256 -4.75 0.000 -3.22298 -1.336637 _cons | 698.933 9.467491 73.82 0.000 680.3231 717.5428 ------------------------------------------------------------------------------ . predict double fitted, xb . predict double residual, residuals . generate double xu=str*residual . summarize residual xu Variable | Obs Mean Std. dev. Min Max -------------+--------------------------------------------------------- residual | 420 6.28e-14 18.55878 -47.72669 48.54041 xu | 420 1.23e-12 361.342 -954.3068 867.0591 . quietly summarize score . scalar ybar=r(mean) . generate double total_sq=(score-ybar)^2 . generate double resid_sq=residual^2 . quietly summarize total_sq, meanonly . scalar sst=r(sum) . quietly summarize resid_sq, meanonly . scalar ssr=r(sum) . display "R2 reconstructed = " %12.9f 1-ssr/sst R2 reconstructed = 0.051240095 . assert abs(1-ssr/sst-e(r2))<1e-9 . * END normal_equations . * BEGIN precision . regress score str el income Source | SS df MS Number of obs = 420 -------------+---------------------------------- F(3, 416) = 334.89 Model | 107568.862 3 35856.2873 Prob > F = 0.0000 Residual | 44540.7318 416 107.069067 R-squared = 0.7072 -------------+---------------------------------- Adj R-squared = 0.7051 Total | 152109.594 419 363.030056 Root MSE = 10.347 ------------------------------------------------------------------------------ score | Coefficient Std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- str | -.0687755 .2769078 -0.25 0.804 -.6130885 .4755375 el | -.4882667 .0292832 -16.67 0.000 -.5458283 -.4307052 income | 1.494517 .0748334 19.97 0.000 1.347418 1.641616 _cons | 640.3155 5.774885 110.88 0.000 628.9639 651.6671 ------------------------------------------------------------------------------ . scalar full_b=_b[str] . scalar df=e(df_r) . scalar s2=e(rss)/df . display "Observations = " e(N) " parameters including intercept = " e(rank) Observations = 420 parameters including intercept = 4 . display "Residual degrees of freedom = " df " s-squared = " s2 Residual degrees of freedom = 416 s-squared = 107.06907 . estat vif Variable | VIF 1/VIF -------------+---------------------- income | 1.14 0.873929 el | 1.12 0.891206 str | 1.07 0.931159 -------------+---------------------- Mean VIF | 1.11 . * END precision . * BEGIN linear_contrast . lincom -2*str+5*el ( 1) - 2*str + 5*el = 0 ------------------------------------------------------------------------------ score | Coefficient Std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- (1) | -2.303783 .5903562 -3.90 0.000 -3.464236 -1.14333 ------------------------------------------------------------------------------ . * END linear_contrast . quietly regress score el income . predict double ry, residuals . quietly regress str el income . predict double rx, residuals . quietly regress ry rx, noconstant . assert abs(_b[rx]-full_b)<1e-9 . * BEGIN sample_size . set seed 6032711 . generate double subset_draw=runiform() . sort subset_draw observat . regress score str el if _n<=105, vce(robust) Linear regression Number of obs = 105 F(2, 102) = 66.11 Prob > F = 0.0000 R-squared = 0.4453 Root MSE = 14.315 ------------------------------------------------------------------------------ | Robust score | Coefficient std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- str | -.1764537 .6896493 -0.26 0.799 -1.54437 1.191462 el | -.6936553 .0606742 -11.43 0.000 -.8140022 -.5733083 _cons | 667.5091 14.19835 47.01 0.000 639.3467 695.6715 ------------------------------------------------------------------------------ . scalar small_b=_b[str] . scalar small_se=_se[str] . regress score str el, vce(robust) Linear regression Number of obs = 420 F(2, 417) = 223.82 Prob > F = 0.0000 R-squared = 0.4264 Root MSE = 14.464 ------------------------------------------------------------------------------ | Robust score | Coefficient std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- str | -1.101296 .4328472 -2.54 0.011 -1.95213 -.2504616 el | -.6497768 .0310318 -20.94 0.000 -.710775 -.5887786 _cons | 686.0322 8.728224 78.60 0.000 668.8754 703.189 ------------------------------------------------------------------------------ . scalar full_se=_se[str] . display "Observed SE ratio (105 / 420) = " small_se/full_se Observed SE ratio (105 / 420) = 1.5932859 . * END sample_size . clear . set obs 1 Number of observations (_N) was 0, now 1. . generate double smaller_b=scalar(small_b) . generate double smaller_se=scalar(small_se) . generate double full_se=scalar(full_se) . export delimited using "output/overleaf_samples.csv", replace file output/overleaf_samples.csv saved . . do "setup.do" traffic . args dataset . clear . set more off . if "`dataset'"=="schools" { . use "data/caschool.dta", clear . rename testscr score . rename el_pct el . rename avginc income . assert _N==420 . assert !missing(score,str,el,income) . } . if "`dataset'"=="retail" { . use "data/retail.dta", clear . keep if !missing(sprice,income) & sprice>0 & income>0 . generate double inc10=income/10000 . generate double lp=ln(sprice) . generate double li=ln(income) . } . if "`dataset'"=="traffic" { . use "data/traffic.dta", clear . assert _N==108 . generate month_id=ym(1981,1)+_n-1 . format month_id %tm . assert year==year(dofm(month_id)) . assert t==_n . generate byte month=month(dofm(month_id)) . local m=2 . foreach flag in feb mar apr may jun jul aug sep oct nov dec { 2. assert `flag'==(month==`m') 3. local ++m 4. } . generate double logacc=ln(totacc) . generate trend=_n . tsset month_id Time variable: month_id, 1981m1 to 1989m12 Delta: 1 month . } . if "`dataset'"=="panel" { . use "data/fatality.dta", clear . generate double fatality=10000*mrall . isid state year . xtset state year . assert _N==336 . } . if "`dataset'"=="cigarettes" { . use "data/cig_ch12.dta", clear . keep if year==1995 . generate double logq=ln(packpc) . generate double logp=ln(avgprs/cpi) . generate double salestax=(taxs-tax)/cpi . generate double logincome=ln(income/(pop*cpi)) . assert _N==48 . } . if "`dataset'"=="mortgages" { . use "data/hmda_sw.dta", clear . generate byte deny=(s7==3) if !missing(s7) . generate double pir=s46/100 . assert _N==2380 . assert !missing(deny,pir) . } . end of do-file . * BEGIN dynamic . regress logacc L.logacc trend i.month unem spdlaw beltlaw wkends, vce(robust) Linear regression Number of obs = 107 F(17, 89) = 67.48 Prob > F = 0.0000 R-squared = 0.9283 Root MSE = .03179 ------------------------------------------------------------------------------ | Robust logacc | Coefficient std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- logacc | L1. | .3326578 .090942 3.66 0.000 .151958 .5133577 | trend | .0008893 .0002165 4.11 0.000 .000459 .0013195 | month | 2 | .0146527 .0228309 0.64 0.523 -.0307119 .0600172 3 | .1430085 .0236012 6.06 0.000 .0961134 .1899037 4 | .038098 .0182453 2.09 0.040 .001845 .074351 5 | .072244 .020017 3.61 0.001 .0324707 .1120174 6 | .062745 .0195854 3.20 0.002 .0238293 .1016607 7 | .0893948 .0201297 4.44 0.000 .0493976 .1293921 8 | .0938234 .0185598 5.06 0.000 .0569454 .1307013 9 | .0761947 .0175797 4.33 0.000 .0412643 .1111252 10 | .1188968 .0212805 5.59 0.000 .0766128 .1611807 11 | .0991803 .0195533 5.07 0.000 .0603283 .1380323 12 | .1255027 .020455 6.14 0.000 .084859 .1661464 | unem | -.0125834 .0036327 -3.46 0.001 -.0198015 -.0053653 spdlaw | -.0414191 .0117486 -3.53 0.001 -.0647634 -.0180748 beltlaw | .0652123 .0140206 4.65 0.000 .0373537 .0930709 wkends | .0032099 .0035067 0.92 0.362 -.0037578 .0101777 _cons | 7.018421 .9794514 7.17 0.000 5.072272 8.96457 ------------------------------------------------------------------------------ . * END dynamic . * BEGIN diagnostics . regress logacc trend i.month unem spdlaw beltlaw wkends Source | SS df MS Number of obs = 108 -------------+---------------------------------- F(16, 91) = 57.61 Model | 1.14490873 16 .071556796 Prob > F = 0.0000 Residual | .113028314 91 .001242069 R-squared = 0.9101 -------------+---------------------------------- Adj R-squared = 0.8943 Total | 1.25793704 107 .011756421 Root MSE = .03524 ------------------------------------------------------------------------------ logacc | Coefficient Std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- trend | .0011011 .0002579 4.27 0.000 .0005889 .0016133 | month | 2 | -.0338346 .0177683 -1.90 0.060 -.0691291 .0014599 3 | .076953 .0167941 4.58 0.000 .0435936 .1103123 4 | .0104562 .0170469 0.61 0.541 -.0234053 .0443178 5 | .0237075 .0169389 1.40 0.165 -.0099395 .0573546 6 | .0219334 .0172149 1.27 0.206 -.0122619 .0561288 7 | .0499292 .0167036 2.99 0.004 .0167496 .0831088 8 | .0559523 .0168173 3.33 0.001 .0225468 .0893578 9 | .0420694 .0172819 2.43 0.017 .0077411 .0763977 10 | .081717 .0169554 4.82 0.000 .0480372 .1153968 11 | .0768721 .0172455 4.46 0.000 .0426161 .1111282 12 | .0990862 .0170705 5.80 0.000 .0651778 .1329947 | unem | -.0212173 .0033974 -6.25 0.000 -.0279659 -.0144688 spdlaw | -.0537593 .0126036 -4.27 0.000 -.0787948 -.0287238 beltlaw | .0954526 .014235 6.71 0.000 .0671765 .1237288 wkends | .0033333 .0037761 0.88 0.380 -.0041675 .0108342 _cons | 10.63986 .0630859 168.66 0.000 10.51455 10.76518 ------------------------------------------------------------------------------ . estat dwatson Durbin–Watson d-statistic( 17, 108) = 1.200475 . estat bgodfrey, lags(1 4) Breusch–Godfrey LM test for autocorrelation --------------------------------------------------------------------------- lags(p) | chi2 df Prob > chi2 -------------+------------------------------------------------------------- 1 | 13.010 1 0.0003 4 | 16.907 4 0.0020 --------------------------------------------------------------------------- H0: no serial correlation . * END diagnostics . * BEGIN arch . estat archlm, lags(1) LM test for autoregressive conditional heteroskedasticity (ARCH) --------------------------------------------------------------------------- lags(p) | chi2 df Prob > chi2 -------------+------------------------------------------------------------- 1 | 0.350 1 0.5540 --------------------------------------------------------------------------- H0: no ARCH effects vs. H1: ARCH(p) disturbance . * END arch . display "ECO603_OVERLEAF_TECHNICAL_COMPLETE" ECO603_OVERLEAF_TECHNICAL_COMPLETE