---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- name: log: C:\Users\chouse\Dropbox\basu-house\analysis\code\../temp/cycregs_ipd.log log type: text opened on: 18 Jan 2017, 15:00:47 . /***********************************************************************************/ > /*** DATA ***/ > /***********************************************************************************/ > local deflator ipd; . local start_year = 1978; . use `myinput'fixed_effects_`deflator'_data, clear; . keep if regexm(var,"^[0-9]") | var=="_cons"; (28 observations deleted) . /* var starts with a number */ > drop if var == "1978b.datey"; (3 observations deleted) . replace var = "1978" if var == "_cons"; (3 real changes made) . gen year = substr(var,1,4); . destring year, replace; year has all characters numeric; replaced as int . /* gen base = substr(var,5,1); */ > /* drop if base == "b"; */ > assert coef != 0; . keep coef year scenario; . reshape wide coef, i(year) j(scenario) s; (note: j = base cntrl cntrlfes) Data long -> wide ----------------------------------------------------------------------------- Number of obs. 78 -> 26 Number of variables 3 -> 4 j variable (3 values) scenario -> (dropped) xij variables: coef -> coefbase coefcntrl coefcntrlfes ----------------------------------------------------------------------------- . sort year; . foreach ii in base cntrl cntrlfes {; 2. gen temp`ii' = coef`ii'; 3. gen temp1 = coef`ii' in 1; 4. egen temp2 = max(temp1); 5. replace coef`ii' = coef`ii' + temp2 if year > `start_year'; 6. drop temp1 temp2; 7. }; (25 missing values generated) (25 real changes made) (25 missing values generated) (25 real changes made) (25 missing values generated) (25 real changes made) . /*** Plot fixed effects ***/ > tsset year; time variable: year, 1978 to 2012, but with gaps delta: 1 unit . tw > (tsline coefbase coefcntrl coefcntrlfes, yaxis(1) lw(0.8 0.8 0.8) lc(dknavy maroon ebblue)) > (tsline tempbase tempcntrl tempcntrlfes if year > 1978, yaxis(2) lw(0.8 0.8 0.8) lc(dknavy maroon ebblue) lp(dash dash dash)), > xtitle("") ytitle("Log(Real Dollars)") tmtick(1978(1)2012) > legend(label(1 "Base") label(2 "Controls") label(3 "Controls + fes") order(1 2 3) region(lstyle(none))); . merge 1:1 year using `myinput'fred4cycregs_data, gen(match_fred); (note: variable year was int, now float to accommodate using data's values) Result # of obs. ----------------------------------------- not matched 42 from master 0 (match_fred==1) from using 42 (match_fred==2) matched 26 (match_fred==3) ----------------------------------------- . merge 1:1 year using `myinput'fixed_effects_`deflator'_user_cost, gen(match_uc); Result # of obs. ----------------------------------------- not matched 39 from master 39 (match_uc==1) from using 0 (match_uc==2) matched 29 (match_uc==3) ----------------------------------------- . merge 1:1 year using `myinput'fixed_effects_`deflator'_entry_wage, gen(match_entry_wage); Result # of obs. ----------------------------------------- not matched 42 from master 42 (match_entry_wage==1) from using 0 (match_entry_wage==2) matched 26 (match_entry_wage==3) ----------------------------------------- . /*******************/ > drop if year == 1978; (1 observation deleted) . /*******************/ > > /*** multiply UR coefficients by 100 ***/ > replace ur = ur/100; (66 real changes made) . replace hp_ur = hp_ur/100; (66 real changes made) . tsset year; time variable: year, 1947 to 2014, but with a gap delta: 1 unit . #delimit cr delimiter now cr . foreach ii in base cntrl cntrlfes { 2. /*** UR ***/ . reg coef`ii' ur year, vce(hc3) 3. if strmatch("`ii'","base") { 4. est sto m`ii'ur, title("Base") 5. } 6. if strmatch("`ii'","cntrl") { 7. est sto m`ii'ur, title("Controls") 8. } 9. if strmatch("`ii'","cntrlfes") { 10. est sto m`ii'ur, title("Controls, FEs") 11. } 12. . /*** HP UR ***/ . reg coef`ii' hp_ur year 13. if strmatch("`ii'","base") { 14. est sto m`ii'_hp_ur, title("Base") 15. } 16. if strmatch("`ii'","cntrl") { 17. est sto m`ii'_hp_ur, title("Controls") 18. } 19. if strmatch("`ii'","cntrlfes") { 20. est sto m`ii'_hp_ur, title("Controls, FEs") 21. } 22. . /*** GDP ***/ . reg coef`ii' hp_lrgdp_twiddle year 23. if strmatch("`ii'","base") { 24. est sto m`ii'_gdp, title("Base") 25. } 26. if strmatch("`ii'","cntrl") { 27. est sto m`ii'_gdp, title("Controls") 28. } 29. if strmatch("`ii'","cntrlfes") { 30. est sto m`ii'_gdp, title("Controls, FEs") 31. } 32. } Linear regression Number of obs = 25 F(2, 22) = 790.72 Prob > F = 0.0000 R-squared = 0.9878 Root MSE = .07053 ------------------------------------------------------------------------------ | Robust HC3 coefbase | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- ur | 1.340511 .9553414 1.40 0.175 -.6407453 3.321768 year | .0619432 .0022948 26.99 0.000 .0571841 .0667022 _cons | -120.703 4.623217 -26.11 0.000 -130.2909 -111.115 ------------------------------------------------------------------------------ Source | SS df MS Number of obs = 25 -------------+---------------------------------- F(2, 22) = 832.03 Model | 8.85568585 2 4.42784293 Prob > F = 0.0000 Residual | .117078439 22 .005321747 R-squared = 0.9870 -------------+---------------------------------- Adj R-squared = 0.9858 Total | 8.97276429 24 .373865179 Root MSE = .07295 ------------------------------------------------------------------------------ coefbase | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- hp_ur | -.9768379 1.530214 -0.64 0.530 -4.150308 2.196633 year | .0615467 .0015132 40.67 0.000 .0584086 .0646848 _cons | -119.8242 3.015394 -39.74 0.000 -126.0777 -113.5706 ------------------------------------------------------------------------------ Source | SS df MS Number of obs = 25 -------------+---------------------------------- F(2, 22) = 847.27 Model | 8.85776571 2 4.42888285 Prob > F = 0.0000 Residual | .114998584 22 .005227208 R-squared = 0.9872 -------------+---------------------------------- Adj R-squared = 0.9860 Total | 8.97276429 24 .373865179 Root MSE = .0723 ---------------------------------------------------------------------------------- coefbase | Coef. Std. Err. t P>|t| [95% Conf. Interval] -----------------+---------------------------------------------------------------- hp_lrgdp_twiddle | .9851568 1.09275 0.90 0.377 -1.281068 3.251382 year | .0614152 .0014941 41.11 0.000 .0583167 .0645138 _cons | -119.5631 2.977435 -40.16 0.000 -125.7379 -113.3882 ---------------------------------------------------------------------------------- Linear regression Number of obs = 25 F(2, 22) = 1.58 Prob > F = 0.2295 R-squared = 0.2350 Root MSE = .07092 ------------------------------------------------------------------------------ | Robust HC3 coefcntrl | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- ur | 1.060739 .8991653 1.18 0.251 -.8040157 2.925494 year | .0038304 .0021593 1.77 0.090 -.0006477 .0083086 _cons | -6.950401 4.34864 -1.60 0.124 -15.96893 2.068127 ------------------------------------------------------------------------------ Source | SS df MS Number of obs = 25 -------------+---------------------------------- F(2, 22) = 3.01 Model | .031037808 2 .015518904 Prob > F = 0.0702 Residual | .113614776 22 .005164308 R-squared = 0.2146 -------------+---------------------------------- Adj R-squared = 0.1432 Total | .144652584 24 .006027191 Root MSE = .07186 ------------------------------------------------------------------------------ coefcntrl | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- hp_ur | -1.185309 1.507409 -0.79 0.440 -4.311485 1.940866 year | .0035541 .0014906 2.38 0.026 .0004628 .0066454 _cons | -6.329374 2.970456 -2.13 0.045 -12.48972 -.1690257 ------------------------------------------------------------------------------ Source | SS df MS Number of obs = 25 -------------+---------------------------------- F(2, 22) = 3.11 Model | .031885597 2 .015942798 Prob > F = 0.0646 Residual | .112766987 22 .005125772 R-squared = 0.2204 -------------+---------------------------------- Adj R-squared = 0.1496 Total | .144652584 24 .006027191 Root MSE = .07159 ---------------------------------------------------------------------------------- coefcntrl | Coef. Std. Err. t P>|t| [95% Conf. Interval] -----------------+---------------------------------------------------------------- hp_lrgdp_twiddle | .9607816 1.082096 0.89 0.384 -1.283347 3.204911 year | .0034048 .0014795 2.30 0.031 .0003365 .0064731 _cons | -6.03277 2.948405 -2.05 0.053 -12.14739 .0818472 ---------------------------------------------------------------------------------- Linear regression Number of obs = 25 F(2, 22) = 573.78 Prob > F = 0.0000 R-squared = 0.9832 Root MSE = .07624 ------------------------------------------------------------------------------ | Robust HC3 coefcntrlfes | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- ur | 1.194724 1.024017 1.17 0.256 -.9289564 3.318405 year | .0568464 .0024892 22.84 0.000 .0516842 .0620086 _cons | -111.2468 5.014697 -22.18 0.000 -121.6467 -100.847 ------------------------------------------------------------------------------ Source | SS df MS Number of obs = 25 -------------+---------------------------------- F(2, 22) = 623.57 Model | 7.46390981 2 3.7319549 Prob > F = 0.0000 Residual | .131665394 22 .005984791 R-squared = 0.9827 -------------+---------------------------------- Adj R-squared = 0.9811 Total | 7.5955752 24 .3164823 Root MSE = .07736 ------------------------------------------------------------------------------ coefcntrlfes | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- hp_ur | -1.328643 1.622743 -0.82 0.422 -4.694005 2.036719 year | .0565346 .0016046 35.23 0.000 .0532068 .0598624 _cons | -110.5462 3.197728 -34.57 0.000 -117.1779 -103.9145 ------------------------------------------------------------------------------ Source | SS df MS Number of obs = 25 -------------+---------------------------------- F(2, 22) = 633.03 Model | 7.46584378 2 3.73292189 Prob > F = 0.0000 Residual | .129731424 22 .005896883 R-squared = 0.9829 -------------+---------------------------------- Adj R-squared = 0.9814 Total | 7.5955752 24 .3164823 Root MSE = .07679 ---------------------------------------------------------------------------------- coefcntrlfes | Coef. Std. Err. t P>|t| [95% Conf. Interval] -----------------+---------------------------------------------------------------- hp_lrgdp_twiddle | 1.165465 1.160639 1.00 0.326 -1.241554 3.572483 year | .0563634 .0015869 35.52 0.000 .0530723 .0596544 _cons | -110.2061 3.162414 -34.85 0.000 -116.7645 -103.6476 ---------------------------------------------------------------------------------- . #delimit ; delimiter now ; . la var hp_ur "HP UR"; . la var year "Trend"; . la var ur "Unemployment Rate"; . la var hp_lrgdp_twiddle "HP GDP"; . /*** UR ***/ > newey lmacrowage_`deflator' ur year if year >= 1978 & year <= 2012, lag(2); Regression with Newey-West standard errors Number of obs = 34 maximum lag: 2 F( 2, 31) = 643.87 Prob > F = 0.0000 ------------------------------------------------------------------------------ | Newey-West lmacrowage~d | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- ur | -.2682393 .2921157 -0.92 0.366 -.8640132 .3275345 year | .0186686 .0005202 35.88 0.000 .0176076 .0197297 _cons | -32.88366 1.036913 -31.71 0.000 -34.99845 -30.76886 ------------------------------------------------------------------------------ . est sto macro_ur, title("Macro Wage"); . newey lUC ur year, lag(2); Regression with Newey-West standard errors Number of obs = 27 maximum lag: 2 F( 2, 24) = 179.34 Prob > F = 0.0000 ------------------------------------------------------------------------------ | Newey-West lUC | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- ur | -2.789991 1.494722 -1.87 0.074 -5.874945 .2949636 year | .0558302 .0047299 11.80 0.000 .0460682 .0655921 _cons | -108.4789 9.480522 -11.44 0.000 -128.0457 -88.91204 ------------------------------------------------------------------------------ . est sto lUC_ur, title("L(User Cost)"); . reg lentry_wage ur year, vce(hc3); Linear regression Number of obs = 25 F(2, 22) = 660.24 Prob > F = 0.0000 R-squared = 0.9837 Root MSE = .08452 ------------------------------------------------------------------------------ | Robust HC3 lentry_wage | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- ur | 1.349785 1.656439 0.81 0.424 -2.08546 4.78503 year | .064038 .0029668 21.59 0.000 .0578852 .0701907 _cons | -124.9732 6.002024 -20.82 0.000 -137.4206 -112.5257 ------------------------------------------------------------------------------ . est sto lentry_ur, title("New Hire"); . esttab macro_ur mbaseur mcntrlur mcntrlfesur lentry_ur lUC_ur using `slides'tab_`prg'_1978_2012_ur.tex, replace > keep(ur) > addnotes("Uses year FEs from a first-stage regression.") > star(* 0.10 ** 0.05 *** 0.01) > booktabs se label mtitles nogap; (note: file ../../slides/tab_cycregs_ipd_1978_2012_ur.tex not found) (output written to ../../slides/tab_cycregs_ipd_1978_2012_ur.tex) . /*** HP_UR ***/ > reg lmacrowage_`deflator' hp_ur year if year >= 1978 & year <= 2012; Source | SS df MS Number of obs = 34 -------------+---------------------------------- F(2, 31) = 807.81 Model | 1.14880429 2 .574402143 Prob > F = 0.0000 Residual | .022042815 31 .000711059 R-squared = 0.9812 -------------+---------------------------------- Adj R-squared = 0.9800 Total | 1.1708471 33 .035480215 Root MSE = .02667 ------------------------------------------------------------------------------ lmacrowage~d | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- hp_ur | -.5078002 .4711603 -1.08 0.289 -1.468738 .4531376 year | .0187981 .0004705 39.96 0.000 .0178386 .0197576 _cons | -33.15892 .9387707 -35.32 0.000 -35.07356 -31.24428 ------------------------------------------------------------------------------ . est sto macro_hp_ur, title("Macro Wage"); . reg lUC hp_ur year; Source | SS df MS Number of obs = 27 -------------+---------------------------------- F(2, 24) = 393.38 Model | 5.80237509 2 2.90118754 Prob > F = 0.0000 Residual | .1770016 24 .007375067 R-squared = 0.9704 -------------+---------------------------------- Adj R-squared = 0.9679 Total | 5.97937669 26 .229976027 Root MSE = .08588 ------------------------------------------------------------------------------ lUC | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- hp_ur | -5.818204 2.078507 -2.80 0.010 -10.10803 -1.528376 year | .0594875 .002124 28.01 0.000 .0551037 .0638713 _cons | -115.9366 4.231125 -27.40 0.000 -124.6692 -107.204 ------------------------------------------------------------------------------ . est sto lUC_hp_ur, title("L(User Cost)"); . reg lentry_wage hp_ur year; Source | SS df MS Number of obs = 25 -------------+---------------------------------- F(2, 22) = 627.39 Model | 9.46746209 2 4.73373104 Prob > F = 0.0000 Residual | .165993792 22 .007545172 R-squared = 0.9828 -------------+---------------------------------- Adj R-squared = 0.9812 Total | 9.63345588 24 .401393995 Root MSE = .08686 ------------------------------------------------------------------------------ lentry_wage | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- hp_ur | -.6985067 1.822048 -0.38 0.705 -4.477203 3.080189 year | .0636129 .0018017 35.31 0.000 .0598763 .0673495 _cons | -124.0368 3.590472 -34.55 0.000 -131.483 -116.5907 ------------------------------------------------------------------------------ . est sto lentry_hp_ur, title("New Hire"); . esttab macro_hp_ur mbase_hp_ur mcntrl_hp_ur mcntrlfes_hp_ur lentry_hp_ur lUC_hp_ur using `slides'tab_`prg'_1978_2012_hp_ur.tex, replace > noconstant keep(hp_ur) > b(%9.3f) /* 3 decimal places */ > nostar /* star(* 0.10 ** 0.05 *** 0.01) */ > /* addnotes("Uses year FEs from a first-stage regression.") */ > addnotes("Coefficient on HP UR multiplied by 100.") > booktabs se label mtitles nogap; (note: file ../../slides/tab_cycregs_ipd_1978_2012_hp_ur.tex not found) (output written to ../../slides/tab_cycregs_ipd_1978_2012_hp_ur.tex) . /*** HP filtered real GDP ***/ > reg lmacrowage_`deflator' hp_lrgdp_twiddle year if year >= 1978 & year <= 2012; Source | SS df MS Number of obs = 34 -------------+---------------------------------- F(2, 31) = 798.03 Model | 1.14853911 2 .574269555 Prob > F = 0.0000 Residual | .02230799 31 .000719613 R-squared = 0.9809 -------------+---------------------------------- Adj R-squared = 0.9797 Total | 1.1708471 33 .035480215 Root MSE = .02683 ---------------------------------------------------------------------------------- lmacrowage_ipd | Coef. Std. Err. t P>|t| [95% Conf. Interval] -----------------+---------------------------------------------------------------- hp_lrgdp_twiddle | .3117766 .3531823 0.88 0.384 -.4085434 1.032097 year | .0187433 .0004692 39.95 0.000 .0177864 .0197002 _cons | -33.04986 .9362811 -35.30 0.000 -34.95941 -31.1403 ---------------------------------------------------------------------------------- . est sto macro_gdp, title("Macro Wage"); . reg lUC hp_lrgdp_twiddle year; Source | SS df MS Number of obs = 27 -------------+---------------------------------- F(2, 24) = 361.63 Model | 5.78733393 2 2.89366697 Prob > F = 0.0000 Residual | .192042757 24 .008001782 R-squared = 0.9679 -------------+---------------------------------- Adj R-squared = 0.9652 Total | 5.97937669 26 .229976027 Root MSE = .08945 ---------------------------------------------------------------------------------- lUC | Coef. Std. Err. t P>|t| [95% Conf. Interval] -----------------+---------------------------------------------------------------- hp_lrgdp_twiddle | 3.121446 1.350501 2.31 0.030 .3341478 5.908744 year | .0594798 .0022131 26.88 0.000 .0549123 .0640474 _cons | -115.921 4.408447 -26.30 0.000 -125.0195 -106.8224 ---------------------------------------------------------------------------------- . est sto lUC_gdp, title("L(User Cost)"); . reg lentry_wage hp_lrgdp_twiddle year; Source | SS df MS Number of obs = 25 -------------+---------------------------------- F(2, 22) = 653.78 Model | 9.47405212 2 4.73702606 Prob > F = 0.0000 Residual | .159403763 22 .007245626 R-squared = 0.9835 -------------+---------------------------------- Adj R-squared = 0.9819 Total | 9.63345588 24 .401393995 Root MSE = .08512 ---------------------------------------------------------------------------------- lentry_wage | Coef. Std. Err. t P>|t| [95% Conf. Interval] -----------------+---------------------------------------------------------------- hp_lrgdp_twiddle | 1.326176 1.286542 1.03 0.314 -1.341949 3.9943 year | .0634918 .0017591 36.09 0.000 .0598438 .0671399 _cons | -123.7965 3.505463 -35.32 0.000 -131.0664 -116.5267 ---------------------------------------------------------------------------------- . est sto lentry_gdp, title("New Hire"); . esttab macro_gdp mbase_gdp mcntrl_gdp mcntrlfes_gdp lentry_gdp lUC_gdp using `slides'tab_`prg'_1978_2012_gdp.tex, replace > keep(hp_lrgdp_twiddle) > noconstant nonum > b(%9.3f) /* 3 decimal places */ > nostar /* star(* 0.10 ** 0.05 *** 0.01) */ > /* addnotes("Uses year FEs from a first-stage regression.") */ > booktabs se label mtitles nogap; (note: file ../../slides/tab_cycregs_ipd_1978_2012_gdp.tex not found) (output written to ../../slides/tab_cycregs_ipd_1978_2012_gdp.tex) . /*** Output data ***/ > rename coefbase wbase_`deflator'; . rename coefcntrl wcntrl_`deflator'; . rename coefcntrlfes wcntrlfes_`deflator'; . rename lUC lUC_`deflator'; . rename lentry_wage lnewhire_`deflator'; . keep year wbase_`deflator' wcntrl_`deflator' wcntrlfes_`deflator' lmacrowage_`deflator' lUC_`deflator' lnewhire_`deflator'; . drop if year < 1978; (31 observations deleted) . export excel `myoutput'`prg'_data.xlsx, firstrow(variables) replace; file ../output/cycregs_ipd_data.xlsx saved . end of do-file . do cycregs_ipd_cumtight.do; . /********************************************************************** > Program: cycregs_ipd_cumtight.do > Purpose: determine how cyclical different measures of wages are > > Date Started: 29 December 2015 > Date Revised: 13 July 2016 > **********************************************************************/ . . #delimit ; delimiter now ; . clear all; . capture log close;