Hi Statalisters,
I need to save the regression coefficients and SEs of the following regression and normalize the coefficients such that all coefficients are subtracted from the coefficient of the term hurr_f1_2. It would be extremely helpf if someone can suggest a code that can save the estimates and then modify them to be plotted on a graph.
reghdfe LProp_p $leads1 Damage $lags1 [aweight=Tot_Pop], absorb(i.fips i.state_id#i.year i.year#i.Coastal_County i.year#c.Proportion_Black i.year#c.UR i.year#c.Land_Area i.year#c.Coast_Dist i.year#c.PVR ) vce(cluster fips)
HDFE Linear regression Number of obs = 22,987
Absorbing 8 HDFE groups F( 11, 1102) = 2.83
Statistics robust to heteroskedasticity Prob > F = 0.0012
R-squared = 0.9184
Adj R-squared = 0.9120
Within R-sq. = 0.0050
Number of clusters (fips) = 1,103 Root MSE = 0.2767
(Std. err. adjusted for 1,103 clusters in fips)
Robust
LVio_p Coefficient std. err. t P>t [95% conf. interval]
hurr_f9_10 .0017262 .0461595 0.04 0.970 -.0888442 .0922965
hurr_f7_8 .0313713 .0411142 0.76 0.446 -.0492997 .1120424
hurr_f5_6 .0290832 .0289531 1.00 0.315 -.0277263 .0858927
hurr_f3_4 .0227471 .0341041 0.67 0.505 -.0441693 .0896635
hurr_f1_2 .0353357 .0270934 1.30 0.192 -.0178247 .0884962
Damage .3924539 .0990926 3.96 0.000 .1980224 .5868854
hurr_1_2 .4602122 .1144715 4.02 0.000 .2356056 .6848189
hurr_3_4 .5357033 .2213863 2.42 0.016 .101317 .9700896
hurr_5_6 .2240365 .0764239 2.93 0.003 .0740837 .3739894
hurr_7_8 .1580742 .0850028 1.86 0.063 -.0087113 .3248597
hurr_9_10 .0384899 .0583739 0.66 0.510 -.0760465 .1530264
_cons 3.583663 .00562 637.66 0.000 3.572636 3.59469
* Load data and setup matrix
matrix b = e(b)
matrix v = e(V)
* Normalize coefficients relative to hurr_f1_2
scalar hurr_f1_2_coef = _b[hurr_f1_2]
foreach var in hurr_f9_10 hurr_f7_8 hurr_f5_6 hurr_f3_4 hurr_f1_2 Damage hurr_1_2 hurr_3_4 hurr_5_6 hurr_7_8 hurr_9_10 {
scalar `var'_norm = _b[`var'] - hurr_f1_2_coef
scalar low_`var'_norm = `var'_norm - invttail(e(df_r),0.025)*_se[`var']
scalar high_`var'_norm = `var'_norm + invttail(e(df_r),0.025)*_se[`var']
di "`var'_norm' adjusted coefficient: " `var'_norm
di "Lower 95% CI for `var'_norm': " low_`var'_norm
di "Upper 95% CI for `var'_norm': " high_`var'_norm
}
I need to save the regression coefficients and SEs of the following regression and normalize the coefficients such that all coefficients are subtracted from the coefficient of the term hurr_f1_2. It would be extremely helpf if someone can suggest a code that can save the estimates and then modify them to be plotted on a graph.
reghdfe LProp_p $leads1 Damage $lags1 [aweight=Tot_Pop], absorb(i.fips i.state_id#i.year i.year#i.Coastal_County i.year#c.Proportion_Black i.year#c.UR i.year#c.Land_Area i.year#c.Coast_Dist i.year#c.PVR ) vce(cluster fips)
HDFE Linear regression Number of obs = 22,987
Absorbing 8 HDFE groups F( 11, 1102) = 2.83
Statistics robust to heteroskedasticity Prob > F = 0.0012
R-squared = 0.9184
Adj R-squared = 0.9120
Within R-sq. = 0.0050
Number of clusters (fips) = 1,103 Root MSE = 0.2767
(Std. err. adjusted for 1,103 clusters in fips)
Robust
LVio_p Coefficient std. err. t P>t [95% conf. interval]
hurr_f9_10 .0017262 .0461595 0.04 0.970 -.0888442 .0922965
hurr_f7_8 .0313713 .0411142 0.76 0.446 -.0492997 .1120424
hurr_f5_6 .0290832 .0289531 1.00 0.315 -.0277263 .0858927
hurr_f3_4 .0227471 .0341041 0.67 0.505 -.0441693 .0896635
hurr_f1_2 .0353357 .0270934 1.30 0.192 -.0178247 .0884962
Damage .3924539 .0990926 3.96 0.000 .1980224 .5868854
hurr_1_2 .4602122 .1144715 4.02 0.000 .2356056 .6848189
hurr_3_4 .5357033 .2213863 2.42 0.016 .101317 .9700896
hurr_5_6 .2240365 .0764239 2.93 0.003 .0740837 .3739894
hurr_7_8 .1580742 .0850028 1.86 0.063 -.0087113 .3248597
hurr_9_10 .0384899 .0583739 0.66 0.510 -.0760465 .1530264
_cons 3.583663 .00562 637.66 0.000 3.572636 3.59469
* Load data and setup matrix
matrix b = e(b)
matrix v = e(V)
* Normalize coefficients relative to hurr_f1_2
scalar hurr_f1_2_coef = _b[hurr_f1_2]
foreach var in hurr_f9_10 hurr_f7_8 hurr_f5_6 hurr_f3_4 hurr_f1_2 Damage hurr_1_2 hurr_3_4 hurr_5_6 hurr_7_8 hurr_9_10 {
scalar `var'_norm = _b[`var'] - hurr_f1_2_coef
scalar low_`var'_norm = `var'_norm - invttail(e(df_r),0.025)*_se[`var']
scalar high_`var'_norm = `var'_norm + invttail(e(df_r),0.025)*_se[`var']
di "`var'_norm' adjusted coefficient: " `var'_norm
di "Lower 95% CI for `var'_norm': " low_`var'_norm
di "Upper 95% CI for `var'_norm': " high_`var'_norm
}
Comment