diff --git a/.gitattributes b/.gitattributes
index 77503a7d5a53d21751d503bd58a425f903cf9ded..deca3a3ab6d63c4cd7ab5e813aca621353ef8c09 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -85,3 +85,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
*.mpk filter=lfs diff=lfs merge=lfs -text
*.log filter=lfs diff=lfs merge=lfs -text
*.dct filter=lfs diff=lfs merge=lfs -text
+*.gph filter=lfs diff=lfs merge=lfs -text
diff --git a/82/paper.pdf b/82/paper.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..6ec1beeee930f2170bb0a754f29cc0ad49a02b0f
--- /dev/null
+++ b/82/paper.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b5768e05d32cd0280a50362dfb05b3dae4df8678c6846b5e4d51e150e41b51bb
+size 5634570
diff --git a/82/replication_package/DATASET_ANCIENT_CITIES.dta b/82/replication_package/DATASET_ANCIENT_CITIES.dta
new file mode 100644
index 0000000000000000000000000000000000000000..abf26ae61f10b795620d50dc5ab6a97c0c909ebb
--- /dev/null
+++ b/82/replication_package/DATASET_ANCIENT_CITIES.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:2fe0e61e788a0118bd0ea7185e44f26a5a011766d083d87c53a6b62c7f069140
+size 5078166
diff --git a/82/replication_package/DATASET_ARCHAEOLOGY.dta b/82/replication_package/DATASET_ARCHAEOLOGY.dta
new file mode 100644
index 0000000000000000000000000000000000000000..79739d3a8242e261d322ef7905c4de88709f2540
--- /dev/null
+++ b/82/replication_package/DATASET_ARCHAEOLOGY.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d237d3b9f4aa15c9cb533313ac299a20572002975378e262f718fdd624dc2e97
+size 3800766
diff --git a/82/replication_package/DATASET_COUNTRIES.dta b/82/replication_package/DATASET_COUNTRIES.dta
new file mode 100644
index 0000000000000000000000000000000000000000..3c369796090063a9f573387983ecc7d97680622e
--- /dev/null
+++ b/82/replication_package/DATASET_COUNTRIES.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d92199762eda290509653f769cfa76e4fb5f36bd972f5bc44a9005f2ef740441
+size 1291205
diff --git a/82/replication_package/DATASET_ETHNOATLAS.dta b/82/replication_package/DATASET_ETHNOATLAS.dta
new file mode 100644
index 0000000000000000000000000000000000000000..b06566509eee3a696dfc21d7d1d9273a57aebe0b
--- /dev/null
+++ b/82/replication_package/DATASET_ETHNOATLAS.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4bac034b0871756c199879e80834215a6b1da03fbe0f711c2e47e90136121290
+size 634258
diff --git a/82/replication_package/DO_FILES/Main.do b/82/replication_package/DO_FILES/Main.do
new file mode 100644
index 0000000000000000000000000000000000000000..00de039dbecb553e037a56710d65e13fbb12a56e
--- /dev/null
+++ b/82/replication_package/DO_FILES/Main.do
@@ -0,0 +1,39 @@
+
+
+
+
+clear all
+set more off
+global MAIN "/Users/luigipascali/Desktop/REPLICATION/" /*Insert here the directory of the replication material*/
+cd "$MAIN"
+
+***Install relevant packages
+
+*Esta
+net from "$MAIN/ESTA/"
+net install esta, replace
+
+*Conley
+cap program drop
+cap program drop xgmlt
+cap program drop x_ols
+do "$MAIN/PACKAGES/xgmlt.ado"
+do "$MAIN/PACKAGES/x_ols.ado"
+do "$MAIN/PACKAGES/x_gmm.ado"
+
+*Lasso
+ssc install pdslasso
+ssc install lassopack
+
+
+***Run do-files
+do "$MAIN/DO_FILES/Replication EthnoAtlas FINAL.do"
+do "$MAIN/DO_FILES/Replication Country Results FINAL.do"
+do "$MAIN/DO_FILES/Replication Ancient Settlements FINAL.do"
+do "$MAIN/DO_FILES/Replication Archaeological Results FINAL.do"
+
+***Erase temp files
+erase "$MAIN/TEMP1.dta"
+erase "$MAIN/TEMP2.dta"
+erase "$MAIN/TEMP_PANEL_country.dta"
+erase "$MAIN/TEMP_ANCIENT_CITIES.dta"
diff --git a/82/replication_package/DO_FILES/Replication Ancient Settlements FINAL.do b/82/replication_package/DO_FILES/Replication Ancient Settlements FINAL.do
new file mode 100644
index 0000000000000000000000000000000000000000..e6cfcde67f4e37696c7533a9bbca02540ee97ad6
--- /dev/null
+++ b/82/replication_package/DO_FILES/Replication Ancient Settlements FINAL.do
@@ -0,0 +1,315 @@
+
+
+
+******************************************************************
+****************************************************************** UPLOAD DATASET AND DEFINE VARIABLES
+use DATASET_ANCIENT_CITIES.dta, clear
+
+*Settlements and archeological evidence
+gen ln1_ruin2_grid=ln(1+ruin2_grid)
+gen I_ruin2_grid=(ruin2_grid>0 & ruin2_grid~=.)
+
+gen ln1_n_Pyramid_Mastaba=ln(1+n_Pyramid_Mastaba)
+gen I_Pyramid_Mastaba=(n_Pyramid_Mastaba>0 & n_Pyramid_Mastaba~=.)
+
+gen ln1_n_Ancient_Temple=ln(1+n_Ancient_Temple)
+gen I_Ancient_Temple=(n_Ancient_Temple>0 & n_Ancient_Temple~=.)
+
+gen ln1_n_Ancient_Mine=ln(1+n_Ancient_Mine)
+gen I_Ancient_Mine=(n_Ancient_Mine>0 & n_Ancient_Mine~=.)
+
+gen ln1_n_Ancient_Palace=ln(1+n_Ancient_Palace)
+gen I_Ancient_Palace=(n_Ancient_Palace>0 & n_Ancient_Palace~=.)
+
+gen ln1_n_Sculptured_Stone=ln(1+n_Sculptured_Stone)
+gen I_Sculptured_Stone=(n_Sculptured_Stone>0 & n_Sculptured_Stone~=.)
+
+gen ln1_n_Standing_Stone=ln(1+n_Standing_Stone)
+gen I_Standing_Stone=(n_Standing_Stone>0 & n_Standing_Stone~=.)
+
+gen dummy_ancient_city_500BC=(ancient_city_500BC>0)
+gen dummy_ancient_city_450AD=(ancient_city_450AD>0)
+
+reg I_ruin1_grid only_cer
+foreach vari of var Precipitation Temperature Ruggedness irrigation_dep Plow_advantage1 Elevation {
+egen `vari'_std=std(`vari') if e(sample)==1
+}
+
+
+*Old and New World
+gen old_world=1 if continent=="Africa" | continent=="Asia" | continent=="Oceania" | continent=="Europe"
+replace old_world=0 if continent=="North America" | continent=="South America"
+
+
+**caloric advantage of cereals and land productivity before Columbian exchange
+
+*crops Old World
+local cereals_ante_OW "Barley_median_cal, Buckwheat_median_cal , Dryland_Rice_median_cal ,Foxtail_Millet_median_cal, Oat_median_cal ,Pearl_Millet_median_cal, Rye_median_cal ,Sorghum_median_cal, Wetland_Rice_median_cal, Wheat_median_cal"
+local tubers_ante_OW "Yams_median_cal"
+
+*crops New World
+local cereals_ante_NW "Maize_median_cal"
+local tubers_ante_NW "White_Potato_median_cal, Sweet_Potato_median_cal, Cassava_median_cal"
+
+gen max_cal_ante_OW =max(`cereals_ante_OW' , `tubers_ante_OW', 0) /*here we have a zero because desertic places are considered as missing variables*/
+gen max_cal_ante_OW_t =max(`tubers_ante_OW' , 0)
+gen max_cal_ante_OW_c =max(`cereals_ante_OW' , 0)
+gen diff_cal_ante_OW =max_cal_ante_OW_c-max_cal_ante_OW_t
+
+gen max_cal_ante_NW =max(`cereals_ante_NW' , `tubers_ante_NW', 0)
+gen max_cal_ante_NW_t =max(`tubers_ante_NW' , 0)
+gen max_cal_ante_NW_c =max(`cereals_ante_NW' , 0)
+gen diff_cal_ante_NW =max_cal_ante_NW_c-max_cal_ante_NW_t
+
+gen max_cal_ante =max_cal_ante_OW if old_world==1
+replace max_cal_ante =max_cal_ante_NW if old_world==0
+
+gen diff_cal_ante =diff_cal_ante_OW if old_world==1
+replace diff_cal_ante =diff_cal_ante_NW if old_world==0
+
+egen std_max=std(max_cal_ante)
+egen std_diff=std(diff_cal_ante)
+
+tabulate isocode, gen(dummy_country)
+
+
+save TEMP_ANCIENT_CITIES, replace
+
+
+
+******************************************************************
+****************************************************************** TABLES IN PAPER
+use TEMP_ANCIENT_CITIES, clear
+
+
+***************************TABLE 4
+
+
+reg I_ruin1_grid only_cer , cluster(isocode)
+est sto a1
+reg I_ruin1_grid only_cer only_rt both , cluster(isocode)
+est sto a2
+xi: reg I_ruin1_grid only_cer only_rt both i.continent , cluster(isocode)
+est sto a3
+xi: reg I_ruin1_grid only_cer only_rt both i.isocode , cluster(isocode)
+est sto a4
+
+local controls_geo "only_rt both Precipitation_std Temperature_std Elevation_std Ruggedness_std abs_LatitudeA irrigation_dep_std Plow_advantage1_std "
+local dummy "dummy_country*"
+pdslasso I_ruin1_grid only_cer (`controls_geo' `dummy' ) , cluster(isocode)
+est sto a5
+
+xi: reg dummy_ancient_city_450AD only_cer only_rt both , cluster(isocode)
+est sto a6
+pdslasso dummy_ancient_city_450AD only_cer (`controls_geo' `dummy' ) , cluster(isocode)
+est sto a7
+
+xi: reg dummy_ancient_city_500BC only_cer only_rt both , cluster(isocode)
+est sto a8
+pdslasso dummy_ancient_city_500BC only_cer (`controls_geo' `dummy' ) , cluster(isocode)
+est sto a9
+
+esta a* using Table4.txt, title(Table 4) se keep(only_cer only_rt both) replace starl(* 0.10 ** 0.05 *** 0.01) s(r2 N)
+est clear
+
+
+***************************TABLE 5
+
+reg I_ruin1_grid DIST_CLOSE_CER , cluster(isocode)
+est sto a1
+reg I_ruin1_grid DIST_CLOSE_CER DIST_CLOSE , cluster(isocode)
+est sto a2
+xi: reg I_ruin1_grid DIST_CLOSE_CER DIST_CLOSE i.continent , cluster(isocode)
+est sto a3
+xi: reg I_ruin1_grid DIST_CLOSE_CER DIST_CLOSE i.isocode , cluster(isocode)
+est sto a4
+
+local controls_geo "DIST_CLOSE Precipitation_std Temperature_std Elevation_std Ruggedness_std abs_LatitudeA irrigation_dep_std Plow_advantage1_std "
+local dummy "dummy_country*"
+pdslasso I_ruin1_grid DIST_CLOSE_CER (`controls_geo' `dummy' ) , cluster(isocode)
+est sto a5
+
+xi: reg dummy_ancient_city_450AD DIST_CLOSE_CER DIST_CLOSE , cluster(isocode)
+est sto a6
+pdslasso dummy_ancient_city_450AD DIST_CLOSE_CER (`controls_geo' `dummy' ) , cluster(isocode)
+est sto a7
+
+xi: reg dummy_ancient_city_500BC DIST_CLOSE_CER DIST_CLOSE , cluster(isocode)
+est sto a8
+pdslasso dummy_ancient_city_500BC DIST_CLOSE_CER (`controls_geo' `dummy' ) , cluster(isocode)
+est sto a9
+
+esta a* using Table5.txt, title(Table 5) se keep(DIST_CLOSE_CER DIST_CLOSE) replace starl(* 0.10 ** 0.05 *** 0.01) s(r2 N)
+est clear
+
+******************************************************************
+****************************************************************** TABLES IN APPENDIX
+
+
+
+
+*************************** FIGURE F12
+preserve
+gen city="ancient large settlement" if I_ruin1_grid==1
+replace city="no large settlement" if I_ruin1_grid==0
+label var DIST_CLOSE_CER "Distance adoption cereals"
+label var DIST_CLOSE_ROOTTUBER "Distance adoption roots/tubers"
+graph box DIST_CLOSE_CER DIST_CLOSE_ROOTTUBER, over(city) nooutside ytitle("Distance in '000 km")
+graph export FigureF12.pdf, replace
+restore
+***************************TABLE F3
+
+latabstat dummy_ancient_city_450AD dummy_ancient_city_500BC I_ruin1_grid ///
+ ruin2_grid ///
+ n_Pyramid_Mastaba n_Ancient_Temple n_Ancient_Mine n_Ancient_Palace n_Sculptured_Stone n_Standing_Stone ///
+ std_max std_diff only_cer only_rt both ///
+ DIST_CLOSE_CER DIST_CLOSE ///
+ Precipitation_std Temperature_std Elevation_std Ruggedness_std abs_LatitudeA irrigation_dep_std Plow_advantage1_std ///
+ if I_ruin1_grid!=. & DIST_CLOSE!=. & only_cer!=., s(mean p50 sd Min Max N) f(%9.2fc) c(s) tf(TableF3_PanelA) replace
+
+
+***************************TABLE F35
+*table A0 - APPENDIX: EXCLUDING CONTINENTS ONE BY ONE
+foreach cont in "Africa" "Asia" "Europe" "America" "Oceania"{
+xi: reg I_ruin1_grid only_cer only_rt both i.continent if continent_large!="`cont'" , cluster(isocode)
+est sto a2`cont'
+}
+esta a* using TableF35.txt, title(Table F35) se drop( _I*) replace starl(* 0.10 ** 0.05 *** 0.01) s(r2 N)
+est clear
+
+
+***************************TABLE F36
+logit I_ruin1_grid only_cer , cluster(isocode)
+est sto a1
+logit I_ruin1_grid only_cer only_rt both , cluster(isocode)
+est sto a2
+xi: logit I_ruin1_grid only_cer only_rt both i.continent , cluster(isocode)
+est sto a3
+xi: logit I_ruin1_grid only_cer only_rt both i.isocode , cluster(isocode)
+est sto a4
+esta a* using TableF36.txt, title(Table F36) se drop( _I*) replace starl(* 0.10 ** 0.05 *** 0.01) s(r2 N)
+est clear
+
+***************************TABLE F37
+xi: reg I_ruin1_grid only_cer only_rt both Precipitation_std i.continent , cluster(isocode)
+est sto a1
+xi: reg I_ruin1_grid only_cer only_rt both Temperature_std i.continent , cluster(isocode)
+est sto a2
+xi: reg I_ruin1_grid only_cer only_rt both Elevation_std i.continent , cluster(isocode)
+est sto a3
+xi: reg I_ruin1_grid only_cer only_rt both Ruggedness_std i.continent , cluster(isocode)
+est sto a4
+xi: reg I_ruin1_grid only_cer only_rt both abs_LatitudeA i.continent , cluster(isocode)
+est sto a5
+xi: reg I_ruin1_grid only_cer only_rt both irrigation_dep_std i.continent , cluster(isocode)
+est sto a6
+xi: reg I_ruin1_grid only_cer only_rt both Plow_advantage1_std i.continent , cluster(isocode)
+est sto a7
+
+esta a* using TableF37.txt, title(Table F37) se drop( _I*) replace starl(* 0.10 ** 0.05 *** 0.01) s(r2 N)
+est clear
+
+***************************TABLE F38
+xi: reg I_ruin1_grid DIST_CLOSE_CER DIST_CLOSE Precipitation_std i.continent , cluster(isocode)
+est sto a1
+xi: reg I_ruin1_grid DIST_CLOSE_CER DIST_CLOSE Temperature_std i.continent , cluster(isocode)
+est sto a2
+xi: reg I_ruin1_grid DIST_CLOSE_CER DIST_CLOSE Elevation_std i.continent , cluster(isocode)
+est sto a3
+xi: reg I_ruin1_grid DIST_CLOSE_CER DIST_CLOSE Ruggedness_std i.continent , cluster(isocode)
+est sto a4
+xi: reg I_ruin1_grid DIST_CLOSE_CER DIST_CLOSE abs_LatitudeA i.continent , cluster(isocode)
+est sto a5
+esta a* using TableF38.txt, title(Table F38) se drop( _I*) replace starl(* 0.10 ** 0.05 *** 0.01) s(r2 N)
+est clear
+
+***************************TABLE F39
+xi: reg I_ruin1_grid DIST_CLOSE_CER DIST_CLOSE irrigation_dep_std i.continent , cluster(isocode)
+est sto a2
+xi: reg I_ruin1_grid DIST_CLOSE_CER DIST_CLOSE Plow_advantage1_std i.continent , cluster(isocode)
+est sto a3
+xi: reg I_ruin1_grid DIST_CLOSE_CER DIST_CLOSE i.continent if continent~="Europe" , cluster(isocode)
+est sto a5
+xi: reg I_ruin1_grid DIST_CLOSE_CER DIST_CLOSE i.continent if non_desert==1 , cluster(isocode)
+est sto a6
+esta a* using TableF39.txt, title(Table F39) drop( _I*) se replace starl(* 0.10 ** 0.05 *** 0.01) s(r2 N)
+est clear
+
+***************************TABLE F40
+
+xi: reg I_ruin2_grid DIST_CLOSE_CER DIST_CLOSE i.continent , cluster(isocode)
+est sto a1
+xi: reg I_Pyramid_Mastaba DIST_CLOSE_CER DIST_CLOSE i.continent , cluster(isocode)
+est sto a2
+xi: reg I_Ancient_Temple DIST_CLOSE_CER DIST_CLOSE i.continent , cluster(isocode)
+est sto a3
+xi: reg I_Ancient_Mine DIST_CLOSE_CER DIST_CLOSE i.continent , cluster(isocode)
+est sto a4
+xi: reg I_Ancient_Palace DIST_CLOSE_CER DIST_CLOSE i.continent , cluster(isocode)
+est sto a5
+xi: reg I_Sculptured_Stone DIST_CLOSE_CER DIST_CLOSE i.continent , cluster(isocode)
+est sto a6
+xi: reg I_Standing_Stone DIST_CLOSE_CER DIST_CLOSE i.continent , cluster(isocode)
+est sto a7
+esta a* using TableF40.txt, title(Table F40) drop( _I*) replace se starl(* 0.10 ** 0.05 *** 0.01) s(r2 N)
+est clear
+
+***************************TABLE F41 TO BE COMPLETED
+xi: reg ln1_ruin2_grid DIST_CLOSE_CER DIST_CLOSE i.continent , cluster(isocode)
+est sto a1
+xi: reg ln1_n_Pyramid_Mastaba DIST_CLOSE_CER DIST_CLOSE i.continent , cluster(isocode)
+est sto a2
+xi: reg ln1_n_Ancient_Temple DIST_CLOSE_CER DIST_CLOSE i.continent , cluster(isocode)
+est sto a3
+xi: reg ln1_n_Ancient_Mine DIST_CLOSE_CER DIST_CLOSE i.continent , cluster(isocode)
+est sto a4
+xi: reg ln1_n_Ancient_Palace DIST_CLOSE_CER DIST_CLOSE i.continent , cluster(isocode)
+est sto a5
+xi: reg ln1_n_Sculptured_Stone DIST_CLOSE_CER DIST_CLOSE i.continent , cluster(isocode)
+est sto a6
+xi: reg ln1_n_Standing_Stone DIST_CLOSE_CER DIST_CLOSE i.continent , cluster(isocode)
+est sto a7
+esta a* using TableF41.txt, title(Table F41) drop( _I*) replace se starl(* 0.10 ** 0.05 *** 0.01) s(r2 N)
+est clear
+
+***************************TABLE F42
+
+*table A4
+xi: reg I_ruin2_grid DIST_CLOSE_CER DIST_CLOSE i.continent if continent~="Europe" , cluster(isocode)
+est sto a1
+xi: reg I_Pyramid_Mastaba DIST_CLOSE_CER DIST_CLOSE i.continent if continent~="Europe" , cluster(isocode)
+est sto a2
+xi: reg I_Ancient_Temple DIST_CLOSE_CER DIST_CLOSE i.continent if continent~="Europe" , cluster(isocode)
+est sto a3
+xi: reg I_Ancient_Mine DIST_CLOSE_CER DIST_CLOSE i.continent if continent~="Europe" , cluster(isocode)
+est sto a4
+xi: reg I_Ancient_Palace DIST_CLOSE_CER DIST_CLOSE i.continent if continent~="Europe" , cluster(isocode)
+est sto a5
+xi: reg I_Sculptured_Stone DIST_CLOSE_CER DIST_CLOSE i.continent if continent~="Europe" , cluster(isocode)
+est sto a6
+xi: reg I_Standing_Stone DIST_CLOSE_CER DIST_CLOSE i.continent if continent~="Europe" , cluster(isocode)
+est sto a7
+esta a* using TableF42.txt, title(Table F42) drop( _I*) replace se starl(* 0.10 ** 0.05 *** 0.01) s(r2 N)
+est clear
+
+***************************TABLE F43
+
+reg I_ruin1_grid std_diff , cluster(isocode)
+est sto a1
+reg I_ruin1_grid std_diff std_max , cluster(isocode)
+est sto a2
+xi: reg I_ruin1_grid std_diff std_max i.continent, cluster(isocode)
+est sto a3
+xi: reg I_ruin1_grid std_diff std_max i.isocode , cluster(isocode)
+est sto a4
+xi: reg dummy_ancient_city_450AD std_diff std_max , cluster(isocode)
+est sto a5
+xi: reg dummy_ancient_city_450AD std_diff std_max i.continent, cluster(isocode)
+est sto a6
+xi: reg dummy_ancient_city_500BC std_diff std_max , cluster(isocode)
+est sto a7
+xi: reg dummy_ancient_city_500BC std_diff std_max i.continent, cluster(isocode)
+est sto a8
+
+esta a* using TableF43.txt, title(Table F43) drop( _I*) se replace starl(* 0.10 ** 0.05 *** 0.01) s(r2 N)
+est clear
diff --git a/82/replication_package/DO_FILES/Replication Archaeological Results FINAL.do b/82/replication_package/DO_FILES/Replication Archaeological Results FINAL.do
new file mode 100644
index 0000000000000000000000000000000000000000..1651d37d8a5de375c41e1345ae33a57da4b32543
--- /dev/null
+++ b/82/replication_package/DO_FILES/Replication Archaeological Results FINAL.do
@@ -0,0 +1,71 @@
+
+
+******************************************************************
+****************************************************************** UPLOAD DATASET AND DEFINE VARIABLES
+
+use DATASET_ARCHAEOLOGY, clear
+
+gen ln1_ATLAS_ruin1_grid=ln(1+ATLAS_ruin1_grid)
+gen I_ATLAS_ruin1_grid=(ATLAS_ruin1_grid>0 & ATLAS_ruin1_grid~=.)
+gen ln1_ATLAS_Settlements_grid=ln(1+ATLAS_Settlements_grid)
+gen I_ATLAS_Settlements_grid=(ATLAS_Settlements_grid>0 & ATLAS_Settlements_grid~=.)
+
+label var I_ATLAS_ruin1_grid "Carbon-dated Archaeological evidence"
+label var I_ATLAS_Settlements_grid "Carbon-dated Archaeological evidence of settlements"
+
+label var ln1_ATLAS_ruin1_grid "Carbon-dated Archaeological evidence (ln(1+ruins))"
+label var ln1_ATLAS_Settlements_grid "Carbon-dated Archaeological evidence of settlements (ln(1+settlements))"
+
+
+******************************************************************
+****************************************************************** TABLES IN PAPER
+
+***************************TABLE 6
+
+reg I_ATLAS_ruin1_grid c.ATLAS_Agriculture##c.both c.ATLAS_Agriculture##c.only_cer c.ATLAS_Agriculture##c.only_rt , cluster(isocode)
+est sto a1
+reg I_ATLAS_ruin1_grid c.ATLAS_Agriculture##c.DIST_CLOSE_CER c.ATLAS_Agriculture##c.DIST_CLOSE , cluster(isocode)
+est sto a2
+reg ln1_ATLAS_ruin1_grid c.ATLAS_Agriculture##c.both c.ATLAS_Agriculture##c.only_cer c.ATLAS_Agriculture##c.only_rt , cluster(isocode)
+est sto a3
+reg ln1_ATLAS_ruin1_grid c.ATLAS_Agriculture##c.DIST_CLOSE_CER c.ATLAS_Agriculture##c.DIST_CLOSE , cluster(isocode)
+est sto a4
+
+reg I_ATLAS_Settlements_grid c.ATLAS_Agriculture##c.both c.ATLAS_Agriculture##c.only_cer c.ATLAS_Agriculture##c.only_rt , cluster(isocode)
+est sto a5
+reg I_ATLAS_Settlements_grid c.ATLAS_Agriculture##c.DIST_CLOSE_CER c.ATLAS_Agriculture##c.DIST_CLOSE , cluster(isocode)
+est sto a6
+reg ln1_ATLAS_Settlements_grid c.ATLAS_Agriculture##c.both c.ATLAS_Agriculture##c.only_cer c.ATLAS_Agriculture##c.only_rt , cluster(isocode)
+est sto a7
+reg ln1_ATLAS_Settlements_grid c.ATLAS_Agriculture##c.DIST_CLOSE_CER c.ATLAS_Agriculture##c.DIST_CLOSE , cluster(isocode)
+est sto a8
+esta a* using Table6.txt, title(Table 6) replace se starl(* 0.10 ** 0.05 *** 0.01) s(r2 N) order(c.ATLAS_Agriculture#c.only_cer c.ATLAS_Agriculture#c.both c.ATLAS_Agriculture#c.only_rt c.ATLAS_Agriculture#c.DIST_CLOSE_CER c.ATLAS_Agriculture#c.DIST_CLOSE) keep(c.ATLAS_Agriculture#c.only_cer c.ATLAS_Agriculture#c.both c.ATLAS_Agriculture#c.only_rt c.ATLAS_Agriculture#c.DIST_CLOSE_CER c.ATLAS_Agriculture#c.DIST_CLOSE)
+est clear
+
+
+******************************************************************
+****************************************************************** TABLES IN APPENDIX
+
+***************************TABLE F3 Panel B
+
+preserve
+keep if std_max!=. & only_cer!=.
+latabstat ATLAS_ruin1_grid ATLAS_Settlements_grid if std_max!=. & only_cer!=. , s(mean p50 sd Min Max N) f(%9.2fc) c(s) tf(TableF3_PanelB) replace
+restore
+
+***************************TABLE F44
+
+
+reg I_ATLAS_ruin1_grid c.ATLAS_Agriculture##c.std_diff c.ATLAS_Agriculture##c.std_max , cluster(isocode)
+est sto a1
+reg ln1_ATLAS_ruin1_grid c.ATLAS_Agriculture##c.std_diff c.ATLAS_Agriculture##c.std_max , cluster(isocode)
+est sto a3
+reg I_ATLAS_Settlements_grid c.ATLAS_Agriculture##c.std_diff c.ATLAS_Agriculture##c.std_max , cluster(isocode)
+est sto a5
+reg ln1_ATLAS_Settlements_grid c.ATLAS_Agriculture##c.std_diff c.ATLAS_Agriculture##c.std_max , cluster(isocode)
+est sto a7
+esta a* using TableF44.txt, title(Table F44) replace se starl(* 0.10 ** 0.05 *** 0.01) s(r2 N) keep( c.ATLAS_Agriculture#c.std_diff c.ATLAS_Agriculture#c.std_max)
+est clear
+
+
+
diff --git a/82/replication_package/DO_FILES/Replication Country Results FINAL.do b/82/replication_package/DO_FILES/Replication Country Results FINAL.do
new file mode 100644
index 0000000000000000000000000000000000000000..abe3f4fe3fe3ff41fe0d1a3573c8585453ab6b1a
--- /dev/null
+++ b/82/replication_package/DO_FILES/Replication Country Results FINAL.do
@@ -0,0 +1,679 @@
+
+******************************************************************
+****************************************************************** UPLOAD DATASET AND DEFINE VARIABLES
+use DATASET_COUNTRIES.dta, clear
+
+*dummies
+tabulate year, gen(dummy_Y_)
+tabulate isocode, gen(dummy_C_)
+
+*State capacity
+gen hierarchy_1=1 if (PUTTER2_S1>0 & PUTTER2_S1~=. )
+replace hierarchy_1=0 if (PUTTER2_S1==0 & PUTTER2_S1~=. )
+gen hierarchy_3=PUTTER2_S1
+
+
+*Old and New World
+gen old_world=1 if Continent=="Africa" | Continent=="Asia" | Continent=="Oceania"
+replace old_world=0 if Continent=="America"
+
+
+**calories before and after new crops
+*ante Old World
+local cereals_ante_OW "Barley_median_cal, Buckwheat_median_cal , Dryland_Rice_median_cal ,Foxtail_Millet_median_cal, Oat_median_cal ,Pearl_Millet_median_cal, Rye_median_cal ,Sorghum_median_cal, Wetland_Rice_median_cal, Wheat_median_cal"
+local tubers_ante_OW "Yams_median_cal"
+
+*ante New World
+local cereals_ante_NW "Maize_median_cal"
+local tubers_ante_NW "White_Potato_median_cal, Sweet_Potato_median_cal, Cassava_median_cal"
+
+
+**main regressors
+gen max_cal_ante_OW =max(`cereals_ante_OW' , `tubers_ante_OW', 0) /*here we have a zero because desertic places are considered as missing variables*/
+gen max_cal_ante_OW_t =max(`tubers_ante_OW' , 0)
+gen max_cal_ante_OW_c =max(`cereals_ante_OW' , 0)
+gen diff_cal_ante_OW =max_cal_ante_OW_c-max_cal_ante_OW_t
+
+gen max_cal_ante_NW =max(`cereals_ante_NW' , `tubers_ante_NW', 0)
+gen max_cal_ante_NW_t =max(`tubers_ante_NW' , 0)
+gen max_cal_ante_NW_c =max(`cereals_ante_NW' , 0)
+gen diff_cal_ante_NW =max_cal_ante_NW_c-max_cal_ante_NW_t
+
+gen max_cal_ante =max_cal_ante_OW if (Continent=="Asia" | Continent=="Europe" | Continent=="Africa" | Continent=="Oceania")
+replace max_cal_ante =max_cal_ante_NW if Continent=="America"
+
+gen max_cal_post_c =max(max_cal_ante_OW_c, max_cal_ante_NW_c , 0)
+gen max_cal_post_t =max(max_cal_ante_OW_t, max_cal_ante_NW_t , 0)
+gen max_cal_post =max(max_cal_ante_NW , max_cal_ante_OW, 0)
+
+gen diff_cal_ante =diff_cal_ante_OW if (Continent=="Asia" | Continent=="Europe" | Continent=="Africa" | Continent=="Oceania")
+replace diff_cal_ante =diff_cal_ante_NW if Continent=="America"
+
+gen diff_cal_post =max_cal_post_c-max_cal_post_t
+
+gen max_cal_year = max_cal_ante_OW if year<=1500 & (Continent=="Asia" | Continent=="Europe" | Continent=="Africa" | Continent=="Oceania")
+replace max_cal_year = max_cal_ante_NW if year<=1500 & Continent=="America"
+replace max_cal_year = max_cal_post if year>=1600
+
+gen diff_cal_year = diff_cal_ante_OW if year<=1500 & (Continent=="Asia" | Continent=="Europe" | Continent=="Africa" | Continent=="Oceania")
+replace diff_cal_year = diff_cal_ante_NW if year<=1500 & Continent=="America"
+replace diff_cal_year = diff_cal_post if year>=1600
+
+
+**Galor/Ozak measure of suitability of land
+gen max_cal_Galor_year = suit_GalOz_Pre if year<=1500
+replace max_cal_Galor_year = suit_GalOz_Post if yea>=1600
+
+
+
+**calories from plough positive and plough negative crops
+*these are the crops used in Alesina, Giuliano, Nunn.
+local plowpos_ante_OW "Barley_median_cal, Rye_median_cal , Wheat_median_cal"
+local plowneg_ante_OW "Foxtail_Millet_median_cal, Pearl_Millet_median_cal, Sorghum_median_cal"
+
+local plowpos_ante_NW "0"
+local plowneg_ante_NW "0"
+
+gen max_cal_ante_OW_pp =max(`plowpos_ante_OW' , 0)
+gen max_cal_ante_OW_pn =max(`plowneg_ante_OW' , 0)
+gen plow_cal_ante_OW =max_cal_ante_OW_pp-max_cal_ante_OW_pn
+
+gen max_cal_ante_NW_pp =max(`plowpos_ante_NW' , 0)
+gen max_cal_ante_NW_pn =max(`plowneg_ante_NW' , 0)
+gen plow_cal_ante_NW =max_cal_ante_NW_pp-max_cal_ante_NW_pn
+
+gen max_cal_post_pp =max(max_cal_ante_OW_pp,max_cal_ante_NW_pp , 0)
+gen max_cal_post_pn =max(max_cal_ante_OW_pn,max_cal_ante_NW_pn , 0)
+gen plow_cal_post =max_cal_post_pp-max_cal_post_pn
+
+gen plow_cal_year = plow_cal_ante_OW if year<=1500 & (Continent=="Asia" | Continent=="Europe" | Continent=="Africa" | Continent=="Oceania")
+replace plow_cal_year = plow_cal_ante_NW if year<=1500 & Continent=="America"
+replace plow_cal_year = plow_cal_post if year>=1600
+
+
+* alternative sample
+gen sample_time3=1 if (year<=1500 | year>=1750)
+gen sample_time5=1 if year>=1000 & (year<=1500 | year>=1600)
+
+*dummies
+tabulate Continent, generate(dum_continent_)
+global dummy1 "dum_continent_*"
+
+
+*standardize variables
+gen PUGA_abslat=abs(PUGA_lat)
+replace PUGA_tropical= PUGA_tropical/100
+
+egen std_PRECIP_mean_precip =std(PRECIP_mean_precip) if year>=1000
+egen std_ACEMOG_temp1 =std(ACEMOG_temp1) if year>=1000
+egen std_GEO_elev =std(GEO_elev) if year>=1000
+egen std_PUGA_rugged =std(PUGA_rugged) if year>=1000
+egen std_PUGA_abslat =std(PUGA_abslat) if year>=1000
+egen std_ACEMOG_lpd1500 =std(ACEMOG_lpd1500) if year>=1000
+egen std_ACEMOG_logem4 =std(ACEMOG_logem4) if year>=1000
+egen std_PUGA_slave_exports =std(PUGA_slave_exports) if year>=1000
+egen std_GEO_distr =std(GEO_distr) if year>=1000
+egen std_GEO_distcr =std(GEO_distcr) if year>=1000
+egen std_GALOR_pdiv_aa =std(GALOR_pdiv_aa) if year>=1000
+egen std_max_cal_year =std(max_cal_year) if year>=1000
+
+
+egen std1_PRECIP_mean_precip =std(PRECIP_mean_precip) if year==450
+egen std1_ACEMOG_temp1 =std(ACEMOG_temp1) if year==450
+egen std1_GEO_elev =std(GEO_elev) if year==450
+egen std1_PUGA_rugged =std(PUGA_rugged) if year==450
+egen std1_PUGA_abslat =std(PUGA_abslat) if year==450
+egen std1_ACEMOG_lpd1500 =std(ACEMOG_lpd1500) if year==450
+egen std1_ACEMOG_logem4 =std(ACEMOG_logem4) if year==450
+egen std1_PUGA_slave_exports =std(PUGA_slave_exports) if year==450
+egen std1_GEO_distr =std(GEO_distr) if year==450
+egen std1_GEO_distcr =std(GEO_distcr) if year==450
+egen std1_GALOR_pdiv_aa =std(GALOR_pdiv_aa) if year==450
+egen std1_max_cal_year =std(max_cal_year) if year==450
+
+
+
+egen std_max_cal_Galor_year =std(max_cal_Galor_year) if year>=1000
+
+
+egen std_diff_cal_year =std(diff_cal_year) if year>=1000
+
+egen std_max_cal_ante1 =std(max_cal_ante) if year>=0
+egen std_max_cal_ante =std(max_cal_ante) if year>=1000
+egen std_max_cal_post =std(max_cal_post) if year>=1000
+
+egen std_diff_cal_ante1 =std(diff_cal_ante) if year>=0
+egen std_diff_cal_ante =std(diff_cal_ante) if year>=1000
+egen std_diff_cal_post =std(diff_cal_post) if year>=1000
+
+egen std_plow_cal_year =std(plow_cal_year) if year>=1000
+
+gen std_max_cal_yearPOST_ANTE =std_max_cal_post-std_max_cal_ante
+
+gen std_diff_cal_yearPOST_ANTE =std_diff_cal_post-std_diff_cal_ante
+
+
+
+*controls
+gen post=1 if year>1500
+replace post=0 if year<=1500
+
+gen precipitation_post =std_PRECIP_mean_precip*post
+gen temperature_post =std_ACEMOG_temp1*post
+gen elevation_post =std_GEO_elev*post
+gen rugged_post =std_PUGA_rugged*post
+gen abslat_post =std_PUGA_abslat*post
+gen legor_fra_post =PUGA_legor_fra*post
+gen legor_soc_post =PUGA_legor_soc*post
+gen legor_deu_post =PUGA_legor_deu*post
+gen legor_sca_post =PUGA_legor_sca*post
+gen slave_exports_post =std_PUGA_slave_exports*post
+gen lpd1500s_post =std_ACEMOG_lpd1500*post
+gen logem4_post =std_ACEMOG_logem4*post
+gen genetic_div_post =std_GALOR_pdiv_aa*post
+
+gen distr_post =std_GEO_distr *post
+gen distcr_post =std_GEO_distcr*post
+gen Mal46a_post =GEO_Mal46a*post
+
+gen tropical_post =PUGA_tropical*post
+gen plow_post =std_plow_cal_year*post
+
+gen area_post =area1*post
+
+gen animal_density_post =animal_density*post
+gen ruminant_density_post =ruminant_density*post
+
+gen irrigation_post =BENTZEN_irri_impact5*post
+
+*variables interacted with year dummies
+foreach lname of num 1(1)20 {
+gen std_max_cal_ante__`lname'= std_max_cal_ante*dummy_Y_`lname'
+}
+
+foreach lname of num 1(1)20 {
+gen std_diff_cal_ante__`lname'= std_diff_cal_ante*dummy_Y_`lname'
+}
+
+foreach lname of num 1(1)20 {
+gen std_max_cal_post__`lname'= std_max_cal_post*dummy_Y_`lname'
+}
+
+foreach lname of num 1(1)20 {
+gen std_diff_cal_post__`lname'= std_diff_cal_post*dummy_Y_`lname'
+}
+
+foreach lname of num 1(1)20 {
+gen std_max_cal_yearPOST_ANTE__`lname'= std_max_cal_yearPOST_ANTE*dummy_Y_`lname'
+}
+
+foreach lname of num 1(1)20 {
+gen std_diff_cal_yearPOST_ANTE__`lname'= std_diff_cal_yearPOST_ANTE*dummy_Y_`lname'
+}
+
+foreach year1 of numlist 1000 1500 1600 1650 1700 1750 {
+gen std_max_cal_year`year1'_1 =std_max_cal_year if year==`year1'
+egen std_max_cal_year`year1' =max(std_max_cal_year`year1'_1), by(country)
+
+gen std_diff_cal_year`year1'_1 =std_diff_cal_year if year==`year1'
+egen std_diff_cal_year`year1' =max(std_diff_cal_year`year1'_1), by(country)
+
+gen hierarchy_3_`year1'_1 =hierarchy_3 if year==`year1'
+egen hierarchy_3_`year1' =max(hierarchy_3_`year1'_1), by(country)
+}
+
+foreach year1 of numlist 1600 1650 1700 1750 {
+gen std_max_cal_year_1500_`year1' =std_max_cal_year`year1' -std_max_cal_year1500
+gen std_diff_cal_year_1500_`year1' =std_diff_cal_year`year1' -std_diff_cal_year1500
+gen hierarchy_3_1500_`year1' =hierarchy_3_`year1' -hierarchy_3_1500
+}
+
+*variables interacted with trend
+gen std_diff_cal_yearPOST_ANTE_inty=std_diff_cal_yearPOST_ANTE*year
+gen std_max_cal_yearPOST_ANTE_inty=std_max_cal_yearPOST_ANTE*year
+
+
+save TEMP_PANEL_country, replace
+
+
+******************************************************************
+****************************************************************** TABLES IN PAPER
+use TEMP_PANEL_country, clear
+
+***************************TABLE 2
+
+ivreg2 hierarchy_3 only_cer if year==450 , r
+est sto a1
+ivreg2 hierarchy_3 only_cer only_rt both if year==450 , r
+est sto a2
+ivreg2 hierarchy_3 $dummy1 only_cer only_rt both if year==450 , r
+est sto a3
+ivreg2 hierarchy_3 $dummy1 only_cer only_rt both PUGA_abslat if year==450 , r
+est sto a4
+ivreg2 hierarchy_3 $dummy1 only_cer only_rt both PRECIP_mean_precip if year==450 , r
+est sto a5
+ivreg2 hierarchy_3 $dummy1 only_cer only_rt both ACEMOG_temp1 if year==450 , r
+est sto a6
+ivreg2 hierarchy_3 $dummy1 only_cer only_rt both GEO_elev if year==450 , r
+est sto a7
+ivreg2 hierarchy_3 $dummy1 only_cer only_rt both PUGA_rugged if year==450 , r
+est sto a8
+
+local controls "only_rt both PUGA_legor_fra PUGA_legor_soc PUGA_legor_deu PUGA_legor_sca PRECIP_mean_precip ACEMOG_temp1 GEO_elev PUGA_rugged PUGA_abslat dum_continent_* std1_ACEMOG_lpd1500 std1_ACEMOG_logem4 std1_PUGA_slave_exports std1_GALOR_pdiv_aa std1_GEO_distr std1_GEO_distcr GEO_Mal46a PUGA_tropical animal_density ruminant_density BENTZEN_irri_impact5"
+ivlasso hierarchy_3 only_cer (`controls') if year==450 , sqrt cluster(isocode)
+est sto a9
+esta a* using Table2.txt, s(N r2) replace se starl(* 0.10 ** 0.05 *** 0.01) drop($dummy1) title(TABLE 2)
+est clear
+
+***************************TABLE 3
+
+ivreg2 hierarchy_3 std_max_cal_year dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a0
+ivreg2 hierarchy_3 std_diff_cal_year dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a1
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a2
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year precipitation_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a3
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year temperature_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a4
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year elevation_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a5
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year rugged_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a6
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year abslat_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a7
+
+local controls "std_max_cal_year precipitation_post temperature_post elevation_post rugged_post abslat_post dummy_C_* dummy_Y_* legor_*post lpd1500s_post logem4_post slave_exports_post distr_post distcr_post Mal46a_post tropical_post genetic_div_post animal_density_post ruminant_density_post irrigation_post"
+ivlasso hierarchy_3 std_diff_cal_year (`controls') if sample_time5==1 , sqrt cluster(isocode)
+est sto a8
+
+esta a* using Table3.txt, s(N r2) replace order(std_diff_cal_year std_max_cal_year) se starl(* 0.10 ** 0.05 *** 0.01) drop(dummy_C_* dummy_Y_*) title(TABLE 3)
+est clear
+
+
+
+******************************************************************
+****************************************************************** TABLES IN APPENDIX
+
+***************************FIGURE F3
+
+preserve
+ivreg2 hierarchy_3 std_max_cal_year dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+gen samp=e(sample)
+keep if e(sample)==1
+keep country year name_colonizer
+gen colony_=(name_colonizer!="")
+egen colony_ever=max(colony_), by(country)
+keep if colony_ever==1 & year>=1400
+sort country year
+encode country, gen(country1)
+
+gen country2=0
+replace country2=country1
+browse country2 country1 if year==1400
+drop country2
+
+drop country name_colonizer colony_ever
+rename colony_ v_
+reshape wide v_, i(year) j(country1)
+foreach l of numlist 1/108 {
+replace v_`l'=`l' if v_`l'==1
+replace v_`l'=. if v_`l'==0
+}
+
+label define countries ///
+1 "Albania" ///
+2 "Algeria" ///
+3 "Angola" ///
+4 "Argentina" ///
+5 "Armenia" ///
+6 "Australia" ///
+7 "Azerbaijan" ///
+8 "Bangladesh" ///
+9 "Barbados" ///
+10 "Belarus" ///
+11 "Benin" ///
+12 "Bolivia" ///
+13 "Bosnia Herzegovina" ///
+14 "Botswana" ///
+15 "Brazil" ///
+16 "Bulgaria" ///
+17 "Burkina Faso" ///
+18 "Burundi" ///
+19 "Comoros" ///
+20 "Cambodia" ///
+21 "Cameroon" ///
+22 "Canada" ///
+23 "Cape Verde" ///
+24 "Central African Republc" ///
+25 "Chad" ///
+26 "Chile" ///
+27 "Colombia" ///
+28 "Congo, Rep." ///
+29 "Costa Rica" ///
+30 "Cote d'Ivoire" ///
+31 "Cuba" ///
+32 "Democr Rep. of Congo" ///
+33 "Dominican Republic" ///
+34 "Equatorial Guinea" ///
+35 "Ecuador" ///
+36 "Egypt, Arab Rep." ///
+37 "El Salvador" ///
+38 "Eritrea" ///
+39 "Gabon" ///
+40 "Gambia, The" ///
+41 "Georgia" ///
+42 "Ghana" ///
+43 "Grenada" ///
+44 "Guatemala" ///
+45 "Guinea" ///
+46 "Guyana" ///
+47 "Haiti" ///
+48 "Honduras" ///
+49 "Hong Kong, China" ///
+50 "India" ///
+51 "Indonesia" ///
+52 "Iraq" ///
+53 "Israel" ///
+54 "Jamaica" ///
+55 "Jordan" ///
+56 "Kenya" ///
+57 "Kyrgyzstan" ///
+58 "Laos" ///
+59 "Latvia" ///
+60 "Lebanon" ///
+61 "Lesotho" ///
+62 "Libya" ///
+63 "Lithuania" ///
+64 "Madagascar" ///
+65 "Malawi" ///
+66 "Malaysia" ///
+67 "Mali" ///
+68 "Mauritania" ///
+69 "Mexico" ///
+70 "Morocco" ///
+71 "Mozambique" ///
+72 "Myanmar" ///
+73 "Namibia" ///
+74 "New Zealand" ///
+75 "Nicaragua" ///
+76 "Niger" ///
+77 "Nigeria" ///
+78 "Pakistan" ///
+79 "Panama" ///
+80 "Papua New Guinea" ///
+81 "Paraguay" ///
+82 "Peru" ///
+83 "Philippines" ///
+84 "Rwanda" ///
+85 "Senegal" ///
+86 "Serbia and Montenegro" ///
+87 "Sierra Leone" ///
+88 "Singapore" ///
+89 "Somalia" ///
+90 "South Africa" ///
+91 "Sri Lanka" ///
+92 "Sudan" ///
+93 "Swaziland" ///
+94 "Syrian Arab Rep." ///
+95 "Tanzania" ///
+96 "Togo" ///
+97 "Trinidad and Tobago" ///
+98 "Tunisia" ///
+99 "Turkmenistan" ///
+100 "Uganda" ///
+101 "United States" ///
+102 "Uruguay" ///
+103 "Uzbekistan" ///
+104 "Venezuela" ///
+105 "Vietnam" ///
+106 "Yemen" ///
+107 "Zambia" ///
+108 "Zimbabwe"
+
+foreach l of numlist 1/108 {
+ label val v_`l' countries
+}
+
+foreach l of numlist 108/1 {
+ order v_`l'
+}
+
+scatter v_1-v_54 year if year<1950, ylabel(1(1)54) ylabel(, val angle(horizontal) labsize(vsmall)) xlabel(, angle(45) labsize(vsmall)) xlabel(1400(50)1900) xtitle("Years") graphregion(fcolor(white) lwidth(medthin) lcolor(black)) legend(off)
+graph save "Time_Coverage_Colony_p1.gph", replace
+graph export FigureF3_part2, as(pdf) replace
+scatter v_55-v_108 year if year<1950, ylabel(55(1)108) ylabel(, val angle(horizontal) labsize(vsmall)) xlabel(, angle(45) labsize(vsmall)) xlabel(1400(50)1900) xtitle("Years") graphregion(fcolor(white) lwidth(medthin) lcolor(black)) legend(off)
+graph save "Time_Coverage_Colony_p2.gph", replace
+graph export FigureF3_part1, as(pdf) replace
+restore
+erase "Time_Coverage_Colony_p1.gph"
+erase "Time_Coverage_Colony_p2.gph"
+
+
+
+
+***************************TABLE F2
+latabstat hierarchy_3 std_max_cal_year std_diff_cal_year only_cer only_rt both ///
+ std_PRECIP_mean_precip std_ACEMOG_temp1 std_GEO_elev std_PUGA_rugged std_PUGA_abslat ///
+ PUGA_legor_* std_ACEMOG_lpd1500 std_ACEMOG_logem4 std_PUGA_slave_exports std_GALOR_pdiv_aa ///
+ animal_density ruminant_density ///
+ std_GEO_distr std_GEO_distcr GEO_Mal46a PUGA_tropical BENTZEN_irri_impact5 std_max_cal_Galor_year ///
+ if sample_time5==1 , s(mean p50 sd Min Max N) f(%9.2fc) c(s) tf(TableF2) replace
+
+
+***************************TABLE F23
+
+ivreg2 hierarchy_3 $dummy1 only_cer only_rt both PUGA_legor_fra PUGA_legor_soc PUGA_legor_deu PUGA_legor_sca if year==450 , r
+est sto a1
+ivreg2 hierarchy_3 $dummy1 only_cer only_rt both std1_ACEMOG_lpd1500 if year==450 , r
+est sto a2
+ivreg2 hierarchy_3 $dummy1 only_cer only_rt both std1_ACEMOG_logem4 if year==450 , r
+est sto a3
+ivreg2 hierarchy_3 $dummy1 only_cer only_rt both std1_PUGA_slave_exports if year==450 , r
+est sto a4
+ivreg2 hierarchy_3 $dummy1 only_cer only_rt both std1_GALOR_pdiv_aa if year==450 , r
+est sto a5
+ivreg2 hierarchy_3 $dummy1 only_cer only_rt both std1_GEO_distr if year==450 , r
+est sto a6
+ivreg2 hierarchy_3 $dummy1 only_cer only_rt both std1_GEO_distcr if year==450 , r
+est sto a7
+esta a* using TableF23.txt, replace s(N r2) order(only_cer only_rt both) se drop($dummy1) starl(* 0.10 ** 0.05 *** 0.01) title(Table F23)
+est clear
+
+***************************TABLE F24
+
+ivreg2 hierarchy_3 $dummy1 only_cer only_rt both GEO_Mal46a if year==450 , r
+est sto a1
+ivreg2 hierarchy_3 $dummy1 only_cer only_rt both PUGA_tropical if year==450 , r
+est sto a2
+ivreg2 hierarchy_3 $dummy1 only_cer only_rt both animal_density if year==450 , r
+est sto a3
+ivreg2 hierarchy_3 $dummy1 only_cer only_rt both ruminant_density if year==450 , r
+est sto a4
+ivreg2 hierarchy_3 $dummy1 only_cer only_rt both BENTZEN_irri_impact5 if year==450 , r
+est sto a5
+esta a* using TableF24.txt, replace s(N r2) order(only_cer only_rt both) se drop($dummy1) starl(* 0.10 ** 0.05 *** 0.01) title(Table F24)
+est clear
+
+***************************TABLE F25
+foreach cont in "Africa" "Asia" "Europe" "America" "Oceania"{
+ivreg2 hierarchy_3 $dummy1 only_cer only_rt both if year==450 & Continent!="`cont'", r
+est sto a2`cont'
+}
+esta a* using TableF25.txt, title(TABLE F25) drop($dummy1) se replace starl(* 0.10 ** 0.05 *** 0.01) s(r2 N)
+est clear
+
+
+***************************TABLE F26
+ivreg2 hierarchy_3 $dummy1 std_diff_cal_ante1 std_max_cal_ante1 if year==450 , r
+est sto a1
+ivreg2 hierarchy_3 $dummy1 std_diff_cal_ante1 std_max_cal_ante1 PUGA_abslat if year==450 , r
+est sto a2
+ivreg2 hierarchy_3 $dummy1 std_diff_cal_ante1 std_max_cal_ante1 PRECIP_mean_precip if year==450 , r
+est sto a3
+ivreg2 hierarchy_3 $dummy1 std_diff_cal_ante1 std_max_cal_ante1 ACEMOG_temp1 if year==450 , r
+est sto a4
+ivreg2 hierarchy_3 $dummy1 std_diff_cal_ante1 std_max_cal_ante1 GEO_elev if year==450 , r
+est sto a5
+ivreg2 hierarchy_3 $dummy1 std_diff_cal_ante1 std_max_cal_ante1 PUGA_rugged if year==450 , r
+est sto a6
+
+
+esta a* using TableF26.txt, s(N r2) replace order(std_diff_cal_ante1 std_max_cal_ante1) drop($dummy1) se starl(* 0.10 ** 0.05 *** 0.01) title(Table F26)
+est clear
+
+***************************TABLE F27
+
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year legor_*post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a1
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year lpd1500s_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a2
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year logem4_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a3
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year slave_exports_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a4
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year genetic_div_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a5
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year distr_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a6
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year distcr_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a7
+esta a* using TableF27.txt, replace s(N r2) order(std_diff_cal_year std_max_cal_year) se starl(* 0.10 ** 0.05 *** 0.01) drop(dummy_C_* dummy_Y_*) title(Table F27)
+est clear
+
+***************************TABLE F28
+
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year Mal46a_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a1
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year tropical_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a2
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year animal_density_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a3
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year ruminant_density_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a4
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year irrigation_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a5
+
+esta a* using TableF28.txt, replace s(N r2) order(std_diff_cal_year std_max_cal_year) se starl(* 0.10 ** 0.05 *** 0.01) drop(dummy_C_* dummy_Y_*) title(Table F28)
+est clear
+
+***************************TABLE F29
+ivreg2 hierarchy_3 std_diff_cal_year dummy_C_* dummy_Y_* if sample_time5==1 & name_colonizer=="", cluster(isocode )
+est sto a1
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year dummy_C_* dummy_Y_* if sample_time5==1 & name_colonizer=="", cluster(isocode )
+est sto a2
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year precipitation_post dummy_C_* dummy_Y_* if sample_time5==1 & name_colonizer=="", cluster(isocode )
+est sto a3
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year temperature_post dummy_C_* dummy_Y_* if sample_time5==1 & name_colonizer=="", cluster(isocode )
+est sto a4
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year elevation_post dummy_C_* dummy_Y_* if sample_time5==1 & name_colonizer=="", cluster(isocode )
+est sto a5
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year rugged_post dummy_C_* dummy_Y_* if sample_time5==1 & name_colonizer=="", cluster(isocode )
+est sto a6
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year abslat_post dummy_C_* dummy_Y_* if sample_time5==1 & name_colonizer=="", cluster(isocode )
+est sto a7
+
+esta a* using TableF29.txt, replace s(N r2) order(std_diff_cal_year std_max_cal_year) se starl(* 0.10 ** 0.05 *** 0.01) drop(dummy_C_* dummy_Y_*) title(Table F29)
+est clear
+
+***************************TABLE F30
+
+ivreg2 hierarchy_1 std_diff_cal_year dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a1
+ivreg2 hierarchy_1 std_max_cal_year std_diff_cal_year dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a2
+ivreg2 hierarchy_1 std_max_cal_year std_diff_cal_year precipitation_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a3
+ivreg2 hierarchy_1 std_max_cal_year std_diff_cal_year temperature_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a4
+ivreg2 hierarchy_1 std_max_cal_year std_diff_cal_year elevation_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a5
+ivreg2 hierarchy_1 std_max_cal_year std_diff_cal_year rugged_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a6
+ivreg2 hierarchy_1 std_max_cal_year std_diff_cal_year abslat_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a7
+
+esta a* using TableF30.txt, replace s(N r2) order(std_diff_cal_year std_max_cal_year) se starl(* 0.10 ** 0.05 *** 0.01) drop(dummy_C_* dummy_Y_*) title(Table F30)
+est clear
+
+***************************TABLE F31
+
+ivreg2 hierarchy_3 std_diff_cal_year dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a1
+ivreg2 hierarchy_3 std_max_cal_Galor_year std_diff_cal_year dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a2
+ivreg2 hierarchy_3 std_max_cal_Galor_year std_diff_cal_year precipitation_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a3
+ivreg2 hierarchy_3 std_max_cal_Galor_year std_diff_cal_year temperature_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a4
+ivreg2 hierarchy_3 std_max_cal_Galor_year std_diff_cal_year elevation_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a5
+ivreg2 hierarchy_3 std_max_cal_Galor_year std_diff_cal_year rugged_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a6
+ivreg2 hierarchy_3 std_max_cal_Galor_year std_diff_cal_year abslat_post dummy_C_* dummy_Y_* if sample_time5==1 , cluster(isocode )
+est sto a7
+
+esta a* using TableF31.txt, replace s(N r2) order(std_diff_cal_year std_max_cal_Galor_year) se starl(* 0.10 ** 0.05 *** 0.01) drop(dummy_C_* dummy_Y_*) title(Table F31)
+est clear
+
+***************************TABLE F32
+
+ivreg2 hierarchy_3 std_diff_cal_year dummy_C_* dummy_Y_* if year>=1000 & (year<=1500 | year>=1750) , cluster(isocode )
+est sto a1
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year dummy_C_* dummy_Y_* if year>=1000 & (year<=1500 | year>=1750) , cluster(isocode )
+est sto a2
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year precipitation_post dummy_C_* dummy_Y_* if year>=1000 & (year<=1500 | year>=1750) , cluster(isocode )
+est sto a3
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year temperature_post dummy_C_* dummy_Y_* if year>=1000 & (year<=1500 | year>=1750) , cluster(isocode )
+est sto a4
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year elevation_post dummy_C_* dummy_Y_* if year>=1000 & (year<=1500 | year>=1750) , cluster(isocode )
+est sto a5
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year rugged_post dummy_C_* dummy_Y_* if year>=1000 & (year<=1500 | year>=1750) , cluster(isocode )
+est sto a6
+ivreg2 hierarchy_3 std_max_cal_year std_diff_cal_year abslat_post dummy_C_* dummy_Y_* if year>=1000 & (year<=1500 | year>=1750) , cluster(isocode )
+est sto a7
+
+esta a* using TableF32.txt, replace s(N r2) order(std_diff_cal_year std_max_cal_year) se starl(* 0.10 ** 0.05 *** 0.01) drop(dummy_C_* dummy_Y_*) title(Table F32)
+est clear
+
+
+***************************TABLE F33
+
+ivreg2 hierarchy_3 std_diff_cal_yearPOST_ANTE_inty year std_diff_cal_yearPOST_ANTE dummy_C_* dummy_Y_* if year>=1000 & year<=1500 , cluster(isocode )
+est sto a1
+ivreg2 hierarchy_3 std_diff_cal_yearPOST_ANTE_inty year std_diff_cal_yearPOST_ANTE std_max_cal_yearPOST_ANTE_inty std_max_cal_yearPOST_ANTE dummy_C_* dummy_Y_* if year>=1000 & year<=1500 , cluster(isocode )
+est sto a2
+ivreg2 hierarchy_3 std_diff_cal_yearPOST_ANTE_inty year std_diff_cal_yearPOST_ANTE std_max_cal_yearPOST_ANTE_inty std_max_cal_yearPOST_ANTE precipitation_post dummy_C_* dummy_Y_* if year>=1000 & year<=1500 , cluster(isocode )
+est sto a3
+ivreg2 hierarchy_3 std_diff_cal_yearPOST_ANTE_inty year std_diff_cal_yearPOST_ANTE std_max_cal_yearPOST_ANTE_inty std_max_cal_yearPOST_ANTE temperature_post dummy_C_* dummy_Y_* if year>=1000 & year<=1500 , cluster(isocode )
+est sto a4
+ivreg2 hierarchy_3 std_diff_cal_yearPOST_ANTE_inty year std_diff_cal_yearPOST_ANTE std_max_cal_yearPOST_ANTE_inty std_max_cal_yearPOST_ANTE elevation_post dummy_C_* dummy_Y_* if year>=1000 & year<=1500 , cluster(isocode )
+est sto a5
+ivreg2 hierarchy_3 std_diff_cal_yearPOST_ANTE_inty year std_diff_cal_yearPOST_ANTE std_max_cal_yearPOST_ANTE_inty std_max_cal_yearPOST_ANTE rugged_post dummy_C_* dummy_Y_* if year>=1000 & year<=1500 , cluster(isocode )
+est sto a6
+ivreg2 hierarchy_3 std_diff_cal_yearPOST_ANTE_inty year std_diff_cal_yearPOST_ANTE std_max_cal_yearPOST_ANTE_inty std_max_cal_yearPOST_ANTE abslat_post dummy_C_* dummy_Y_* if year>=1000 & year<=1500 , cluster(isocode )
+est sto a7
+
+esta a* using TableF33.txt, replace s(N r2) order(std_diff_cal_yearPOST_ANTE std_diff_cal_yearPOST_ANTE_inty std_max_cal_yearPOST_ANTE std_max_cal_yearPOST_ANTE_inty) keep(std_diff_cal_yearPOST_ANTE_inty std_max_cal_yearPOST_ANTE_inty ) se starl(* 0.10 ** 0.05 *** 0.01) title(Table F33)
+est clear
+
+***************************TABLE F34
+
+ivreg2 hierarchy_3 std_diff_cal_yearPOST_ANTE__3-std_diff_cal_yearPOST_ANTE__19 dummy_C_* dummy_Y_* if year>=1000 & year<=1850 , cluster(isocode )
+est sto a1
+ivreg2 hierarchy_3 std_diff_cal_yearPOST_ANTE__3-std_diff_cal_yearPOST_ANTE__19 std_max_cal_yearPOST_ANTE__3-std_max_cal_yearPOST_ANTE__19 dummy_C_* dummy_Y_* if year>=1000 & year<=1850 , cluster(isocode )
+est sto a2
+ivreg2 hierarchy_3 std_diff_cal_yearPOST_ANTE__3-std_diff_cal_yearPOST_ANTE__19 std_max_cal_yearPOST_ANTE__3-std_max_cal_yearPOST_ANTE__19 precipitation_post dummy_C_* dummy_Y_* if year>=1000 & year<=1850 , cluster(isocode )
+est sto a3
+ivreg2 hierarchy_3 std_diff_cal_yearPOST_ANTE__3-std_diff_cal_yearPOST_ANTE__19 std_max_cal_yearPOST_ANTE__3-std_max_cal_yearPOST_ANTE__19 temperature_post dummy_C_* dummy_Y_* if year>=1000 & year<=1850 , cluster(isocode )
+est sto a4
+ivreg2 hierarchy_3 std_diff_cal_yearPOST_ANTE__3-std_diff_cal_yearPOST_ANTE__19 std_max_cal_yearPOST_ANTE__3-std_max_cal_yearPOST_ANTE__19 elevation_post dummy_C_* dummy_Y_* if year>=1000 & year<=1850 , cluster(isocode )
+est sto a5
+ivreg2 hierarchy_3 std_diff_cal_yearPOST_ANTE__3-std_diff_cal_yearPOST_ANTE__19 std_max_cal_yearPOST_ANTE__3-std_max_cal_yearPOST_ANTE__19 rugged_post dummy_C_* dummy_Y_* if year>=1000 & year<=1850 , cluster(isocode )
+est sto a6
+ivreg2 hierarchy_3 std_diff_cal_yearPOST_ANTE__3-std_diff_cal_yearPOST_ANTE__19 std_max_cal_yearPOST_ANTE__3-std_max_cal_yearPOST_ANTE__19 abslat_post dummy_C_* dummy_Y_* if year>=1000 & year<=1850 , cluster(isocode )
+est sto a7
+
+esta a* using TableF34.txt, replace s(N r2) order(std_diff_cal_yearPOST_ANTE__*) keep(std_diff_cal_yearPOST_ANTE__*) se starl(* 0.10 ** 0.05 *** 0.01) title(Table F34)
+est clear
diff --git a/82/replication_package/DO_FILES/Replication EthnoAtlas FINAL.do b/82/replication_package/DO_FILES/Replication EthnoAtlas FINAL.do
new file mode 100644
index 0000000000000000000000000000000000000000..39607492e03da8373ed6769bc7cc1d671d371faa
--- /dev/null
+++ b/82/replication_package/DO_FILES/Replication EthnoAtlas FINAL.do
@@ -0,0 +1,806 @@
+
+
+global outopts dec(3) label nocons excel ctitle(" ") cttop(" ") nonotes drop(const)
+
+
+***Preamble
+capture program drop newcov
+ program define newcov, eclass
+ ereturn repost V=cov_dep
+end
+
+capture program drop F_stat_ei
+program define F_stat_ei, eclass
+ereturn scalar widstat=Fstat
+end
+
+***Conley's logit
+cap program drop conleylogitmfx
+program define conleylogitmfx
+ args depvar outfile ncont
+ preserve
+ for @ in any latitude longitude `depvar' const $currentcontrols: drop if missing(@)==1
+ keep if `depvar'~=.
+ xgmlt latitude longitude c1 c2 `depvar' $currentcontrols const, xreg(`ncont') coord(2)
+ logit `depvar' $currentcontrols
+ newcov
+ outreg2 using `outfile', $outopts append e(N r2_p) tex
+
+ restore
+end
+
+***Conley's OLS
+cap program drop conleyols
+program define conleyols
+ args depvar outfile ncont
+ preserve
+ ereturn clear
+ cap drop epsilon window dis1 dis2
+ for @ in any latitude longitude `depvar' const $currentcontrols: drop if missing(@)==1
+ x_ols latitude longitude c1 c2 `depvar' $currentcontrols const, xreg(`ncont') coord(2)
+ ivreg2 `depvar' $currentcontrols const, noc
+ newcov
+ estimates replay
+ outreg2 using `outfile', $outopts append e(N r2c) tex
+
+ restore
+end
+
+
+***Conley's IV
+cap program drop conleyiv
+program define conleyiv
+args depvar outfile nregr ninstr
+
+preserve
+ereturn clear
+
+for @ in any latitude longitude `depvar' const $currentendoregressors $currentexoregressors $currentinstruments: drop if missing(@)==1
+
+local num_instr : list sizeof global(currentinstruments)
+local num_exoreg : list sizeof global(currentexoregressors)
+display `num_instr'
+display `num_exoreg'
+
+scalar nreg_num=`num_instr'+`num_exoreg'+1
+local nreg_num1=nreg_num
+cap drop zubar*
+cap drop dis1 dis2
+display `nreg_num1'
+x_ols latitude longitude c1 c2 $currentendoregressors $currentinstruments $currentexoregressors const, xreg(`nreg_num1') coord(2)
+matrix coefficient=e(b)
+scalar main_coef=coefficient[1,1]
+scalar main_var=cov_dep[1,1]
+scalar main_se=sqrt(main_var)
+scalar main_t=main_coef/main_se
+scalar Fstat=main_t*main_t
+
+cap drop zubar*
+cap drop dis1 dis2
+x_gmm latitude longitude c1 c2 `depvar' $currentendoregressors $currentexoregressors const $currentinstruments $currentexoregressors const, xreg(`nregr') coord(2) inst(`ninstr')
+
+ivreg2 `depvar' ($currentendoregressors =$currentinstruments ) $currentexoregressors const, noc
+newcov
+F_stat_ei
+estimates replay
+outreg2 using `outfile', $outopts append addstat(Cragg-Donald Wald F, `e(widstat)') tex
+
+
+restore
+end
+
+
+
+******************************************************************
+****************************************************************** UPLOAD DATASET AND DEFINE VARIABLES
+
+use DATASET_ETHNOATLAS.dta, clear
+keep if year~=.
+keep if year>=1500
+keep if Barley_point_cal!=. /*Delete observations without agricultural data*/
+
+**generate main regressors
+
+gen L_hier1=V33 if V33~=0 /*Jurisdictional Hierarchy Beyond Local Community: 0(missing) 1 (no political authority beyond community), 2 (one level) to 5 (for levels)*/
+
+gen L_crop_cereals=1 if V29==6
+replace L_crop_cereals=0 if L_crop_cereals==. & V29~=. & V29~=0
+gen cereals=L_crop_cereals
+
+
+gen L_surplus=0 if TUDEN_MARSHALL_v93==1
+replace L_surplus=1 if TUDEN_MARSHALL_v93<10 & TUDEN_MARSHALL_v93>1
+
+gen Tax_burden=0 if SCSS_v1737==1
+replace Tax_burden=1 if SCSS_v1737==2 | SCSS_v1737==3 | SCSS_v1737==6
+replace Tax_burden=2 if SCSS_v1737==4 | SCSS_v1737==5 | SCSS_v1737==7
+label var Tax_burden "=0 no tax; =1 small tax; =2 regular and relevant tax"
+
+gen depend_agric = (5-0)/2 if V5==0
+replace depend_agric = 6+(15-6)/2 if V5==1
+replace depend_agric = 16+(25-16)/2 if V5==2
+replace depend_agric = 26+(35-26)/2 if V5==3
+replace depend_agric = 36+(45-36)/2 if V5==4
+replace depend_agric = 46+(55-46)/2 if V5==5
+replace depend_agric = 56+(65-56)/2 if V5==6
+replace depend_agric = 66+(75-66)/2 if V5==7
+replace depend_agric = 76+(85-76)/2 if V5==8
+replace depend_agric = 86+(100-86)/2 if V5==9
+replace depend_agric = depend_agric/100
+
+gen Cal_positive_plow1=max(Wheat_point_cal, Barley_point_cal ,Rye_point_cal)
+gen Cal_negative_plow1=max(Foxtail_Millet_point_cal , Pearl_Millet_point_cal ,Sorghum_point_cal)
+gen Plow_advantage1 =Cal_positive_plow1-Cal_negative_plow1
+
+gen Animal_husbandry1b=1 if V4>0 & V4!=.
+replace Animal_husbandry1b=0 if V4==0
+tabulate Animal_husbandry1b, gen(dummy_Animal_husbandry1b_)
+
+gen Animal_cultivation2=(V39==2 | V39==3) if V39!=0
+tabulate Animal_cultivation2, gen(dummy_Animal_cultivation2_)
+
+gen Ruminants=1 if V40==3 | V40==7
+replace Ruminants=0 if Ruminants==.
+
+gen max_cal_point_c1=max(Barley_point_cal, Buckwheat_point_cal , Dryland_Rice_point_cal ,Foxtail_Millet_point_cal, Maize_point_cal ,Oat_point_cal ,Pearl_Millet_point_cal, Rye_point_cal ,Sorghum_point_cal, Wetland_Rice_point_cal, Wheat_point_cal )
+gen max_cal_point_t=max(Cassava_point_cal ,Sweet_Potato_point_cal, White_Potato_point_cal, Yams_point_cal)
+
+label var max_cal_point_c1 "cal/ha cereal with MaxCalYield (on a circle(5cell radius)around Ethnoatlas point)(LowInput RainFed)"
+label var max_cal_point_t "cal/ha root/tub with MaxCalYield (on a circle(5cell radius)around Ethnoatlas point)(LowInput RainFed)"
+
+gen diff= max_cal_point_c1- max_cal_point_t
+gen max = max(max_cal_point_c1, max_cal_point_t)
+
+egen std_max=std(max)
+egen std_diff=std(diff)
+
+gen sample_non_desertic=1 if max_cal_point_t~=0 & max_cal_point_c1 ~=0 /*non-desertic points; cereals and roots/tubers can be planted (Murdock points)*/
+
+gen hierarchyA="1.tribe" if L_hier1==1
+replace hierarchyA="2.small chiefd" if L_hier1==2
+replace hierarchyA="3.large chiefd" if L_hier1==3
+replace hierarchyA="4.small state" if L_hier1==4
+replace hierarchyA="5.large state" if L_hier1==5
+
+egen rainmean_std=std(rainmean)
+egen atemp_std=std(atemp)
+egen elevation_std=std(elevation)
+egen ruggedness_std=std(ruggedness)
+egen abslat_std=std(abslat)
+egen river_std=std(river)
+egen distcoast_std=std(distcoast)
+egen popd95_std=std(popd95)
+egen histpopd_std=std(histpopd)
+egen historicpopdB_std=std(historicpopdB)
+egen Plow_advantage1_std=std(Plow_advantage1)
+gen Plow_advantage1_std_7squared= Plow_advantage1_std*Plow_advantage1_std
+egen ramank_std=std(ramank)
+egen suit_GalOz_std=std(suit_GalOz)
+egen irrigation_dep_std=std(irrigation_dep)
+
+tab dummy_continental3, gen(continent3_d)
+
+tab dummy_continental_ref1, gen(continental_ref1_d)
+
+
+gen const=1
+
+
+
+save TEMP1.dta, replace
+keep if sample_non_desertic==1
+save TEMP2.dta, replace
+
+
+******************************************************************
+****************************************************************** TABLES IN PAPER
+
+
+***************************TABLE 1 2SLS ESTIMATES (standard errors clustered at the country level)
+use TEMP2.dta, clear
+
+****PANEL A: SECOND STAGE
+ivreg2 L_hier1 cereals ,cluster(iso)
+est store a1
+ivreg2 L_hier1 (cereals = std_diff) ,cluster(iso)
+est store a2
+ivreg2 L_hier1 (cereals = std_diff) continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6 ,cluster(iso)
+est store a3
+ivreg2 L_hier1 (cereals = std_diff) std_max continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6 ,cluster(iso)
+est store a4
+ivreg2 L_hier1 (cereals = std_diff) depend_agric continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6 ,cluster(iso)
+est store a5
+
+local varcontrols "std_max continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d5 continent3_d6 rainmean_std atemp_std elevation_std ruggedness_std abslat_std latitude longitude river_std distcoast_std histpopd_std Plow_advantage1_std Plow_advantage1_std_7squared dummy_Animal_husbandry1b_1 dummy_Animal_husbandry1b_2 Ruminants dummy_Animal_cultivation2_2 irrigation_dep_std"
+ivlasso L_hier1 (cereals=std_diff) (`varcontrols'), sqrt pnotpen(std_diff) cluster(iso) idstats
+local selected_regressors= e(xselected)
+local selected_regressors2= "`selected_regressors'"
+macro list
+gen missing_var=0
+foreach vari of local varcontrols {
+replace missing_var=1 if missing(`vari')==1
+}
+ivreg2 L_hier1 (cereals = std_diff ) `selected_regressors2' if missing_var==0, cluster(iso) ffirst
+est sto a6
+
+esta a* using Table1a_se_clustered_country.txt, se s(N widstat r2) starl(* 0.10 ** 0.05 *** 0.01) replace keep(cereals std_max depend_agric)
+est clear
+
+
+****PANEL B: FIRST STAGE
+
+ivreg2 cereals std_diff if L_hier1!=.,cluster(iso)
+est store a1
+ivreg2 cereals std_diff continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6 if L_hier1!=.,cluster(iso)
+est store a2
+ivreg2 cereals std_diff std_max continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6 if L_hier1!=.,cluster(iso)
+est store a3
+ivreg2 cereals std_diff depend_agric continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6 if L_hier1!=.,cluster(iso)
+est store a4
+
+ivreg2 cereals std_diff `selected_regressors2' if missing_var==0 & L_hier1!=., cluster(iso) ffirst
+est sto a5
+drop missing_var
+
+esta a* using Table1b_se_clustered_country.txt, se s(N r2) starl(* 0.10 ** 0.05 *** 0.01) replace keep(std_diff)
+est clear
+
+***************************TABLE 1 2SLS ESTIMATES (columns 1-5; standard errors adjusted for Conley with a distance cut-off of 5 and 10 decimal degrees)
+
+foreach c in 5 10 {
+
+cap drop c1 c2
+gen c1=`c'
+gen c2=c1
+
+****PANEL A: SECOND STAGE
+cap erase Table1a_se_conley_`c'.xml
+cap erase Table1a_se_conley_`c'.txt
+
+global currentcontrols cereals
+conleyols L_hier1 Table1a_se_conley_`c' 2
+
+global currentendoregressors cereals
+global currentexoregressors
+global currentinstruments std_diff
+conleyiv L_hier1 Table1a_se_conley_`c' 2 2
+
+global currentendoregressors cereals
+global currentexoregressors continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_diff
+conleyiv L_hier1 Table1a_se_conley_`c' 7 7
+
+global currentendoregressors cereals
+global currentexoregressors std_max continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_diff
+conleyiv L_hier1 Table1a_se_conley_`c' 8 8
+
+global currentendoregressors cereals
+global currentexoregressors depend_agric continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_diff
+conleyiv L_hier1 Table1a_se_conley_`c' 8 8
+
+
+****PANEL B: FIRST STAGE (columns 1-5)
+preserve
+keep if L_hier1 !=.
+cap erase Table1b_se_conley_`c'.xml
+cap erase Table1b_se_conley_`c'.txt
+
+global currentcontrols std_diff
+conleyols cereals Table1b_se_conley_`c' 2
+global currentcontrols std_diff continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+conleyols cereals Table1b_se_conley_`c' 7
+global currentcontrols std_diff std_max continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+conleyols cereals Table1b_se_conley_`c' 8
+global currentcontrols std_diff depend_agric continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+conleyols cereals Table1b_se_conley_`c' 8
+restore
+}
+
+
+
+
+
+
+
+
+******************************************************************
+****************************************************************** TABLES IN PAPER APPENDIX
+
+
+use TEMP2.dta, clear
+
+cap drop c1 c2
+gen c1=10
+gen c2=c1
+
+*************************** FIGURE F1
+hist year
+graph export FigureF1.pdf, replace
+
+*************************** FIGURE F10
+
+ivreg L_hier1 (L_crop_cereals = std_diff) , cluster(iso)
+graph box std_diff if e(sample)==1, over(hierarchyA, sort(small state large state) ) ytitle("Productivity advantage of cereals over roots and tubers")
+graph export FigureF10.pdf, replace
+
+***************************TABLE F1
+preserve
+use TEMP1.dta, clear
+
+latabstat L_hier1 L_crop_cereals depend_agric ///
+ dummy_Animal_husbandry1b_2 Ruminants Animal_cultivation2 ///
+ L_surplus Tax_burden historicpopdB ///
+ std_max std_diff ///
+ rainmean_std atemp_std elevation_std ruggedness_std abslat_std ///
+ river_std distcoast_std histpopd_std Plow_advantage1_std irrigation_dep_std ///
+ ramank_std suit_GalOz_std ///
+ , s(mean p50 sd Min Max N) f(%9.2fc) c(s) tf(TableF1) replace
+restore
+***************************TABLE F5
+
+preserve
+use TEMP1.dta, clear
+ corrtex L_hier1 L_crop_cereals depend_agric ///
+ L_surplus historicpopdB ///
+ std_max std_diff ramank_std suit_GalOz_std ///
+ , file(TableF5) replace digits(1)
+restore
+
+
+***************************TABLE F6
+
+
+cap erase TableF6.xml
+cap erase TableF6.txt
+global currentcontrols std_diff
+conleyols cereals TableF6 2
+global currentcontrols std_max std_diff
+conleyols cereals TableF6 3
+global currentcontrols std_max std_diff continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+conleyols cereals TableF6 8
+global currentcontrols std_max std_diff
+conleylogitmfx cereals TableF6 3
+global currentcontrols std_diff
+conleyols depend_agric TableF6 2
+global currentcontrols std_max std_diff
+conleyols depend_agric TableF6 3
+global currentcontrols std_max std_diff continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+conleyols depend_agric TableF6 8
+
+
+***************************TABLE F7
+
+cap erase TableF7.xml
+cap erase TableF7.txt
+
+global currentcontrols std_max std_diff rainmean_std continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+conleyols cereals TableF7 9
+global currentcontrols std_max std_diff atemp_std continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+conleyols cereals TableF7 9
+global currentcontrols std_max std_diff elevation_std continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+conleyols cereals TableF7 9
+global currentcontrols std_max std_diff ruggedness_std continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+conleyols cereals TableF7 9
+global currentcontrols std_max std_diff abslat_std latitude longitude continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+conleyols cereals TableF7 11
+
+
+***************************TABLE F8
+
+
+cap erase TableF8.xml
+cap erase TableF8.txt
+
+global currentcontrols std_max std_diff river_std continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+conleyols cereals TableF8 9
+global currentcontrols std_max std_diff distcoast_std continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+conleyols cereals TableF8 9
+global currentcontrols std_max std_diff histpopd_std continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+conleyols cereals TableF8 9
+global currentcontrols std_max std_diff historicpopdB_std continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+conleyols cereals TableF8 9
+global currentcontrols std_max std_diff popd95_std continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+conleyols cereals TableF8 9
+global currentcontrols std_max std_diff irrigation_dep_std continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+conleyols cereals TableF8 9
+global currentcontrols std_max std_diff Plow_advantage1_std Plow_advantage1_std_7squared continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+conleyols cereals TableF8 10
+
+
+
+***************************TABLE F9
+cap erase TableF9.xml
+cap erase TableF9.txt
+global currentcontrols std_max continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+conleyols L_hier1 TableF9 7
+global currentcontrols std_diff continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+conleyols L_hier1 TableF9 7
+global currentcontrols std_max std_diff continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+conleyols L_hier1 TableF9 8
+
+***************************TABLE F10
+
+*This replicates column 1
+xi: ologit L_hier1 std_max std_diff continent3_d* , cluster(iso)
+est sto a1
+outreg2 [a1] using TableF10_column1, replace onecol nor2
+
+
+*These replicates the results in columns 2-5
+capture: gologit2 L_hier1 std_max std_diff continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d5 if L_hier1!=., lrforce cluster(iso)
+est sto a2
+outreg2 [a2] using TableF10_column2_3_4_5, replace onecol nor2
+
+
+***************************TABLE F11
+
+cap erase TableF11.xml
+cap erase TableF11.txt
+
+global currentendoregressors cereals
+global currentexoregressors std_max rainmean_std continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_diff
+conleyiv L_hier1 TableF11 9 9
+
+global currentendoregressors cereals
+global currentexoregressors std_max atemp_std continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_diff
+conleyiv L_hier1 TableF11 9 9
+
+global currentendoregressors cereals
+global currentexoregressors std_max elevation_std continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_diff
+conleyiv L_hier1 TableF11 9 9
+
+global currentendoregressors cereals
+global currentexoregressors std_max ruggedness_std continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_diff
+conleyiv L_hier1 TableF11 9 9
+
+global currentendoregressors cereals
+global currentexoregressors std_max abslat_std latitude longitude continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_diff
+conleyiv L_hier1 TableF11 11 11
+
+
+
+
+***************************TABLE F12
+
+cap erase TableF12.xml
+cap erase TableF12.txt
+
+global currentendoregressors cereals
+global currentexoregressors std_max river_std continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_diff
+conleyiv L_hier1 TableF12 9 9
+
+global currentendoregressors cereals
+global currentexoregressors std_max distcoast_std continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_diff
+conleyiv L_hier1 TableF12 9 9
+
+global currentendoregressors cereals
+global currentexoregressors std_max histpopd_std continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_diff
+conleyiv L_hier1 TableF12 9 9
+
+global currentendoregressors cereals
+global currentexoregressors std_max historicpopdB_std continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_diff
+conleyiv L_hier1 TableF12 9 9
+
+global currentendoregressors cereals
+global currentexoregressors std_max irrigation_dep_std continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_diff
+conleyiv L_hier1 TableF12 9 9
+
+global currentendoregressors cereals
+global currentexoregressors std_max Plow_advantage1_std Plow_advantage1_std_7squared continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_diff
+conleyiv L_hier1 TableF12 10 10
+
+
+***************************TABLE F13
+
+preserve
+use TEMP1.dta, clear
+gen c1=10
+gen c2=10
+cap erase TableF13.xml
+cap erase TableF13.txt
+
+global currentcontrols cereals
+conleyols L_hier1 TableF13 2
+global currentendoregressors cereals
+global currentexoregressors
+global currentinstruments std_diff
+conleyiv L_hier1 TableF13 2 2
+global currentendoregressors cereals
+global currentexoregressors std_max
+global currentinstruments std_diff
+conleyiv L_hier1 TableF13 3 3
+global currentendoregressors cereals depend_agric
+global currentexoregressors
+global currentinstruments std_max std_diff
+conleyiv L_hier1 TableF13 3 3
+global currentcontrols cereals continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+conleyols L_hier1 TableF13 7
+global currentendoregressors cereals
+global currentexoregressors continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_diff
+conleyiv L_hier1 TableF13 7 7
+global currentendoregressors cereals
+global currentexoregressors std_max continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_diff
+conleyiv L_hier1 TableF13 8 8
+global currentendoregressors cereals depend_agric
+global currentexoregressors continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_max std_diff
+conleyiv L_hier1 TableF13 8 8
+restore
+
+***************************TABLE F14
+gen diff2= cal2_c1- cal2_t
+gen max2 = max(cal2_c1, cal2_t)
+egen std_max2=std(max2)
+egen std_diff2=std(diff2)
+
+cap erase TableF14.xml
+cap erase TableF14.txt
+
+global currentcontrols cereals
+conleyols L_hier1 TableF14 2
+global currentendoregressors cereals
+global currentexoregressors
+global currentinstruments std_diff2
+conleyiv L_hier1 TableF14 2 2
+global currentendoregressors cereals
+global currentexoregressors std_max2
+global currentinstruments std_diff2
+conleyiv L_hier1 TableF14 3 3
+global currentendoregressors cereals depend_agric
+global currentexoregressors
+global currentinstruments std_max2 std_diff2
+conleyiv L_hier1 TableF14 3 3
+global currentcontrols cereals continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+conleyols L_hier1 TableF14 7
+global currentendoregressors cereals
+global currentexoregressors continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_diff2
+conleyiv L_hier1 TableF14 7 7
+global currentendoregressors cereals
+global currentexoregressors std_max2 continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_diff2
+conleyiv L_hier1 TableF14 8 8
+global currentendoregressors cereals depend_agric
+global currentexoregressors continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_max2 std_diff2
+conleyiv L_hier1 TableF14 8 8
+
+
+
+
+***************************TABLE F15
+cap erase TableF15.xml
+cap erase TableF15.txt
+
+global currentendoregressors cereals
+global currentexoregressors ramank_std
+global currentinstruments std_diff
+conleyiv L_hier1 TableF15 3 3
+
+global currentendoregressors cereals
+global currentexoregressors ramank_std continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_diff
+conleyiv L_hier1 TableF15 8 8
+
+global currentendoregressors cereals
+global currentexoregressors suit_GalOz_std
+global currentinstruments std_diff
+conleyiv L_hier1 TableF15 3 3
+
+global currentendoregressors cereals
+global currentexoregressors suit_GalOz_std continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_diff
+conleyiv L_hier1 TableF15 8 8
+
+
+
+***************************TABLE F16
+
+
+cap erase TableF16.xml
+cap erase TableF16.txt
+
+
+global currentendoregressors cereals
+global currentexoregressors continental_ref1_d1 continental_ref1_d2
+global currentinstruments std_diff
+conleyiv L_hier1 TableF16 4 4
+
+global currentendoregressors cereals
+global currentexoregressors dummy_Animal_husbandry1b_1
+global currentinstruments std_diff
+conleyiv L_hier1 TableF16 3 3
+
+global currentendoregressors cereals
+global currentexoregressors dummy_Animal_husbandry1b_1 continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_diff
+conleyiv L_hier1 TableF16 8 8
+
+global currentendoregressors cereals
+global currentexoregressors Ruminants
+global currentinstruments std_diff
+conleyiv L_hier1 TableF16 3 3
+
+global currentendoregressors cereals
+global currentexoregressors Ruminants continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_diff
+conleyiv L_hier1 TableF16 8 8
+
+global currentendoregressors cereals
+global currentexoregressors dummy_Animal_cultivation2_2
+global currentinstruments std_diff
+conleyiv L_hier1 TableF16 3 3
+
+global currentendoregressors cereals
+global currentexoregressors dummy_Animal_cultivation2_2 continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6
+global currentinstruments std_diff
+conleyiv L_hier1 TableF16 8 8
+
+
+***************************TABLE F17
+
+
+xi: ivreg2 L_surplus std_diff , rob
+est store a1
+xi: ivreg2 L_surplus std_max std_diff , rob
+est store a2
+xi: ivreg2 L_surplus std_max std_diff continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6 , rob
+est store a3
+xi: ologit L_surplus std_max std_diff , rob
+est store a4
+mfx, dydx
+
+xi: ivreg2 Tax_burden std_diff , rob
+est store a6
+xi: ivreg2 Tax_burden std_max std_diff , rob
+est store a7
+xi: ivreg2 Tax_burden std_max std_diff continent3_d1 continent3_d2 continent3_d3 continent3_d4 continent3_d6 , rob
+est store a8
+xi: ologit Tax_burden std_max std_diff , rob
+est store a9
+mfx, dydx
+
+esta a* using TableF17.txt, replace starl(* 0.10 ** 0.05 *** 0.01) s(N r2) se order(std_diff std_max) title(TABLE F17)
+estimates clear
+
+***************************TABLE F18
+
+
+xi: ivreg2 L_surplus L_crop_cereals , rob
+est store a1
+xi: ivreg2 L_surplus (L_crop_cereals = std_diff) , rob
+est store a2
+xi: ivreg2 L_surplus (L_crop_cereals = std_diff) std_max , rob
+est store a3
+xi: ivreg2 L_surplus (L_crop_cereals depend_agric= std_diff std_max) , rob
+est store a4
+
+xi: ivreg2 Tax_burden L_crop_cereals , rob
+est store a5
+xi: ivreg2 Tax_burden (L_crop_cereals = std_diff) , rob
+est store a6
+xi: ivreg2 Tax_burden (L_crop_cereals = std_diff) std_max , rob
+est store a7
+xi: ivreg2 Tax_burden (L_crop_cereals depend_agric= std_diff std_max) , rob
+est store a8
+esta a* using TableF18.txt, replace starl(* 0.10 ** 0.05 *** 0.01) s(N widstat ) se order(L_crop_cereals std_max depend_agric) title(TABLE F18)
+est clear
+
+
+***************************TABLE F19
+
+xi: ivreg2 L_surplus (L_crop_cereals = std_diff) std_max rainmean_std , rob
+est store a2
+xi: ivreg2 L_surplus (L_crop_cereals = std_diff) std_max atemp_std , rob
+est store a3
+xi: ivreg2 L_surplus (L_crop_cereals = std_diff) std_max elevation_std , rob
+est store a4
+xi: ivreg2 L_surplus (L_crop_cereals = std_diff) std_max ruggedness_std , rob
+est store a5
+xi: ivreg2 L_surplus (L_crop_cereals = std_diff) std_max abslat_std latitude longitude , rob
+est store a6
+esta a* using TableF19.txt, replace starl(* 0.10 ** 0.05 *** 0.01) s(N widstat ) se order(L_crop_cereals) title(TABLE F19)
+est clear
+
+***************************TABLE F20
+
+xi: ivreg2 L_surplus (L_crop_cereals = std_diff) std_max river_std , rob
+est store a7
+xi: ivreg2 L_surplus (L_crop_cereals = std_diff) std_max distcoast_std , rob
+est store a8
+xi: ivreg2 L_surplus (L_crop_cereals = std_diff) std_max histpopd_std , rob
+est store a9
+xi: ivreg2 L_surplus (L_crop_cereals = std_diff) std_max historicpopdB_std , rob
+est store a10
+xi: ivreg2 L_surplus (L_crop_cereals = std_diff) std_max popd95_std , rob
+est store a11
+xi: ivreg2 L_surplus (L_crop_cereals = std_diff) std_max irrigation_dep_std , rob
+est store a12
+xi: ivreg2 L_surplus (L_crop_cereals = std_diff) std_max Plow_advantage1_std Plow_advantage1_std_7squared , rob
+est store a13
+esta a* using TableF20.txt, replace starl(* 0.10 ** 0.05 *** 0.01) s(N widstat ) se order(L_crop_cereals) title(TABLE F20)
+est clear
+
+***************************TABLE F21
+xi: ivreg2 Tax_burden (L_crop_cereals = std_diff) std_max rainmean_std , rob
+est store a1
+xi: ivreg2 Tax_burden (L_crop_cereals = std_diff) std_max atemp_std , rob
+est store a2
+xi: ivreg2 Tax_burden (L_crop_cereals = std_diff) std_max elevation_std , rob
+est store a3
+xi: ivreg2 Tax_burden (L_crop_cereals = std_diff) std_max ruggedness_std , rob
+est store a4
+xi: ivreg2 Tax_burden (L_crop_cereals = std_diff) std_max abslat_std latitude longitude , rob
+est store a5
+esta a* using TableF21.txt, replace starl(* 0.10 ** 0.05 *** 0.01) s(N widstat ) se order(L_crop_cereals) title(TABLE F21)
+est clear
+
+***************************TABLE F22
+
+xi: ivreg2 Tax_burden (L_crop_cereals = std_diff) std_max river_std , rob
+est store a7
+xi: ivreg2 Tax_burden (L_crop_cereals = std_diff) std_max distcoast_std , rob
+est store a8
+xi: ivreg2 Tax_burden (L_crop_cereals = std_diff) std_max histpopd_std , rob
+est store a9
+xi: ivreg2 Tax_burden (L_crop_cereals = std_diff) std_max historicpopdB_std , rob
+est store a10
+xi: ivreg2 Tax_burden (L_crop_cereals = std_diff) std_max popd95_std , rob
+est store a11
+xi: ivreg2 Tax_burden (L_crop_cereals = std_diff) std_max irrigation_dep_std , rob
+est store a12
+xi: ivreg2 Tax_burden (L_crop_cereals = std_diff) std_max Plow_advantage1_std Plow_advantage1_std_7squared , rob
+est store a13
+esta a* using TableF22.txt, replace starl(* 0.10 ** 0.05 *** 0.01) s(N widstat ) se order(L_crop_cereals) title(TABLE F22)
+est clear
+
+
+*************************** ERASE USELESS FILES
+erase Table1a_se_conley_5.txt
+erase Table1a_se_conley_10.txt
+erase Table1b_se_conley_5.txt
+erase Table1b_se_conley_10.txt
+erase TableF6.txt
+erase TableF7.txt
+erase TableF8.txt
+erase TableF9.txt
+erase TableF11.txt
+erase TableF12.txt
+erase TableF13.txt
+erase TableF14.txt
+erase TableF15.txt
+erase TableF16.txt
+erase Table1a_se_conley_5.tex
+erase Table1a_se_conley_10.tex
+erase Table1b_se_conley_5.tex
+erase Table1b_se_conley_10.tex
+erase TableF6.tex
+erase TableF7.tex
+erase TableF8.tex
+erase TableF9.tex
+erase TableF11.tex
+erase TableF12.tex
+erase TableF13.tex
+erase TableF14.tex
+erase TableF15.tex
+erase TableF16.tex
+
+
+
+
+
diff --git a/82/replication_package/ESTA/esta.ado b/82/replication_package/ESTA/esta.ado
new file mode 100644
index 0000000000000000000000000000000000000000..1fb82b2fa49c66647e9f2c5f122b1ffce29e0700
--- /dev/null
+++ b/82/replication_package/ESTA/esta.ado
@@ -0,0 +1,842 @@
+*! version 1.1.4, Ben Jann, 29nov2006
+*! wrapper for estout
+
+program define esta, rclass
+ version 8.2
+
+// mode specific defaults
+// - fixed
+ local fixed_open0 `""% `c(current_date)' `c(current_time)'""'
+ local fixed_close0 `""""'
+ local fixed_open `""'
+ local fixed_close `""'
+ local fixed_caption `"@title"'
+ local fixed_open2 `""'
+ local fixed_close2 `""'
+ local fixed_toprule `"@hline"'
+ local fixed_midrule `"@hline"'
+ local fixed_bottomrule `"@hline"'
+ local fixed_topgap `""""'
+ local fixed_midgap `""""'
+ local fixed_bottomgap `""""'
+ local fixed_ssl `"N R-sq "adj. R-sq" "pseudo R-sq" AIC BIC"'
+ local fixed_lsl `"Observations R-squared "Adjusted R-squared" "Pseudo R-squared" AIC BIC"'
+ local fixed_starlevels `"* 0.05 ** 0.01 *** 0.001"'
+ local fixed_begin `""'
+ local fixed_delimiter `"" ""'
+ local fixed_end `""'
+ local fixed_varwidth `"\`= cond("\`label'"=="", 12, 20)'"'
+ local fixed_modelwidth `"12"'
+ local fixed_abbrev `"abbrev"'
+ local fixed_substitute `""'
+// - tab
+ local tab_open0 `"`macval(fixed_open0)'"'
+ local tab_close0 `""""'
+ local tab_open `""'
+ local tab_close `""'
+ local tab_caption `"@title"'
+ local tab_open2 `""'
+ local tab_close2 `""'
+ local tab_toprule `""'
+ local tab_midrule `""'
+ local tab_bottomrule `""'
+ local tab_topgap `""""'
+ local tab_midgap `""""'
+ local tab_bottomgap `""""'
+ local tab_ssl `"`macval(fixed_ssl)'"'
+ local tab_lsl `"`macval(fixed_lsl)'"'
+ local tab_starlevels `"`macval(fixed_starlevels)'"'
+ local tab_begin `""'
+ local tab_delimiter `"_tab"'
+ local tab_end `""'
+ local tab_varwidth `""'
+ local tab_modelwidth `""'
+ local tab_abbrev `""'
+ local tab_substitute `""'
+// - csv
+ local csv_open0 `"`"\`csvlhs'% `c(current_date)' `c(current_time)'""'"'
+ local csv_close0 `""""'
+ local csv_open `""'
+ local csv_close `""'
+ local csv_caption `"`"\`csvlhs'@title""'"'
+ local csv_open2 `""'
+ local csv_close2 `""'
+ local csv_toprule `""'
+ local csv_midrule `""'
+ local csv_bottomrule `""'
+ local csv_topgap `""""'
+ local csv_midgap `""""'
+ local csv_bottomgap `""""'
+ local csv_ssl `"`macval(fixed_ssl)'"'
+ local csv_lsl `"`macval(fixed_lsl)'"'
+ local csv_starlevels `"`macval(fixed_starlevels)'"'
+ local csv_begin `"`"\`csvlhs'"'"'
+ local csv_delimiter `"`"";\`csvlhs'"'"'
+ local csv_end `"`"""'"'
+ local csv_varwidth `""'
+ local csv_modelwidth `""'
+ local csv_abbrev `""'
+ local csv_substitute `""'
+// - rtf
+ local rtf_open0 `""'
+ local rtf_close0 `""'
+ local rtf_open `"{\rtf1`=cond("`c(os)'"=="MacOSX", "\mac", "\ansi")'"'
+ local rtf_close `"}"'
+ local rtf_caption `"@title \par"'
+ local rtf_open2 `""'
+ local rtf_close2 `""'
+ local rtf_toprule `""'
+ local rtf_midrule `""'
+ local rtf_bottomrule `""'
+ local rtf_topgap `""""'
+ local rtf_midgap `""""'
+ local rtf_bottomgap `""""'
+ local rtf_ssl `"N "R{\super 2}" "adj. R{\super 2}" "pseudo R{\super 2}" AIC BIC"'
+ local rtf_lsl `"Observations "R{\super 2}" "Adjusted R{\super 2}" "Pseudo R{\super 2}" AIC BIC"'
+ local rtf_starlevels `""{\super *}" 0.05 "{\super **}" 0.01 "{\super **}" 0.001"'
+ local rtf_begin `""\trowd\intbl\trgaph108\trql\trleft-108\`rtf_twidth'\trautofit1\cellx\ql ""'
+ local rtf_twidth `"\`=cond("\`width'"=="", "", "\trftsWidth2\trwWidth\`=50*\`rtf_twidthf''")'"'
+ local rtf_twidthf `"\`=cond("\`width'"=="", "0", "\`width'")'"'
+ local rtf_delimiter `"`"\cell\cellx\q\`=cond(`"\`alignment'"'!="", `"\`alignment'"', "c")' "'"'
+ local rtf_end `"\cell\row"'
+ local rtf_varwidth `""'
+ local rtf_modelwidth `""'
+ local rtf_abbrev `""'
+ local rtf_substitute `""'
+// - html
+ local html_open0 `"
"`=cond(`"\`macval(title)'"'=="","estimates table, created `c(current_date)' `c(current_time)'","@title")'" """'
+ local html_close0 `""" """'
+ local html_open `"`""'"'
+ local html_close `"
"'
+ local html_caption `"@title"'
+ local html_open2 `""'
+ local html_close2 `""'
+ local html_toprule `""
|
""'
+ local html_midrule `""
|
""'
+ local html_bottomrule `""
|
""'
+ local html_topgap `""'
+ local html_midgap `""| |
""'
+ local html_bottomgap `""'
+ local html_ssl `"N R2 "adj. R2" "pseudo R2" AIC BIC"'
+ local html_lsl `"Observations R2 "Adjusted R2" "Pseudo R2" AIC BIC"'
+ local html_starlevels `"* 0.05 ** 0.01 *** 0.001"'
+ local html_begin `"| "'
+ local html_delimiter `" | "'
+ local html_end `" |
"'
+ local html_varwidth `"\`= cond("\`label'"=="", 12, 20)'"'
+ local html_modelwidth `"12"'
+ local html_abbrev `""'
+ local html_substitute `""'
+// - tex
+ local tex_open0 `""% `c(current_date)' `c(current_time)'" \documentclass{article} \begin{document} """'
+ local tex_close0 `""" \end{document} """'
+ local tex_open `"\begin{table}[htbp]\centering"'
+ local tex_close `"\end{table}"'
+ local tex_caption `"\caption{@title}"'
+ local tex_open2 `"\`=cond("\`width'"=="", "\begin{tabular}", `"\begin{tabular*}{\`width'}"')'"'
+ local tex_close2 `"\`=cond("\`width'"=="", "\end{tabular}", `"\end{tabular*}"')'"'
+ local tex_toprule `"\hline\hline"'
+ local tex_midrule `"\hline"'
+ local tex_bottomrule `"\hline\hline"'
+ local tex_topgap `""'
+ local tex_midgap `"[1em]"' // `"\\\"'
+ local tex_bottomgap `""'
+ local tex_ssl `"N R$^{2}$ "adj. R$^{2}$" "pseudo R$^{2}$>" AIC BIC"'
+ local tex_lsl `"Observations R$^{2}$ "Adjusted R$^{2}$" "Pseudo R$^{2}$" AIC BIC"'
+ local tex_starlevels `"\sym{*} 0.05 \sym{**} 0.01 \sym{***} 0.001"'
+ local tex_begin `""'
+ local tex_delimiter `"&"'
+ local tex_end `"\\\"'
+ local tex_varwidth `"\`= cond("\`label'"=="", 12, 20)'"'
+ local tex_modelwidth `"12"'
+ local tex_abbrev `""'
+ local tex_substitute `"_ \_ "\_cons " \_cons < $<$"'
+// - booktabs
+ local booktabs_open0 `""% `c(current_date)' `c(current_time)'" \documentclass{article} \usepackage{booktabs} \begin{document} """'
+ local booktabs_close0 `"`macval(tex_close0)'"'
+ local booktabs_open `"`macval(tex_open)'"'
+ local booktabs_close `"`macval(tex_close)'"'
+ local booktabs_caption `"`macval(tex_caption)'"'
+ local booktabs_open2 `"`macval(tex_open2)'"'
+ local booktabs_close2 `"`macval(tex_close2)'"'
+ local booktabs_toprule `"\toprule"'
+ local booktabs_midrule `"\midrule"'
+ local booktabs_bottomrule `"\bottomrule"'
+ local booktabs_topgap `"`macval(tex_topgap)'"'
+ local booktabs_midgap `"\addlinespace"'
+ local booktabs_bottomgap `"`macval(tex_bottomgap)'"'
+ local booktabs_ssl `"`macval(tex_ssl)'"'
+ local booktabs_lsl `"`macval(tex_lsl)'"'
+ local booktabs_starlevels `"`macval(tex_starlevels)'"'
+ local booktabs_begin `"`macval(tex_begin)'"'
+ local booktabs_delimiter `"`macval(tex_delimiter)'"'
+ local booktabs_end `"`macval(tex_end)'"'
+ local booktabs_varwidth `"`macval(tex_varwidth)'"'
+ local booktabs_modelwidth `"`macval(tex_modelwidth)'"'
+ local booktabs_abbrev `"`macval(tex_abbrev)'"'
+ local booktabs_substitute `"`macval(tex_substitute)'"'
+
+// hello estout
+ capt findfile estout.ado
+ if _rc {
+ di as err "-estout- is required; type {stata ssc install estout}"
+ error 499
+ }
+
+// syntax
+ syntax [anything] [using] [ , ///
+/// coefficients and t-stats, se, etc.
+ b Bfmt(string) ///
+ noT Tfmt(string) ///
+ se SEfmt(string) ///
+ p Pfmt(string) ///
+ ci CIfmt(string) ///
+ BEta BEtafmt(string) ///
+ main(string) /// syntax: name format
+ aux(string) /// syntax: name format
+ abs /// absolute t-values
+ wide ///
+ NOSTAr STAR ///
+ staraux ///
+ NOCONstant CONstant ///
+ COEFlabels(string asis) ///
+/// summary statistics
+ noOBS obslast ///
+ r2 R2fmt(string) ar2 AR2fmt(string) pr2 PR2fmt(string) ///
+ aic AICfmt(string) bic BICfmt(string) ///
+ SCAlars(string asis) /// syntax: "name1 [label1]" "name2 [label2]" etc.
+ sfmt(string) ///
+/// layout
+ NODEPvars DEPvars ///
+ NOPArentheses PArentheses ///
+ BRackets ///
+ NONOTEs NOTEs /// without s in helpfile
+ NOMTItles MTItles MTItles2(string asis) ///
+ NOGAPs GAPs ///
+ NOLInes LInes ///
+ ADDNotes(string asis) ///
+ COMpress ///
+ plain ///
+ fixed tab csv rtf html tex BOOKTabs ///
+ Fragment ///
+ page ///
+ ALIGNment(str asis) ///
+ width(str asis) ///
+/// other
+ Noisily ///
+ * ]
+ _estout_options , `macval(options)'
+
+// syntax consistency etc
+ gettoken chunk using0: using
+ foreach opt in constant gaps lines star abbrev ///
+ depvars numbers parentheses notes mtitles type {
+ NotBothAllowed "``opt''" `no`opt''
+ }
+ NotBothAllowed "`staraux'" `nostar'
+ if `"`macval(mtitles2)'"'!="" NotBothAllowed "mtitles" `nomtitles'
+ if `"`pfmt'"'!="" local p p
+ if `"`sefmt'"'!="" local se se
+ if `"`cifmt'"'!="" local ci ci
+ if `"`betafmt'"'!="" local beta beta
+ if "`level'"=="" local level $S_level
+ if ((("`margin'"!="" | `"`margin2'"'!="") & "`nomargin'"=="") | ///
+ ("`beta'"!="") | ("`eform'"!="" & "`noeform'"=="")) ///
+ & "`constant'"=="" local noconstant noconstant
+ if `"`r2fmt'"'!="" local r2 r2
+ if `"`ar2fmt'"'!="" local ar2 ar2
+ if `"`pr2fmt'"'!="" local pr2 pr2
+ if `"`aicfmt'"'!="" local aic aic
+ if `"`bicfmt'"'!="" local bic bic
+ if "`type'"=="" & `"`using'"'!="" local notype notype
+
+// format modes
+ local mode `fixed' `tab' `csv' `rtf' `html' `tex' `booktabs'
+ if `:list sizeof mode'>1 {
+ di as err "only one allowed of fixed, tab, csv, rtf, html, tex, or booktabs"
+ exit 198
+ }
+ if "`mode'"=="" {
+ if `"`using'"'!="" {
+ _getfilename `"`using0'"'
+ _getfilesuffix `"`r(filename)'"'
+ local suffix `"`r(suffix)'"'
+ if inlist(`"`suffix'"', ".html", ".htm") local mode html
+ else if `"`suffix'"'==".tex" local mode tex
+ else if `"`suffix'"'==".csv" local mode csv
+ else if `"`suffix'"'==".rtf" local mode rtf
+ else local mode fixed
+ }
+ else local mode fixed
+ }
+ local mode0 `mode'
+ if "`mode0'"=="booktabs" local mode0 tex
+ else if "`mode0'"=="csv" {
+ if "`plain'"=="" local csvlhs `"=""'
+ else local csvlhs `"""'
+ }
+ if "`compress'"!="" & !inlist("`mode0'", "tab", "csv", "rtf") {
+ if "`modelwidth'"=="" local modelwidth modelwidth(9)
+ if "`varwidth'"=="" {
+ if "`label'"!="" local varwidth varwidth(16)
+ else local varwidth varwidth(10)
+ }
+ }
+ if "`plain'"=="" {
+ foreach opt in star depvars numbers parentheses notes lines {
+ SwitchOnIfEmpty `opt' `no`opt''
+ }
+ if "`wide'"=="" & ("`t'"=="" | "`se'`p'`ci'`aux'"!="") ///
+ SwitchOnIfEmpty gaps `nogaps'
+ }
+ if inlist("`mode0'", "tab", "csv", "rtf") local lines
+ if inlist("`mode0'", "rtf") local gaps
+ if "`notes'"!="" & "`nolegend'"=="" local legend legend
+ if "`plain'"!="" {
+ if "`bfmt'"=="" local bfmt %9.0g
+ if "`tfmt'"=="" local tfmt `bfmt'
+ if "`sefmt'"=="" local sefmt `bfmt'
+ if "`pfmt'"=="" local pfmt `bfmt'
+ if "`cifmt'"=="" local cifmt `bfmt'
+ if "`betafmt'"=="" local betafmt `bfmt'
+ }
+ if "`nomtitles'"!="" local depvars
+ else if "`depvars'"=="" local mtitles mtitles
+
+// cells() option
+ if "`notes'"!="" {
+ if ("`margin'"!="" | `"`margin2'"'!="") & "`nomargin'"=="" ///
+ local note "`note'Marginal effects"
+ if "`eform'"!="" & "`noeform'"=="" ///
+ local note "`note'Exponentiated coefficients"
+ }
+ if "`bfmt'"=="" local bfmt a3
+ if `"`macval(cells)'"'=="" {
+ if "`star'"!="" & "`staraux'"=="" local bstar star
+ if "`beta'"!="" {
+ if "`main'"!="" {
+ di as err "beta() and main() not allowed both"
+ exit 198
+ }
+ if "`betafmt'"=="" local betafmt 3
+ local cells fmt(`betafmt') `bstar'
+ local cells beta(`cells')
+ if "`notes'"!="" {
+ if `"`note'"'!="" local note "`note'; "
+ local note "`note'Standardized beta coefficients"
+ }
+ }
+ else if "`main'"!="" {
+ tokenize "`main'"
+ if "`2'"=="" local 2 "`bfmt'"
+ local cells fmt(`2') `bstar'
+ local cells `1'(`cells')
+ if "`notes'"!="" {
+ if `"`note'"'!="" local note "`note'; "
+ local note "`note'`1' coefficients"
+ }
+ }
+ else {
+ local cells fmt(`bfmt') `bstar'
+ local cells b(`cells')
+ }
+ if "`t'"=="" | "`se'`p'`ci'`aux'"!="" {
+// parse aux optio
+ tokenize "`aux'"
+ local auxname `1'
+ local auxfmt `2'
+// type of auxiliary statistic
+ local aux `se' `p' `ci' `auxname'
+ if `"`aux'"'=="" local aux t
+ else {
+ if `:list sizeof aux'>1 {
+ di as err "only one allowed of se, p, ci, and aux()"
+ exit 198
+ }
+ }
+ if `"`aux'"'!="t" local abs
+// parentheses/brackets
+ if "`parentheses'"!="" | "`brackets'"!="" {
+ if `"`aux'"'=="ci" {
+ local brackets brackets
+ local paren par
+ }
+ else if "`brackets'"!="" local paren "par([ ])"
+ else local paren par
+ }
+// compose note
+ if "`notes'"!="" {
+ if `"`note'"'!="" local note "`note'; "
+ if `"`auxname'"'!="" {
+ local note `"`macval(note)'`auxname'"'
+ }
+ else if `"`aux'"'=="t" {
+ if "`abs'"!="" local note `"`macval(note)'Absolute "'
+ local note `"`macval(note)'t-statistics"'
+ }
+ else if `"`aux'"'=="se" {
+ local note `"`macval(note)'Standard errors"'
+ }
+ else if `"`aux'"'=="p" {
+ local note `"`macval(note)'p-values"'
+ }
+ else if `"`aux'"'=="ci" {
+ local note `"`macval(note)'`level'% confidence intervalls"'
+ }
+ if "`parentheses'"=="" {
+ if "`wide'"=="" local note `"`macval(note)' in second row"'
+ else local note `"`macval(note)' in second column"'
+ }
+ else if "`brackets'"!="" {
+ local note `"`macval(note)' in brackets"'
+ }
+ else local note `"`macval(note)' in parentheses"'
+ }
+// formats
+ if "`tfmt'"=="" local tfmt 2
+ if "`sefmt'"=="" local sefmt `bfmt'
+ if "`pfmt'"=="" local pfmt 3
+ if "`cifmt'"=="" local cifmt `bfmt'
+ if `"`auxfmt'"'=="" local auxfmt `bfmt'
+ if `"`auxname'"'=="" {
+ local auxfmt ``aux'fmt'
+ }
+// stars
+ if "`staraux'"!="" local staraux star
+// put together
+ local bin fmt(`auxfmt') `paren' `abs' `staraux'
+ local cells `cells' `aux'(`bin')
+ }
+ if "`wide'"!="" local cells cells(`"`cells'"')
+ else local cells cells(`cells')
+ }
+
+// stats() option
+ if `"`macval(stats)'"'=="" {
+ if `"`sfmt'"'=="" local sfmt `bfmt'
+ if `"`r2fmt'"'=="" local r2fmt = cond("`plain'"!="", "`bfmt'", "3")
+ if `"`ar2fmt'"'=="" local ar2fmt = cond("`plain'"!="", "`bfmt'", "3")
+ if `"`pr2fmt'"'=="" local pr2fmt = cond("`plain'"!="", "`bfmt'", "3")
+ if `"`aicfmt'"'=="" local aicfmt `bfmt'
+ if `"`bicfmt'"'=="" local bicfmt `bfmt'
+ if "`label'"=="" {
+ local stalabs `"``mode'_ssl'"'
+ }
+ else {
+ local stalabs `"``mode'_lsl'"'
+ }
+ gettoken obslab stalabs: stalabs
+ if "`obs'"=="" & "`obslast'"=="" {
+ local sta N
+ local stalab `"`macval(obslab)'"'
+ local stafmt %18.0g
+ }
+ local i 0
+ foreach s in r2 ar2 pr2 aic bic {
+ local ++i
+ if "``s''"!="" {
+ local sta `sta' `:word `i' of r2 r2_a r2_p aic bic'
+ local chunk: word `i' of `macval(stalabs)'
+ local stalab `"`macval(stalab)' `"`macval(chunk)'"'"'
+ local stafmt `stafmt' ``s'fmt'
+ }
+ }
+ local i 0
+ foreach addstat of local scalars {
+ local ++i
+ gettoken addstatname addstatlabel: addstat
+ if `: list posof `"`addstatname'"' in sta' continue
+ if `"`addstatname'"'=="N" & "`obs'"=="" & "`obslast'"!="" continue
+ if trim(`"`macval(addstatlabel)'"')=="" local addstatlabel `addstatname'
+ local addstatfmt: word `i' of `sfmt'
+ if `"`addstatfmt'"'=="" {
+ local addstatfmt: word `: list sizeof sfmt' of `sfmt'
+ }
+ local sta `sta' `addstatname'
+ local stalab `"`macval(stalab)' `"`macval(addstatlabel)'"'"'
+ local stafmt `stafmt' `addstatfmt'
+ }
+ if "`obs'"=="" & "`obslast'"!="" {
+ local sta `sta' N
+ local stalab `"`macval(stalab)' `macval(obslab)'"'
+ local stafmt `stafmt' %18.0g
+ }
+ if "`sta'"!="" {
+ local stats stats(`sta', fmt(`stafmt') labels(`macval(stalab)'))
+ }
+ }
+
+// table header
+ if `"`macval(mlabels)'"'=="" {
+ if "`mode0'"=="tex" local mspan " span prefix(\multicolumn{@span}{c}{) suffix(})"
+ if `"`depvars'"'!="" {
+ local mlabels `"mlabels(, depvar`mspan')"'
+ }
+ else local mlabels `"mlabels(, none)"'
+ if "`mtitles'"!="" {
+ if "`mode0'"=="tex" local mlabels `"mlabels(,`mspan')"'
+ else local mlabels
+ }
+ if `"`macval(mtitles2)'"'!="" {
+ local mlabels `"mlabels(`macval(mtitles2)',`mspan')"'
+ }
+ }
+ if `"`macval(collabels)'"'=="" {
+ local collabels `"collabels(, none)"'
+ }
+ if "`mode0'"=="tex" & "`numbers'"!="" {
+ local numbers "numbers(\multicolumn{@span}{c}{( )})"
+ }
+
+// pre-/posthead, pre-/postfoot, gaps and lines
+// - complete note
+ if `"`macval(note)'"'!="" {
+ local note `"`"`macval(note)'"'"'
+ }
+ if "`legend'"!="" {
+ if ("`margin'"!="" | `"`margin2'"'!="") & ///
+ "`nomargin'"=="" & "`nodiscrete'"=="" {
+ local note `"`macval(note)' @discrete"'
+ }
+ if "`star'"!="" {
+ local note `"`macval(note)' @starlegend"'
+ }
+ }
+ if `"`macval(addnotes)'"'!="" {
+ local note `"`macval(note)' `macval(addnotes)'"'
+ }
+// - mode specific settings
+ foreach opt in starlevels begin delimiter end ///
+ varwidth modelwidth substitute {
+ if `"`macval(`opt')'"'=="" & `"`macval(`mode'_`opt')'"'!="" {
+ local `opt' `"`opt'(``mode'_`opt'')"'
+ }
+ }
+ if "`noabbrev'`abbrev'"=="" {
+ local abbrev ``mode'_abbrev'
+ }
+ if `"`fragment'"'=="" {
+ if "`page'"!="" {
+ local opening `"``mode'_open0'"'
+ }
+ if `"`macval(title)'"'!="" {
+ local opening `"`macval(opening)' ``mode'_open'"'
+ if "`mode0'"=="tex" & "`star'"!="" {
+ local opening `"`macval(opening)' \def\sym#1{\ifmmode^{#1}\else$^{#1}$\fi}"'
+ }
+ local opening `"`macval(opening)' ``mode'_caption'"'
+ }
+ else if "`mode0'"=="tex" & "`star'"!="" {
+ local opening `"`macval(opening)' { \def\sym#1{\ifmmode^{#1}\else$^{#1}$\fi}"'
+ }
+ else if "`mode0'"!="tex" {
+ local opening `"`macval(opening)' ``mode'_open'"'
+ }
+ local opening `"`macval(opening)' ``mode'_open2'"'
+ if "`mode0'"=="tex" {
+ if `"`width'"'!="" local extracolsep "@{\hskip\tabcolsep\extracolsep\fill}"
+ if `"`macval(alignment)'"'!="" {
+ local opening `"`macval(opening)'{`extracolsep'l*{@E}{`macval(alignment)'}}"'
+ }
+ else {
+ MakeTeXColspec "`wide'" "`not'" "`star'" "`stardetach'" "`staraux'"
+ local opening `"`macval(opening)'{`extracolsep'l*{@E}{`value'}}"'
+ }
+ }
+ if "`mode0'"=="html" {
+ local brr
+ foreach chunk of local note {
+ local closing `"`macval(closing)' `"`brr'`macval(chunk)'"'"'
+ local brr "
"
+ }
+ if `"`macval(closing)'"'!="" {
+ local closing `""| " `macval(closing)' |
"'
+ }
+ }
+ else if "`mode0'"=="tex" {
+ foreach chunk of local note {
+ local closing `"`macval(closing)' `"\multicolumn{@span}{l}{\footnotesize `macval(chunk)'}\\\"'"'
+ }
+ }
+ else if "`mode0'"=="csv" {
+ foreach chunk of local note {
+ local closing `"`macval(closing)' `"`csvlhs'`macval(chunk)'""'"'
+ }
+ }
+ else if "`mode0'"=="rtf" {
+ if `"`macval(note)'"'!="" local closing "\pard"
+ foreach chunk of local note {
+ local closing `"`macval(closing)' `"`macval(chunk)'\par"'"'
+ }
+ }
+ else {
+ local closing `"`macval(note)'"'
+ }
+ local closing `"`macval(closing)' ``mode'_close2'"'
+ if `"`macval(title)'"'!="" | "`mode0'"!="tex" {
+ local closing `"`macval(closing)' ``mode'_close'"'
+ }
+ else if "`mode0'"=="tex" & "`star'"!="" {
+ local closing `"`macval(closing)' }"'
+ }
+ if "`page'"!="" {
+ local closing `"`macval(closing)' ``mode'_close0'"'
+ }
+ local toprule `"``mode'_toprule'"'
+ local bottomrule `"``mode'_bottomrule'"'
+ local topgap `"``mode'_topgap'"'
+ local bottomgap `"``mode'_bottomgap'"'
+ }
+ local midrule `"``mode'_midrule'"'
+ local midgap `"``mode'_midgap'"'
+// - compose prehead()
+ if `"`macval(prehead)'"'=="" {
+ if `"`lines'"'!="" {
+ local opening `"`macval(opening)' `macval(toprule)'"'
+ }
+ else if `"`gaps'"'!="" {
+ local opening `"`macval(opening)' `macval(topgap)'"'
+ }
+ SaveRetok `macval(opening)'
+ local opening `"`macval(value)'"'
+ if `"`macval(opening)'"'!="" {
+ local prehead `"prehead(`macval(opening)')"'
+ }
+ }
+// - compose posthead()
+ if `"`macval(posthead)'"'=="" {
+ if `"`lines'"'!="" {
+ local posthead `"posthead(`macval(midrule)')"'
+ }
+ else if `"`gaps'"'!="" {
+ local posthead `"posthead(`macval(midgap)')"'
+ }
+ }
+// - compose prefoot()
+ if `"`macval(prefoot)'"'=="" & `"`macval(stats)'"'!="" {
+ if `"`lines'"'!="" {
+ local prefoot `"prefoot(`macval(midrule)')"'
+ }
+ else if `"`gaps'"'!="" {
+ local prefoot `"prefoot(`macval(midgap)')"'
+ }
+ }
+// - compose postfoot()
+ if `"`macval(postfoot)'"'=="" {
+ if `"`lines'"'!="" {
+ local closing `"`macval(bottomrule)' `macval(closing)'"'
+ }
+ else if `"`gaps'"'!="" {
+ local closing `"`macval(bottomgap)' `macval(closing)'"'
+ }
+ SaveRetok `macval(closing)'
+ local closing `"`macval(value)'"'
+ if `"`macval(closing)'"'!="" {
+ local postfoot postfoot(`macval(closing)')
+ }
+ }
+
+ if `"`macval(varlabels)'"'=="" {
+ if `"`gaps'"'!="" {
+ local varl `", end("" `macval(midgap)') nolast"'
+ }
+ if "`label'"!="" {
+ local varl `"_cons Constant`macval(varl)'"'
+ }
+ if `"`macval(coeflabels)'"'!="" {
+ local varl `"`macval(coeflabels)' `macval(varl)'"'
+ }
+ if trim(`"`macval(varl)'"')!="" {
+ local varlabels varlabels(`macval(varl)')
+ }
+ }
+
+// noconstant option
+ if `"`drop'"'=="" {
+ if "`noconstant'"!="" {
+ local drop drop(_cons)
+ }
+ }
+
+// compute beta coefficients (run estadd to add e(beta))
+ if "`beta'"!="" {
+ capt findfile estadd.ado
+ if _rc {
+ di as err "-estadd- is required to compute beta coefficients"
+ di as err "type {stata ssc install estadd}"
+ error 499
+ }
+ local estnames `"`anything'"'
+ if `"`estnames'"'=="" {
+ capt est_expand $esto
+ if !_rc {
+ local estnames `"$esto"'
+ }
+ }
+ estadd beta, replace: `estnames'
+ }
+
+// execute estout
+ CleanEstoutCmd `anything' `using' , ///
+ `macval(cells)' `drop' `nomargin' `margin' `margin2' `noeform' `eform' ///
+ `nodiscrete' `macval(stats)' `stardetach' `macval(starlevels)' ///
+ `varwidth' `modelwidth' `noabbrev' `abbrev' `unstack' ///
+ `macval(begin)' `macval(delimiter)' `macval(end)' ///
+ `macval(title)' `macval(prehead)' `macval(posthead)' `macval(prefoot)' ///
+ `macval(postfoot)' `label' `macval(varlabels)' `macval(mlabels)' `nonumbers' ///
+ `numbers' `macval(collabels)' `macval(eqlabels)' `macval(mgroups)' ///
+ `macval(substitute)' `notype'`type' level(`level') `macval(options)'
+
+ if "`noisily'"!="" {
+ gettoken chunk rest: cmd, parse(",")
+ di as txt `"`chunk'"' _c
+ gettoken chunk rest: rest, bind
+ while `"`macval(chunk)'"'!="" {
+ di as txt `" `macval(chunk)'"'
+ gettoken chunk rest: rest, bind
+ }
+ }
+ `macval(cmd)'
+ if `"`using'"'!="" {
+ di as txt `"(output written to {browse `using0'})"'
+ }
+ return local estout `macval(cmd)'
+end
+
+program _estout_options
+ syntax [, ///
+ Cells(passthru) ///
+ Drop(passthru) ///
+/// Keep(string asis) ///
+/// Order(string asis) ///
+/// Indicate(string asis) ///
+/// TRansform(string asis) ///
+/// EQuations(passthru) ///
+ NOEFORM eform ///EFORM2(string) ///
+ NOMargin Margin Margin2(passthru) ///
+ NODIscrete /// DIscrete(string asis) ///
+/// MEQs(string) ///
+ level(numlist max=1 int >=10 <=99) ///
+ Stats(passthru) ///
+ STARLevels(passthru) ///
+/// NOSTARDetach ///
+ STARDetach ///
+ VARwidth(passthru) ///
+ MODELwidth(passthru) ///
+ NOABbrev ABbrev ///
+/// NOUNStack
+ UNStack ///
+ BEGin(passthru) ///
+ DELimiter(passthru) ///
+ end(passthru) ///
+/// DMarker(string) ///
+/// MSign(string) ///
+/// NOLZ lz ///
+ SUBstitute(passthru) ///
+ TItle(passthru) ///
+ NOLEgend LEgend ///
+ PREHead(passthru) ///
+ POSTHead(passthru) ///
+ PREFoot(passthru) ///
+ POSTFoot(passthru) ///
+/// HLinechar(string) ///
+/// NOLabel
+ Label ///
+ VARLabels(passthru) ///
+/// REFcat(string asis) ///
+ MLabels(passthru) ///
+ NONUMbers NUMbers ///NUMbers2(string asis) ///
+ COLLabels(passthru) ///
+ EQLabels(passthru) ///
+ MGRoups(passthru) ///
+/// NOReplace Replace ///
+/// NOAppend Append ///
+ NOTYpe TYpe ///
+/// NOSHOWTABS showtabs ///
+/// STYle(string) ///
+/// DEFaults(string) ///
+ * ]
+ foreach opt in ///
+ cells drop noeform eform nomargin margin margin2 nodiscrete ///
+ level stats starlevels stardetach varwidth modelwidth unstack ///
+ noabbrev abbrev begin delimiter end substitute title nolegend ///
+ legend prehead posthead prefoot postfoot label varlabels mlabels ///
+ nonumbers numbers collabels eqlabels mgroups notype type ///
+ options {
+ c_local `opt' `macval(`opt')'
+ }
+end
+
+prog NotBothAllowed
+ args opt1 opt2
+ if `"`opt1'"'!="" {
+ if `"`opt2'"'!="" {
+ di as err `"options `opt1' and `opt2' not both allowed"'
+ exit 198
+ }
+ }
+end
+
+prog SwitchOnIfEmpty
+ args opt1 opt2
+ if `"`opt2'"'=="" {
+ c_local `opt1' `opt1'
+ }
+end
+
+prog _getfilesuffix, rclass // based on official _getfilename.ado
+ version 8
+ gettoken filename rest : 0
+ if `"`rest'"' != "" {
+ exit 198
+ }
+ local hassuffix 0
+ gettoken word rest : filename, parse(".")
+ while `"`rest'"' != "" {
+ local hassuffix 1
+ gettoken word rest : rest, parse(".")
+ }
+ if `"`word'"'=="." {
+ di as err `"incomplete filename; ends in ."'
+ exit 198
+ }
+ if `hassuffix' return local suffix `".`word'"'
+ else return local suffix ""
+end
+
+prog MakeTeXColspec
+ args wide not star detach aux
+ if "`star'"!="" & "`detach'"!="" & "`aux'"=="" local value "r@{}l"
+ else local value "c"
+ if "`wide'"!="" & "`not'"=="" {
+ if "`star'"!="" & "`detach'"!="" & "`aux'"!="" local value "`value'r@{}l"
+ else local value "`value'c"
+ }
+ c_local value "`value'"
+end
+
+prog SaveRetok
+ gettoken chunk 0: 0, q
+ local value `"`macval(chunk)'"'
+ gettoken chunk 0: 0, q
+ while `"`macval(chunk)'"'!="" {
+ local value `"`macval(value)' `macval(chunk)'"'
+ gettoken chunk 0: 0, q
+ }
+ c_local value `"`macval(value)'"'
+end
+
+prog CleanEstoutCmd
+ syntax [anything] [using] [ , * ]
+ local cmd estout
+ if `"`macval(anything)'"'!="" {
+ local cmd `"`macval(cmd)' `macval(anything)'"'
+ }
+ if `"`macval(using)'"'!="" {
+ local cmd `"`macval(cmd)' `macval(using)'"'
+ }
+ if `"`macval(options)'"'!="" {
+ local cmd `"`macval(cmd)', `macval(options)'"'
+ }
+ c_local cmd `"`macval(cmd)'"'
+end
diff --git a/82/replication_package/ESTA/esta.hlp b/82/replication_package/ESTA/esta.hlp
new file mode 100644
index 0000000000000000000000000000000000000000..a520419b4b40bea6b35e4e333115f01c5d87ef87
--- /dev/null
+++ b/82/replication_package/ESTA/esta.hlp
@@ -0,0 +1,824 @@
+{smcl}
+{* 29nov2006}{...}
+{hi:help esta}{right:also see: {helpb estout}, {helpb estadd}, {helpb esto}}
+{hline}
+
+{title:Title}
+
+{p 4 4 2}{hi:esta} {hline 2} Display formatted regression table
+
+
+{title:Table of contents}
+
+ {help esta##syn:Syntax}
+ {help esta##des:Description}
+ {help esta##opt:Options}
+ {help esta##exa:Examples}
+ {help esta##ret:Returned results}
+ {help esta##aut:Backmatter}
+
+{marker syn}
+{title:Syntax}
+
+{p 8 15 2}
+{cmd:esta} [ {it:namelist} ] [ {cmd:using} {it:filename} ] [ {cmd:,}
+{it:options} ]
+
+
+ where {it:namelist} is {cmd:_all} | {cmd:*} | {it:name} [{it:name} ...]
+ {it:name} is {it:identifier} | {cmd:.}
+
+
+ {it:options}{col 26}description
+ {hline 70}
+ {help esta##main:Main}
+ {cmd:b(}{it:{help esta##fmt:fmt}}{cmd:)}{col 26}{...}
+specify format for point estimates
+ {cmd:beta}[{cmd:(}{it:{help esta##fmt:fmt}}{cmd:)}]{col 26}{...}
+display beta coefficients instead of point est's
+ {cmd:main(}{it:name} [{it:{help esta##fmt:fmt}}]{cmd:)}{col 26}{...}
+display contents of {cmd:e(}{it:name}{cmd:)} instead of point e's
+ {cmd:t(}{it:{help esta##fmt:fmt}}{cmd:)}{col 26}{...}
+specify format for t-statistics
+ {cmd:abs}{col 26}{...}
+use absolute value of t-statistics
+ {cmd:not}{col 26}{...}
+suppress t-statistics
+ {cmd:se}[{cmd:(}{it:{help esta##fmt:fmt}}{cmd:)}]{col 26}{...}
+display standard errors instead of t-statistics
+ {cmd:p}[{cmd:(}{it:{help esta##fmt:fmt}}{cmd:)}]{col 26}{...}
+display p-values instead of t-statistics
+ {cmd:ci}[{cmd:(}{it:{help esta##fmt:fmt}}{cmd:)}]{col 26}{...}
+display confidence intervals instead of t-stat's
+ {cmd:aux(}{it:name} [{it:{help esta##fmt:fmt}}]{cmd:)}{col 26}{...}
+display contents of {cmd:e(}{it:name}{cmd:)} instead of t-stat's
+ [{ul:{cmd:no}}]{cmdab:con:stant}{col 26}{...}
+drop/keep models' intercepts
+
+ {help esta##stars:Significance stars}
+ [{cmd:no}]{cmd:star}{col 26}{...}
+do not/do report significance stars
+ {cmd:staraux}{col 26}{...}
+attach stars to t-stat's instead of point est's
+ {cmdab:starl:evels:(}{it:list}{cmd:)}{col 26}{...}
+define significance symbols and thresholds
+
+ {help esta##stat:Summary statistics}
+ {cmd:r2}|{cmd:ar2}|{cmd:pr2}[{cmd:(}{it:{help esta##fmt:fmt}}{cmd:)}]{col 26}{...}
+display (adjusted, pseudo) R-squared
+ {cmd:aic}|{cmd:bic}[{cmd:(}{it:{help esta##fmt:fmt}}{cmd:)}]{col 26}{...}
+display Akaike's or Schwarz's information crit.
+ {cmdab:sca:lars:(}{it:list}{cmd:)}{col 26}{...}
+display any other scalars contained in {cmd:e()}
+ {cmd:sfmt(}{it:{help esta##fmt:fmt}} [{it:...}]{cmd:)}{col 26}{...}
+set format(s) for {cmd:scalars()}
+ {cmd:noobs}{col 26}{...}
+do not display the number of observations
+ {cmd:obslast}{col 26}{...}
+place the number of observations last
+
+ {help esta##layout:Layout}
+ {cmd:wide}{col 26}{...}
+place point est's and t-stat's beside one another
+ [{ul:{cmd:no}}]{cmdab:pa:rentheses}{col 26}{...}
+do not/do print parentheses around t-statistics
+ {cmdab:br:ackets}{col 26}{...}
+use brackets instead of parentheses
+ [{ul:{cmd:no}}]{cmdab:gap:s}{col 26}{...}
+suppress/add vertical spacing
+ [{ul:{cmd:no}}]{cmdab:li:nes}{col 26}{...}
+suppress/add horizontal lines
+ {cmd:compress}{col 26}{...}
+reduce horizontal spacing
+ {cmd:plain}{col 26}{...}
+produce a minimally formatted table
+
+ {help esta##label:Labeling}
+ {cmdab:l:abel}{col 26}{...}
+make use of variable labels
+ {cmdab:ti:tle:(}{it:string}{cmd:)}{col 26}{...}
+specify a title for the table
+ {cmdab:mti:tles:(}{it:list}{cmd:)}{col 26}{...}
+specify model titles to appear in table header
+ {cmdab:nomti:tles}{col 26}{...}
+disable model titles
+ [{ul:{cmd:no}}]{cmdab:dep:vars}{col 26}{...}
+do not/do print dependent variables in header
+ [{ul:{cmd:no}}]{cmdab:num:bers}{col 26}{...}
+do not/do print model numbers in table header
+ {cmdab:coef:labels:(}{it:list}{cmd:)}{col 26}{...}
+specify labels for coefficients
+ [{ul:{cmd:no}}]{cmdab:note:s}{col 26}{...}
+suppress/add notes in the table footer
+ {cmdab:addn:otes:(}{it:list}{cmd:)}{col 26}{...}
+add lines at the end of the table
+
+ {help esta##format:Document format}
+ {cmd:fixed} | {cmd:tab} | {cmd:csv} | {cmd:rtf} | {cmd:html} | {cmd:tex} | {cmd:booktabs}
+ {col 26}{...}
+set the document format ({cmd:fixed} is the default)
+ {cmdab:f:ragment}{col 26}{...}
+suppress table opening and closing (LaTeX, HTML)
+ {cmd:page}{col 26}{...}
+add page opening and closing (LaTeX, HTML)
+ {cmdab:align:ment(}{it:string}{cmd:)}{col 26}{...}
+set alignment within columns (LaTeX, HTML, RTF)
+ {cmdab:width(}{it:string}{cmd:)}{col 26}{...}
+set width of table (LaTeX, HTML, RTF)
+
+ {help esta##output:Output}
+ {cmdab:r:eplace}{col 26}{...}
+overwrite an existing file
+ {cmdab:a:ppend}{col 26}{...}
+append the output to an existing file
+ {cmdab:ty:pe}{col 26}{...}
+force prining the table in the results window
+ {cmdab:n:oisily}{col 26}{...}
+display the executed {helpb estout} command
+
+ {help esta##advanced:Advanced}
+ {cmdab:d:rop:(}{it:list}{cmd:)}{col 26}{...}
+drop individual coefficients
+ {cmdab:k:eep:(}{it:list}{cmd:)}{col 26}{...}
+keep individual coefficients
+ {cmdab:o:rder:(}{it:list}{cmd:)}{col 26}{...}
+change order of coefficients
+ {cmdab:eq:uations:(}{it:list}{cmd:)}{col 26}{...}
+match the models' equations
+ {cmd:eform}{col 26}{...}
+report exponentiated coefficients
+ {cmdab:m:argin}{col 26}{...}
+report marginal effects/elasticities
+ {cmdab:uns:tack}{col 26}{...}
+place multiple equations in separate columns
+ {it:estout_options}{col 26}{...}
+any other {helpb estout} options
+ {hline 70}
+
+{marker des}
+{title:Description}
+
+{p 4 4 2}{cmd:esta} is a wrapper for {helpb estout}. It
+produces a pretty-looking publication-style regression table
+from stored estimates without much typing. The compiled table is
+displayed in the Stata results window or, optionally, written
+to a text file specified by {cmd:using}.
+
+{p 4 4 2}{it:namelist} provides the names of the stored estimates
+to be tabulated. You may use the {cmd:*} and {cmd:?} wildcards
+in {it:namelist}. If {it:namelist} is omitted, {cmd:esta} tabulates the estimates
+listed in global macro {cmd:$esto} ({cmd:$esto} is set by {cmd:esto};
+see help {helpb esto}, if installed). If {it:namelist} is omitted and
+{cmd:$esto} is empty, {cmd:esta} tabulates the current estimates
+(i.e. the model fit last).
+
+{p 4 4 2}See help {helpb estimates} for information about
+storing estimation results. An alternative to the {cmd:estimates store} command
+is also provided by the
+{helpb esto} package from the SSC Archive (type
+{net "describe http://fmwww.bc.edu/repec/bocode/e/esto":{bind:ssc describe esto}}).
+
+{p 4 4 2}Note that {cmd:esta} requires {helpb estout} to be installed on your
+system. Type
+
+ . {net "describe http://fmwww.bc.edu/repec/bocode/e/estout":{bind:ssc describe estout}}
+
+{p 4 4 2}Additionally, {cmd:esta}'s {cmd:beta} option requires
+{helpb estadd}. Type
+
+ . {net "describe http://fmwww.bc.edu/repec/bocode/e/estadd":{bind:ssc describe estadd}}
+
+{marker opt}
+{title:Options}
+{marker main}
+{dlgtab:Main}
+
+{p 4 8 2}
+ {cmd:b(}{it:{help esta##fmt:fmt}}{cmd:)} sets the numerical display format
+for the point estimates. The default format is {cmd:a3}. (See
+{help esta##fmt:Numerical formats} below for details on available
+formats.)
+
+{p 4 8 2}
+{cmd:beta}[{cmd:(}{it:{help esta##fmt:fmt}}{cmd:)}]
+requests that standardized beta coefficients be displayed in place of the
+raw point estimates and, optionally, sets the display format (the default is to
+print three decimal places). Note that {cmd:beta} causes the intercept
+be dropped from the table (unless {cmd:constant} is specified). The
+{cmd:beta} option requires
+{helpb estadd} to be installed on your system (see
+ {net "describe http://fmwww.bc.edu/repec/bocode/e/estadd":{bind:ssc describe estadd}}).
+
+{p 4 8 2}
+ {cmd:main(}{it:name} [{it:{help esta##fmt:fmt}}]{cmd:)}
+requests that the statistics stored in {cmd:e(}{it:name}{cmd:)}
+be displayed in place of the point estimates
+and, optionally, sets the display format (the default is to use
+the display format for point estimates). For example,
+{cmd:e(}{it:name}{cmd:)} may contain statistics added by {cmd:estadd}
+(see help {helpb estadd}, if installed).
+
+{p 4 8 2}
+ {cmd:t(}{it:{help esta##fmt:fmt}}{cmd:)} sets the display format
+for t-statistics. The default is to display two decimal places.
+
+{p 4 8 2}
+ {cmd:abs} causes absolute values of t-statistics to be
+ reported.
+
+{p 4 8 2}
+ {cmd:not} suppresses the printing of t-statistics.
+
+{p 4 8 2}
+ {cmd:se}[{cmd:(}{it:{help esta##fmt:fmt}}{cmd:)}]
+requests that standard errors be displayed in place of t-statistics
+and, optionally, sets the display format (the default is to use
+the display format for point estimates).
+
+{p 4 8 2}
+ {cmd:p}[{cmd:(}{it:{help esta##fmt:fmt}}{cmd:)}]
+requests that p-values be displayed in place of t-statistics
+and, optionally, sets the display format (the default is to
+print three decimal places)
+
+{p 4 8 2}
+ {cmd:ci}[{cmd:(}{it:{help esta##fmt:fmt}}{cmd:)}]
+requests that confidence intervals be displayed in place of t-statistics
+and, optionally, sets the display format (the default is to use
+the display format for point estimates). {cmd:level(}{it:#}{cmd:)}
+assigns the confidence level, in percent. The default is {cmd:level(95)}
+or as set by {helpb set level}.
+
+{p 4 8 2}
+ {cmd:aux(}{it:name} [{it:{help esta##fmt:fmt}}]{cmd:)}
+requests that the statistics stored in {cmd:e(}{it:name}{cmd:)}
+be displayed in place of t-statistics
+and, optionally, sets the display format (the default is to use
+the display format for point estimates). For example,
+{cmd:e(}{it:name}{cmd:)} may contain statistics added by {cmd:estadd}
+(see help {helpb estadd}, if installed).
+
+{p 4 8 2}
+ {cmd:noconstant} causes the intercept be dropped from the
+table. Specify {cmd:constant} to include the constant in situations where
+it is dropped by default.
+
+{marker stars}
+{dlgtab:Significance stars}
+
+{p 4 8 2}
+{cmd:star} causes stars denoting the significance of the
+ coefficients be printed next to the point estimates: {cmd:*} for p<.05,
+ {cmd:**} for p<.01, and {cmd:***} for p<.001. Printing the stars is
+ the default. Type {cmd:nostar} to suppress the stars.
+
+{p 4 8 2}
+{cmd:staraux} causes the significance stars be printed next to the
+t-statistics (or standard errors, etc.) instead of the point estimates.
+
+{p 4 8 2}
+{cmd:starlevels(}{it:symbol} {it:level} [{it:...}]{cmd:)} overrides the default symbols and thresholds
+for "significance stars". For instance,
+{bind:{cmd:starlevels(+ 0.10 * 0.05)}}
+sets the following thresholds: {cmd:+} for p<.10 and {cmd:*} for
+p<.05. Note that the thresholds must lie in the (0,1] interval and must be
+specified in descending order.
+
+{marker stat}
+{dlgtab:Summary statistics}
+
+{p 4 8 2}
+{cmd:r2}[{cmd:(}{it:{help esta##fmt:fmt}}{cmd:)}],
+{cmd:ar2}[{cmd:(}{it:{help esta##fmt:fmt}}{cmd:)}], and
+{cmd:pr2}[{cmd:(}{it:{help esta##fmt:fmt}}{cmd:)}]
+include the R-squared, the adjusted R-squared, and the
+pseudo-R-squared in the table footer and, optionally,
+set the corresponding display formats (the default is to display three decimal places).
+
+{p 4 8 2}
+{cmd:aic}[{cmd:(}{it:{help esta##fmt:fmt}}{cmd:)}] and
+{cmd:bic}[{cmd:(}{it:{help esta##fmt:fmt}}{cmd:)}]
+include Akaike's and Schwarz's information criterion
+in the table footer and, optionally,
+set the corresponding display formats (the default is to use
+the display format for point estimates).
+
+{p 4 8 2}
+ {cmd:scalars(}{it:list}{cmd:)} may be used to add other
+{cmd:e()}-scalars to the table footer (type {cmd:ereturn list}
+to display a list of available {cmd:e()}-scalars after fitting a model;
+see help {helpb ereturn}). For example,
+{cmd:scalars(df_m)} would report the model degrees of freedom for
+each model. {it:list} may be a simple list of names of
+{cmd:e()}-scalars, e.g.
+
+ {com}. esta, scalars(ll_0 ll chi2){txt}
+
+{p 8 8 2}or, alternatively, a list of quoted name-label pairs, e.g.
+
+ {com}. esta, scalars({bind:"ll Log lik."} {bind:"chi2 Chi-squared"}){txt}
+
+{p 4 8 2}
+ {cmd:sfmt(}{it:{help esta##fmt:fmt}} [{it:...}]{cmd:)}
+sets the display format(s) for the statistics specified in
+{cmd:scalars()} (the default is to use
+the display format for point estimates). If {cmd:sfmt()}
+contains less elements than {cmd:scalars()}, the last specified format
+is used for the remaining scalars. That is, specify only one format
+if the same format be used for all scalars.
+
+{p 4 8 2}
+ {cmd:noobs} suppresses displaying information on the
+ number of observations. The
+ default is to report the number of observations of each model in
+ the table footer.
+
+{p 4 8 2}
+ {cmd:obslast} displays the number of observations in the last
+ row of the table footer. The default is to use the
+ first row.
+
+{marker layout}
+{dlgtab:Layout}
+
+{p 4 8 2}
+{cmd:wide} causes point estimates and t-statistics (or standard errors,
+etc.) be printed beside one another instead of beneath one another.
+
+{p 4 8 2}
+ {cmd:parentheses} encloses t-statistics (or standard errors,
+etc.) in parentheses. This is the
+default. Specify {cmd:noparentheses} to suppress the parentheses.
+
+{p 4 8 2}
+ {cmd:brackets} uses square brackets, [], instead of
+ parentheses. Note that brackets are the default for confidence
+ intervals.
+
+{p 4 8 2}
+ {cmd:gaps} adds empty rows (or, more generally, additional vertical space)
+ between coefficients to increase
+ readability (empty rows are also inserted between the table's
+ header, body, and footer, unless {cmd:lines} is activated). This is
+ the default unless {cmd:wide} or {cmd:not} is specified. Type {cmd:nogaps}
+ to suppress the extra spacing. {cmd:gaps} is currently not
+ supported in the {cmd:rtf} mode.
+
+{p 4 8 2}
+ {cmd:lines} adds horizontal lines to the table
+ separating the table's header, body, and footer. This is the default. Specify
+ {cmd:nolines} to suppress the lines. Lines are always
+ suppressed in the {cmd:tab} and {cmd:csv} modes and are currently not
+ supported in the {cmd:rtf} mode.
+
+{p 4 8 2}
+{cmd:compress} reduces the amount of horizontal spacing (so that more models
+fit on screen without line breaking). The option has no
+effect in the {cmd:tab}, {cmd:csv}, and {cmd:rtf} modes. Furthermore, note that in the
+TeX and HTML modes the {cmd:compress} option only changes the arrangement
+the table's code, but not the look of the compiled end-product.
+
+{p 4 8 2}
+{cmd:plain} produces a minimally formatted table. It is a shortcut to
+specifying {cmd:nostar}, {cmd:nodepvars}, {cmd:nonumbers},
+{cmd:noparentheses}, {cmd:nogaps}, {cmd:nolines} and {cmd:nonotes}
+and setting all formats to {cmd:%9.0g}. Note that the
+disabled options can be switched on again. For example,
+
+ {com}. esta, plain star{txt}
+
+{p 8 8 2}would produce a plain table including significance
+stars.
+
+{marker label}
+{dlgtab:Labeling}
+
+{p 4 8 2}
+{cmd:label} specifies that variable labels be used instead of variable
+names (and estimates titles be used instead of estimates names).
+Furthermore, {cmd:label} prints "Constant" instead of "_cons".
+
+{p 4 8 2}
+{cmd:title(}{it:string}{cmd:)} may be used to provide a title for the table.
+If specified, {it:string} is printed at the top of the table. Note
+that specifying a title causes the table to be set up as a floating object
+in LaTeX mode. You may want to set a label for referencing in this
+case. For example, if you type {cmd:title(blah\label{tab1})}, then
+"\ref{tab1}" could be used in the LaTeX document to point to the
+table.
+
+{p 4 8 2}
+ {cmd:mtitles(}{it:list}{cmd:)}
+specifies a list of model titles to appear above the models' columns
+in the table header. Enclose titles in double quotes if they
+contain spaces, e.g. {cmd:mtitles({bind:"Model 1"} {bind:"Model 2"})}. The
+default is to print the name (or label) of the (first)
+dependent variable of a model as the model's title.
+
+{p 4 8 2}
+ {cmd:nomtitles}
+suppresses printing of model titles.
+
+{p 4 8 2}
+{cmd:depvars} prints the name (or label) of the (first)
+dependent variable of a model as the model's title in the table
+header. This is the
+default. Specify {cmd:nodepvars} to use the names (or titles) of the stored estimates
+instead of the variables.
+
+{p 4 8 2}
+ {cmd:numbers}
+includes a row containing consecutive model numbers in the table
+header. This is the
+default. Specify {cmd:nonumbers} to suppress printing the model
+numbers.
+
+{p 4 8 2}
+ {cmd:coeflabels(}{it:name} {it:label} [...]{cmd:)}
+specifies labels for the coefficients. Specify names and labels in
+pairs and, if necessary, enclose labels in double quotes,
+e.g., {cmd:coeflabels(mpg Milage rep78 {bind:"Repair Record"})}.
+
+{p 4 8 2}
+{cmd:notes} prints notes at the end of the table explaining
+the significance symbols and
+the type of displayed statistics. This is the
+default. Specify {cmd:nonotes} to suppress the notes.
+
+{p 4 8 2}
+{cmd:addnotes(}{it:list}{cmd:)} may be used to add further lines of
+text at the bottom of the table. Lines containing blanks must be
+enclosed in double quotes, e.g. {cmd:addnotes({bind:"Line 1"} {bind:"Line 2"})}.
+
+{marker format}
+{dlgtab:Document format}
+
+{p 4 8 2}{cmd:fixed}, {cmd:tab}, {cmd:csv}, {cmd:rtf}, {cmd:html}, {cmd:tex}, and
+{cmd:booktabs} choose the table's basic output format. The default
+format is {cmd:fixed}. However, if the {it:filename} specified by
+{cmd:using} has a ".csv" suffix, the {cmd:csv} format is the default.
+Likewise, {cmd:rtf} is the default for ".rtf", {cmd:html} for
+".htm" or ".html", and {cmd:tex} for ".tex".
+
+{p 8 8 2}
+{cmd:fixed} produces a fixed-format ASCII table. This is suitable, for example,
+if the table be displayed in the Stata Results window.
+
+{p 8 8 2}{cmd:tab} produces a tab-delimited ASCII table.
+
+{p 8 8 2}{cmd:csv} produces an ASCII table for use with Microsoft Excel.
+Delimiter is a semicolon (although {ul:C}omma
+{ul:S}eparated {ul:V}alue format would suggest using a comma). In order
+to prevent Excel from interpreting the contents of the table cells,
+they are enclosed double quotes preceded by an equal sign (i.e. ="...").
+However, if the {cmd:plain} option is specified, the table cells are
+enclosed in double quotes without the leading equal sign.
+The first method is appropriate if you want to preserve the table's
+formatting. The second method is appropriate
+if you want to use the table's contents for further computations in Excel.
+
+{p 8 8 2}{cmd:rtf} produces a Rich Text Format table for use with
+word processors. Note that the {cmd:rtf} mode still is rather
+experimental. It has only been tested with Microsoft Word 2002 on Windows
+XP.
+
+{p 8 8 2}{cmd:html} produces a simple HTML formatted table.
+
+{p 8 8 2}{cmd:tex} produces a LaTeX formatted table.
+
+{p 8 8 2}{cmd:booktabs} produces a LaTeX formatted table
+for use with LaTeX's {it:booktabs} package.
+
+{p 4 8 2}{cmd:fragment} causes the table's opening and closing
+specifications to be suppressed. This is relevant primarily in LaTeX and
+HTML mode.
+
+{p 4 8 2}{cmd:page} adds opening and closing code to define a whole
+LaTeX or HTML document. The default is to produce a raw table that
+can then be included into an existing LaTeX or HTML document.
+
+{p 4 8 2}{cmd:alignment(}{it:string}{cmd:)} may be used to specify
+the alignment of the models' columns in LaTeX, HTML, or RTF mode.
+
+{p 8 8 2}In LaTeX mode {it:string}
+should be a LaTeX column specifier. The default is
+to center the columns. To produce right-aligned columns, for example,
+type {cmd:alignment(r)}. If the table contains multiple columns per
+model/equation, the alignment specification should define all
+columns. For example, if the
+{cmd:wide} option is specified, you could type {cmd:alignment(cr)}
+to, say, center the point estimates and right-align the
+t-statistics. Note that more sophisticated column definitions are
+often needed to produce appealing results. In particular,
+LaTeX's {it:dcolumn} package proves useful to align columns
+on the decimal point.
+
+{p 8 8 2}In HTML mode {it:string}
+should be a HTML alignment specifier. The default is to omit
+alignment specification, which results in left aligned columns. To
+center the columns in HTML, for example, specify
+{cmd:alignment(center)}. Other than in LaTeX mode, the same alignment
+is used for all columns if the table contains multiple columns per
+model/equation in the HTML mode.
+
+{p 8 8 2}In RTF mode {it:string}
+should be one of {cmd:l}, {cmd:c}, {cmd:r}, and {cmd:j}. The default is
+to center the columns. To produce right-aligned columns, for example,
+type {cmd:alignment(r)}. The same alignment
+is used for all columns if the table contains multiple columns per
+model/equation in the RTF mode.
+
+{p 8 8 2}Note that {cmd:alignment()} does not change the alignment
+of the variable names/labels in the left stub of the table. They are always
+left-aligned.
+
+{p 4 8 2}{cmd:width(}{it:string}{cmd:)} sets the overall width of the
+table in LaTeX, HTML, or RTF mode. {it:string}
+should be LaTeX or HTML literal or a positive number
+to be interpreted as percentage in RTF mode. For example, specify
+{cmd:width(\hsize)} in LaTeX, {cmd:width(100%)} in HTML, or
+{cmd:width(100)} in RTF mode to span the
+whole page. The table columns will spread regularly over the
+specified width.
+
+{marker output}
+{dlgtab:Output}
+
+{p 4 8 2}
+{cmd:replace} permits {cmd:esta} to overwrite an existing file.
+
+{p 4 8 2}
+{cmd:append} specifies that the output be appended to an existing file. It
+may be used even if the file does not yet exist.
+
+{p 4 8 2}
+{cmd:type} specifies that the assembled table be printed in the
+results window and the log file. This is the default unless {cmd:using}
+is specified.
+
+{p 4 8 2}
+{cmd:noisily} displays the executed {helpb estout} command.
+
+{marker advanced}
+{dlgtab:Advanced}
+
+{p 4 8 2}
+{cmd:drop(}{it:droplist}{cmd:)} identifies the coefficients to be dropped from
+the table. A {it:droplist} comprises one or more
+specifications, separated by white space. A specification can be either a
+parameter name (e.g. {cmd:price}), an equation name followed by a colon
+(e.g. {cmd:mean:}), or a full name (e.g. {cmd:mean:price}). You may use the
+{cmd:*} and {cmd:?} wildcards in equation names and parameter names. Be
+sure to refer to the matched equation names,
+and not to the original equation names in the models, when using
+the {cmd:equations()} option to match equations.
+
+{p 4 8 2}
+{cmd:keep(}{it:keeplist}{cmd:)} selects the coefficients to be included in the
+table. {it:keeplist} is specified analogous to {it:droplist} in
+{cmd:drop()} (see above).
+
+{p 4 8 2}
+{cmd:order(}{it:orderlist}{cmd:)} changes the order of the coefficients
+and equations within the table. {it:orderlist} is specified analogous to
+{it:droplist} in {cmd:drop()} (see above). Coefficients and equations
+that do not appear in {it:orderlist} are placed last (in their original order).
+
+{p 4 8 2}
+{cmd:equations(}{it:eqmatchlist}{cmd:)} specifies how the models' equations are
+to be matched. This option is passed to the internal call of
+{cmd:estimates table}. See help {helpb estimates} on how to specify this
+option. The most common usage is {cmd:equations(1)} to match all the first equations
+in the models.
+
+{p 4 8 2}
+{cmd:eform} displays the regression table in
+exponentiated form. The exponent of a coefficient is displayed in lieu of the
+untransformed coefficient; standard errors and confidence intervals are
+transformed as well. Note that the intercept is dropped in
+eform-mode, unless {cmd:constant} is specified.
+
+{p 4 8 2}
+{cmd:margin} indicates that the
+marginal effects or elasticities be reported instead of the raw
+coefficients. A prerequisite for this option to work correctly is
+that {cmd:mfx} has been applied to a model prior to storing its
+results (see help {helpb mfx}). Note that the standard errors,
+etc. are transformed as well. Furthermore, the intercept is
+dropped, unless {cmd:constant} is specified.
+
+{p 4 8 2}
+{cmd:unstack} specifies that the individual equations from multiple-equation
+models (e.g. {cmd:mlogit}, {cmd:reg3}, {cmd:heckman}) be placed in
+separate columns. The default is to place the equations below one another in a
+single column.
+
+{p 4 8 2}
+{it:estout_options} are any other {cmd:estout} options
+(see help {helpb estout}). Note that
+{cmd:estout} options take precedence over {cmd:esta} options. For
+example,
+
+{p 8 20 2}{cmd:cells()}{space 5}disables {cmd:b()}, {cmd:beta()}, {cmd:main()},
+{cmd:t()}, {cmd:abs}, {cmd:not},
+{cmd:se()}, {cmd:p()}, {cmd:ci()}, {cmd:aux()},
+{cmd:star}, {cmd:staraux}, {cmd:parentheses}, and {cmd:brackets},
+
+{p 8 20 2}{cmd:stats()}{space 5}disables {cmd:r2()}, {cmd:ar2()}, {cmd:pr2()},
+{cmd:aic()}, {cmd:bic()}, {cmd:scalars()}, {cmd:sfmt()}, {cmd:noobs},
+and {cmd:obslast}.
+
+{marker fmt}
+{dlgtab:Numerical formats}
+
+{p 4 4 2}Numerical display formats may be specified in {cmd:esta}
+as follows:
+
+{p 5 8 2}1. Official Stata's display formats: You may specify
+formats such as, e.g., {cmd:%9.0g} or {cmd:%8.2f}. See help {help format}
+for a list of available formats.
+
+{p 5 8 2}2. Fixed format: You may specify an integer
+value such as {cmd:0}, {cmd:1}, {cmd:2}, etc. to evoke a display
+format with a fixed number of decimal
+places. For example, {cmd:t(3)} would display t-statistics
+with three decimal places.
+
+{p 5 8 2}3. Automatic format: You may specify {cmd:a1}, {cmd:a2}, ...,
+or {cmd:a9} to cause {cmd:esta} choose a
+reasonable display format for each number
+depending on the number's value. The {it:#} in
+{cmd:a}{it:#} determines the minimum precision
+according to the following rules:
+
+{p 10 12 2}o Absolute numbers smaller than 1 are displayed with {it:#} significant
+decimal places (i.e. with {it:#} decimal places ignoring any leading
+zeros after the decimal point). For example, {cmd:0.00123456} is
+displayed as {cmd:0.00123} if the format is {cmd:a3}.
+
+{p 10 12 2}o Absolute numbers greater than 1 are displayed with as
+many digits required to retain at least one decimal place and are displayed with
+a minimum of ({it:#} + 1) digits. For example, if
+the format is {cmd:a3}, {cmd:1.23456} is displayed as {cmd:1.235},
+{cmd:12.3456} is displayed as {cmd:12.35},
+and {cmd:1234.56} is displayed as {cmd:1234.6}.
+
+{p 10 12 2}o In any case, integers are displayed with zero decimal
+places. Furthermore, note that very large or very small absolute numbers are displayed
+in exponential format.
+
+{marker exa}
+{title:Examples}
+
+{p 4 4 2}The following examples are intended to illustrate the basic
+usage of {cmd:esta}. They only scratch the surface. The procedure is
+to first fit and store some models and then apply {cmd:esta} to these
+stored estimates:
+
+ {com}. sysuse auto
+ {txt}(1978 Automobile Data)
+
+ {com}. quietly regress price weight mpg
+ {txt}
+ {com}. estimates store model1
+ {txt}
+ {com}. quietly regress price weight mpg foreign
+ {txt}
+ {com}. estimates store model2
+ {txt}
+ {com}. esta *, ar2
+
+ {res}--------------------------------------------
+ (1) (2)
+ price price
+ --------------------------------------------
+ weight 1.747** 3.465***
+ (2.72) (5.49)
+
+ mpg -49.51 21.85
+ (-0.57) (0.29)
+
+ foreign 3673.1***
+ (5.37)
+
+ _cons 1946.1 -5853.7
+ (0.54) (-1.73)
+ --------------------------------------------
+ N 74 74
+ adj. R-sq 0.273 0.478
+ --------------------------------------------
+ t-statistics in parentheses
+ * p<0.05, ** p<0.01, *** p<0.001
+ {txt}
+
+{p 4 4 2}The same table using labels:
+
+ {com}. esta *, ar2 label
+
+ {res}----------------------------------------------------
+ (1) (2)
+ Price Price
+ ----------------------------------------------------
+ Weight (lbs.) 1.747** 3.465***
+ (2.72) (5.49)
+
+ Mileage (mpg) -49.51 21.85
+ (-0.57) (0.29)
+
+ Car type 3673.1***
+ (5.37)
+
+ Constant 1946.1 -5853.7
+ (0.54) (-1.73)
+ ----------------------------------------------------
+ Observations 74 74
+ Adjusted R-squared 0.273 0.478
+ ----------------------------------------------------
+ t-statistics in parentheses
+ * p<0.05, ** p<0.01, *** p<0.001
+ {txt}
+
+{p 4 4 2}Plain table:
+
+ {com}. esta *, ar2 plain
+
+ {res} model1 model2
+ weight 1.746559 3.464706
+ 2.723238 5.493003
+ mpg -49.51222 21.8536
+ -.5746808 .2944391
+ foreign 3673.06
+ 5.370142
+ _cons 1946.069 -5853.696
+ .541018 -1.733408
+ N 74 74
+ adj. R-sq .2734846 .4781119
+ {txt}
+
+{p 4 4 2}Using standard errors in brackets and suppress significance
+stars:
+
+ {com}. esta *, se nostar brackets
+
+ {res}--------------------------------------
+ (1) (2)
+ price price
+ --------------------------------------
+ weight 1.747 3.465
+ [0.641] [0.631]
+
+ mpg -49.51 21.85
+ [86.16] [74.22]
+
+ foreign 3673.1
+ [684.0]
+
+ _cons 1946.1 -5853.7
+ [3597.0] [3377.0]
+ --------------------------------------
+ N 74 74
+ --------------------------------------
+ Standard errors in brackets
+ {txt}
+
+{p 4 4 2}Printing beta coefficients (requires {helpb estadd}):
+
+ {com}. esta *, beta
+
+ {res}--------------------------------------------
+ (1) (2)
+ price price
+ --------------------------------------------
+ weight 0.460** 0.913***
+ (2.72) (5.49)
+
+ mpg -0.097 0.043
+ (-0.57) (0.29)
+
+ foreign 0.573***
+ (5.37)
+ --------------------------------------------
+ N 74 74
+ --------------------------------------------
+ Standardized beta coefficients; t-statistics in parentheses
+ * p<0.05, ** p<0.01, *** p<0.001{txt}
+
+{marker ret}
+{title:Returned results}
+
+{p 4 4 2}{cmd:esta} returns in macro {cmd:r(estout)} a copy of the executed
+{helpb estout} command (typing {cmd:`r(estout)'} after {cmd:esta}
+reproduces the table).
+
+{marker aut}
+{title:Author}
+
+{p 4 4 2} Ben Jann, ETH Zurich, jann@soz.gess.ethz.ch
+
+{marker als}
+{title:Also see}
+
+ Manual: {hi:[R] estimates}
+
+{p 4 13 2}Online: help for
+ {helpb estimates}, {help estcom}; {helpb estout}, {helpb estadd}, {helpb esto} (if installed)
diff --git a/82/replication_package/ESTA/esta.pkg b/82/replication_package/ESTA/esta.pkg
new file mode 100644
index 0000000000000000000000000000000000000000..6bfebf7aabb8b0e1b051422187b906be4265f015
--- /dev/null
+++ b/82/replication_package/ESTA/esta.pkg
@@ -0,0 +1,7 @@
+v 3
+d esta
+d Author: Ben Jann, ETH Zurich, jann@soz.gess.ethz.ch
+d
+d Distribution-Date: 29nov2006
+f esta.ado
+f esta.hlp
diff --git a/82/replication_package/ESTA/readme.txt b/82/replication_package/ESTA/readme.txt
new file mode 100644
index 0000000000000000000000000000000000000000..7b8e3b02cdcc89abf2bec40b3ae4ac52ae192951
--- /dev/null
+++ b/82/replication_package/ESTA/readme.txt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5f57ab35bcb33c357e6d233bc26c4b0758688ce4d9037666b01f01221485da83
+size 445
diff --git a/82/replication_package/ESTA/stata.toc b/82/replication_package/ESTA/stata.toc
new file mode 100644
index 0000000000000000000000000000000000000000..ecaa9d7a93304bd42095c2e743096a027c1a8fc0
--- /dev/null
+++ b/82/replication_package/ESTA/stata.toc
@@ -0,0 +1,2 @@
+v 3
+p esta
diff --git a/82/replication_package/PACKAGES/x_gmm.ado b/82/replication_package/PACKAGES/x_gmm.ado
new file mode 100644
index 0000000000000000000000000000000000000000..8c002d1b251846a0a0e586cecf3c17259874f741
--- /dev/null
+++ b/82/replication_package/PACKAGES/x_gmm.ado
@@ -0,0 +1,298 @@
+/************************************************************************/
+/* x_gmm.ado */
+/*GMM ESTIMATION FOR X-SECTIONAL DATA WITH LOCATION-BASED DEPENDENCE */
+/*for STATA 6.0 */
+/* by Jean-Pierre Dube */
+/* Northwestern University */
+/* July 10, 1999 */
+/* */
+/* reference: */
+/* */
+/* Conley, Timothy G.[1996]. "Econometric Modelling of Cross */
+/* Sectional Dependence." Northwestern University Working Paper. */
+/* */
+/************************************************************************/
+/************************************************************************/
+/* To invoke this command type: */
+/* >>x_gmm coordlist cutofflist depvar regressorlist */
+/* instrumentlist, xreg() inst() coord() */
+/* */
+/* NOTE: (1) If you want a constant in the regression, specify one of */
+/* your input variables as a 1. (ie. include it in list of */
+/* regressors). */
+/* */
+/* (2) MUST specify positive value for xreg(), inst() and */
+/* coord() options. */
+/* */
+/* (3) xreg() denotes # regressors */
+/* inst() denotes # instruments */
+/* coord() denotes dimension of coordinates */
+/* */
+/* (4) Your list of instruments may contain some of the regressors */
+/* */
+/* (5) Your cutofflist must correspond to coordlist (same order) */
+/* */
+/* OUTPUT: */
+/* betagmm= 2 Step GMM estimator Allowing for Spatial */
+/* Correlation */
+/* cov_dep= variance-covariance matrix of betagmm */
+/* J=value of GMM criterion function test of */
+/* overidentifying conditions */
+/* */
+/* For Comparison: */
+/* b2SLS=2SLS estimates (assuming spatial independence) */
+/* cov2SLS=var-cov matrix of b2SLS */
+/************************************************************************/
+
+
+program define x_gmm
+ version 6.0
+#delimit ; /*sets `;' as end of line*/
+
+
+/*FIRST I TAKE INFO. FROM COMMAND LINE AND ORGANIZE IT*/
+local varlist "req ex min(1)"; /*must specify at least one variable...
+ all must be existing in memory*/
+local options "xreg(int -1) inst(int -1) COord(int -1)";
+ /* # regressors, # instruments, dimension of location coordinates*/
+
+parse "`*'"; /*separate options and variables*/
+
+if `xreg'<1{;
+ if `xreg'==-1{;
+ di in red "option xreg() required!!!";
+ exit 198};
+ di in red "xreg(`xreg') is invalid";
+ exit 198};
+
+if `inst'<1{;
+ if `inst'==-1{;
+ di in red "option ins() required!!!";
+ exit 198};
+ di in red "inst(`inst') is invalid";
+ exit 198};
+
+if `inst'<`xreg'{;
+ di in red "underidentified system: `xreg' regressors and `inst' instruments!!!";
+ exit 198};
+
+if `coord'<1{;
+ if `coord'==-1{;
+ di in red "option coord() required!!!";
+ exit 198};
+ di in red "coord(`coord') is invalid";
+ exit 198};
+
+/*Separate input variables:
+ coordinates, cutoffs, dependent, regressors, instruments*/
+
+parse "`varlist'", parse(" ");
+local a=1;
+while `a'<=`coord'{;
+ tempvar coord`a';
+ gen `coord`a''=``a''; /*get coordinates*/
+local a=`a'+1};
+
+local aa=1;
+while `aa'<=`coord'{;
+ tempvar cut`aa';
+ gen `cut`aa''=``a''; /*get cutoffs*/
+ local a=`a'+1;
+local aa=`aa'+1};
+
+tempvar Y;
+gen `Y'=``a''; /*get dep variable*/
+local depend : word `a' of `varlist';
+
+local a=`a'+1;
+
+local b=1;
+while `b'<=`xreg'{;
+ tempvar X`b';
+ local ind`b'="`b'";
+ gen `X`b''= ``a'';
+ local ind`b' : word `a' of `varlist';
+ local a=`a'+1;
+local b=`b'+1}; /*get indep variable(s)*/
+
+local c=1;
+while `c'<=`inst'{;
+ tempvar Z`c';
+ gen `Z`c''=``a'';
+ local a=`a'+1;
+local c=`c'+1}; /*get instrument(s)*/
+
+/*NOW I DO 2-STEP GMM AND COMPUTE THE COV MATRIX*/
+quietly{; /*so that steps are not printed on screen*/
+
+ /*CREATE MATRICES A AND B FOR 2SLS*/
+ tempname A B Zk Zkk W B_N A_N invN ZZ ZZ_N invZZ;
+ scalar `invN'=1/_N;
+ if `inst'==1{;
+ mat accum `ZZ'=`Z1', noconstant};
+ else{;
+ mat accum `ZZ'=`Z1'-`Z`inst'', noconstant};
+ mat `ZZ_N'=`ZZ'*`invN';
+ mat `invZZ'=inv(`ZZ_N');
+ capture mat drop `B';
+ capture mat drop `A';
+ local d=1;
+ while `d'<=`inst'{;
+ if `inst'==1{;
+ mat vecaccum `Zk'=`Z`d'' `X1', noconstant};
+ else{;
+ mat vecaccum `Zk'=`Z`d'' `X1'-`X`xreg'', noconstant};
+ mat vecaccum `Zkk'=`Z`d'' `Y', noconstant;
+ mat `B'=nullmat(`B') \ `Zk';
+ mat `A'=nullmat(`A') \ `Zkk';
+ local d=`d'+1};
+ mat `B_N'=`B'*`invN';
+ mat `A_N'=`A'*`invN';
+
+ /*REGULAR 2SLS PROCEDURE*/
+ tempname sigma BinvZZ BinvZZB invBZZB cov BZZA;
+ tempvar Ehat sighat Esquare XE Xtemp;
+ mat `BinvZZ'=`B_N''*`invZZ';
+ mat `BinvZZB'=`BinvZZ'*`B_N';
+ mat `BZZA'=`BinvZZ'*`A_N';
+ mat `invBZZB'=inv(`BinvZZB');
+ mat b2SLS=`invBZZB'*`BZZA'; /*2SLS estimator*/
+ gen `Xtemp'=0;
+ gen `XE'=0;
+ local e=1;
+ while `e'<=`xreg'{;
+ replace `Xtemp'=`X`e'';
+ replace `XE'=`XE'+`Xtemp'*b2SLS[`e',1];
+ local e=`e'+1};
+ gen `Ehat'=`Y'-`XE';
+ gen `Esquare'=`Ehat'*`Ehat';
+ egen `sighat'=mean(`Esquare');
+ scalar `sigma'=`sighat'*`invN';
+ mat cov2SLS=`invBZZB'*`sigma'; /*standard 2SLS cov matrix*/
+
+
+ /*GMM CORRECTING FOR SERIAL DEPENDENCE*/
+ tempname BB BA invBB BAZUUZ ZUUZ1 ZUUZ2 ZUUZ ZUUZt fix;
+ tempvar ZUUk X_tem u_tem uhat window;
+ mat `BB'=`B''*`B';
+ mat `invBB'=inv(`BB');
+ mat `BA'=`B''*`A';
+ mat bgmm1=`invBB'*`BA';
+ gen `X_tem'=0;
+ gen `u_tem'=0;
+ local f=1;
+ while `f'<=`xreg'{;
+ replace `X_tem'=`X`f'';
+ replace `u_tem'=`u_tem'+`X_tem'*bgmm1[`f',1];
+ local f=`f'+1};
+ gen `uhat'=`Y'-`u_tem';
+ mat `ZUUZ'=J(`inst',`inst',0);
+ gen `ZUUk'=0;
+ gen `window'=1; /*initializes mat.s/var.s to be used*/
+ local i=1;
+ while `i'<=_N{; /*loop through all observations*/
+ local j=1;
+ replace `window'=1;
+ while `j'<=`coord'{; /*loop through coordinates*/
+ if `i'==1{;
+ gen dis`j'=0};
+ replace dis`j'=abs(`coord`j''-`coord`j''[`i']);
+ replace `window'=`window'*(1-dis`j'/`cut`j'');
+ replace `window'=0 if dis`j'>=`cut`j'';
+ local j=`j'+1}; /*create window*/
+ capture mat drop `ZUUZ2';
+ local k=1;
+ while `k'<=`inst'{;
+ replace `ZUUk'=`Z`k''[`i']*`uhat'*`uhat'[`i']*`window';
+ if `inst'==1{;
+ mat vecaccum
+ `ZUUZ1'=`ZUUk' `Z1', noconstant};
+ else{;
+ mat vecaccum
+ `ZUUZ1'=`ZUUk' `Z1'-`Z`inst'', noconstant};
+ mat `ZUUZ2'=nullmat(`ZUUZ2') \ `ZUUZ1';
+ local k=`k'+1};
+ mat `ZUUZt'=`ZUUZ2'';
+ mat `ZUUZ1'=`ZUUZ2' +`ZUUZt';
+ scalar `fix'=.5; /*to correct for double-counting*/
+ mat `ZUUZ1'=`ZUUZ1'*`fix';
+ mat `ZUUZ'=`ZUUZ' +`ZUUZ1';
+ local i=`i'+1};
+ mat `ZUUZ'=`ZUUZ'*`invN';
+
+ /*STEP (2)*/
+ tempname What BW BWB invBWB BWA;
+ tempvar Ehat2;
+ mat `What'=`ZUUZ';
+ mat `What'=inv(`What');
+ mat `BW'=`B''*`What';
+ mat `BWB'=`BW'*`B';
+ mat `invBWB'=inv(`BWB');
+ mat `BWA'=`BW'*`A';
+ mat betagmm=`invBWB'*`BWA';
+
+
+mat `BW'=`B_N''*`What';
+mat `BWB'=`BW'*`B_N';
+mat cov_dep=inv(`BWB'); /*corrected covariance matrix*/
+mat cov_dep=cov_dep*`invN';
+
+/*Compute the GMM Criterion Statistics*/
+tempname m qq zubar zu;
+tempvar J Zuk u1 zubar;
+gen `Zuk'=0;
+replace `u_tem'=0;
+local ii=1;
+while `ii'<=`xreg'{;
+ replace `X_tem'=`X`ii'';
+ replace `u_tem'=`u_tem'+`X_tem'*betagmm[`ii',1];
+local ii=`ii'+1};
+gen `u1'=`Y'-`u_tem';
+mat `m'=J(`inst',1,0);
+capture mat drop `m';
+local jj=1;
+while `jj'<=`inst'{;
+ replace `Zuk'=`Z`jj''*`u1';
+ egen zubar`jj'=mean(`Zuk');
+ scalar `zubar'=zubar`jj'[_N];
+ mat `zu'=(1);
+ mat `zu'=`zu'*`zubar';
+ mat `m'=nullmat(`m') \ `zu';
+local jj=`jj'+1};
+mat `qq'=`m''*`What';
+mat J=`qq'*`m';
+gen `J'=J[1,1]*_N;
+
+}; /*end quietly command*/
+
+/*THIS PART CREATES AND PRINTS THE OUTPUT TABLE IN STATA*/
+local z=1;
+local v=`a';
+di _newline(2) _skip(5)
+"Results for 2-Step Spatial GMM";
+di _newline _col(20) " number of observations= " _N;
+di _newline _col(20) " crit. fn. test of overid. restrictions= " `J';
+di _newline "Dependent variable= `depend'";
+di _newline
+"variable" _col(13) "2SLS Est." _col(29) "2SLS SE" _col(40)
+ "Spatial GMM Est." _col(58) "Spatial GMM SE";
+di
+"--------" _col(13) "-------------" _col(29) "---------" _col(40)
+ "-------------" _col(58) "------------------";
+
+while `z'<=`xreg'{;
+ tempvar beta`z' beta1`z' se`z' see`z' se1`z' se2`z';
+ gen `beta`z''=b2SLS[`z',1];
+ gen `se`z''=cov2SLS[`z',`z'];
+ gen `see`z''=sqrt(`se`z'');
+ gen `beta1`z''=betagmm[`z',1];
+ gen `se1`z''=cov_dep[`z',`z'];
+ gen `se2`z''=sqrt(`se1`z'');
+ di "`ind`z''" _col(13) `beta`z'' _col(29) `see`z'' _col(40)
+ `beta1`z'' _col(58) `se2`z'';
+local z=`z'+1};
+end;
+
+exit;
+
+
diff --git a/82/replication_package/PACKAGES/x_ols.ado b/82/replication_package/PACKAGES/x_ols.ado
new file mode 100644
index 0000000000000000000000000000000000000000..02aa9b60b12102ad7e42f76b023a22a05b19e4e2
--- /dev/null
+++ b/82/replication_package/PACKAGES/x_ols.ado
@@ -0,0 +1,181 @@
+/************************************************************************/
+/* x_ols.ado */
+/*OLS ESTIMATION FOR X-SECTIONAL DATA WITH LOCATION-BASED DEPENDENCE */
+/*for STATA 6.0 */
+/* by Jean-Pierre Dube */
+/* Northwestern University */
+/* July 10, 1999 */
+/* */
+/* reference: */
+/* */
+/* Conley, Timothy G.[1996]. "Econometric Modelling of Cross */
+/* Sectional Dependence." Northwestern University Working Paper. */
+/* */
+/************************************************************************/
+/************************************************************************/
+/*To invoke this command type: */
+/* >>x_ols coordlist cutofflist depvar regressorlist, xreg() coord() */
+/* */
+/* (1)If you want a constant in the regression, specify one of the */
+/* input variables as a 1. (ie. include it in list of regressors). */
+/* */
+/* (2) You MUST specify the xreg() and coord() options. */
+/* */
+/* (3) xreg() denotes # regressors */
+/* coord() denotes dimension of coordinates */
+/* */
+/* (4) Your cutofflist must correspond to coordlist (same order) */
+/* */
+/* */
+/*OUTPUT: all the standard `reg' procedure matrices will be in memory. */
+/* There will also be a matrix cov_dep, the corrected variance- */
+/* covariance matrix. */
+/************************************************************************/
+
+
+program define x_ols
+ version 6.0
+#delimit ; /*sets `;' as end of line*/
+
+/*FIRST I TAKE INFO. FROM COMMAND LINE AND ORGANIZE IT*/
+local varlist "req ex min(1)"; /*must specify at least one variable...
+ all must be existing in memory*/
+local options "xreg(int -1) COord(int -1)";
+ /* # indep. var, dimension of location coordinates*/
+
+parse "`*'"; /*separate options and variables*/
+
+if `xreg'<1{;
+ if `xreg'==-1{;
+ di in red "option xreg() required!!!";
+ exit 198};
+ di in red "xreg(`xreg') is invalid";
+ exit 198};
+
+if `coord'<1{;
+ if `coord'==-1{;
+ di in red "option coord() required!!!";
+ exit 198};
+ di in red "coord(`coord') is invalid";
+ exit 198};
+
+
+/*Separate input variables:
+ coordinates, cutoffs, dependent, regressors*/
+
+parse "`varlist'", parse(" ");
+
+local a=1;
+while `a'<=`coord'{;
+ tempvar coord`a';
+ gen `coord`a''=``a''; /*get coordinates*/
+local a=`a'+1};
+
+local aa=1;
+while `aa'<=`coord'{;
+ tempvar cut`aa';
+ gen `cut`aa''=``a''; /*get cutoffs*/
+ local a=`a'+1;
+local aa=`aa'+1};
+
+tempvar Y;
+gen `Y'=``a''; /*get dep variable*/
+local depend : word `a' of `varlist';
+
+local a=`a'+1;
+
+local b=1;
+while `b'<=`xreg'{;
+ tempvar X`b';
+ local ind`b' : word `a' of `varlist';
+ gen `X`b''= ``a'';
+ local a=`a'+1;
+local b=`b'+1}; /*get indep var(s)...rest of list*/
+
+/*NOW I RUN THE REGRESSION AND COMPUTE THE COV MATRIX*/
+
+quietly{; /*so that steps are not printed on screen*/
+
+ /*(1) RUN REGRESSION*/
+ tempname XX XX_N invXX invN;
+ scalar `invN'=1/_N;
+ if `xreg'==1 {;
+ reg `Y' `X1', noconstant robust;
+ mat accum `XX'=`X1',noconstant;
+ mat `XX_N'=`XX'*`invN';
+ mat `invXX'=inv(`XX_N')}; /* creates (X'X/N)^(-1)*/
+ else{;
+ reg `Y' `X1'-`X`xreg'', noconstant;
+ mat accum `XX'=`X1'-`X`xreg'',noconstant;
+ mat `XX_N'=`XX'*`invN';
+ mat `invXX'=inv(`XX_N')}; /* creates (X'X/N)^(-1)*/
+ predict epsilon,residuals; /* OLS residuals*/
+
+ /*(2) COMPUTE CORRECTED COVARIANCE MATRIX*/
+ tempname XUUX XUUX1 XUUX2 XUUXt;
+ tempvar XUUk;
+ mat `XUUX'=J(`xreg',`xreg',0);
+ gen `XUUk'=0;
+ gen window=1; /*initializes mat.s/var.s to be used*/
+ local i=1;
+ while `i'<=_N{; /*loop through all observations*/
+ local d=1;
+ replace window=1;
+ while `d'<=`coord'{; /*loop through coordinates*/
+ if `i'==1{;
+ gen dis`d'=0};
+ replace dis`d'=abs(`coord`d''-`coord`d''[`i']);
+ replace window=window*(1-dis`d'/`cut`d'');
+ replace window=0 if dis`d'>=`cut`d'';
+ local d=`d'+1}; /*create window*/
+ capture mat drop `XUUX2';
+ local k=1;
+ while `k'<=`xreg'{;
+ replace `XUUk'=`X`k''[`i']*epsilon*epsilon[`i']*window;
+ mat vecaccum `XUUX1'=`XUUk' `X1'-`X`xreg'', noconstant;
+ mat `XUUX2'=nullmat(`XUUX2') \ `XUUX1';
+ local k=`k'+1};
+ mat `XUUXt'=`XUUX2'';
+ mat `XUUX1'=`XUUX2'+`XUUXt';
+ scalar fix=.5; /*to correct for double-counting*/
+ mat `XUUX1'=`XUUX1'*fix;
+ mat `XUUX'=`XUUX'+`XUUX1';
+ local i=`i'+1};
+ mat `XUUX'=`XUUX'*`invN';
+
+}; /*end quietly command*/
+
+tempname V VV;
+mat `V'=`invXX'*`XUUX';
+mat `VV'=`V'*`invXX';
+
+matrix cov_dep=`VV'*`invN'; /*corrected covariance matrix*/
+
+
+/*THIS PART CREATES AND PRINTS THE OUTPUT TABLE IN STATA*/
+local z=1;
+local v=`a';
+di _newline(2) _skip(5)
+"Results for Cross Sectional OLS corrected for Spatial Dependence";
+di _newline _col(35) " number of observations= " _result(1);
+di " Dependent Variable= " "`depend'";
+di _newline
+"variable" _col(13) "ols estimates" _col(29) "White s.e." _col(42)
+ "s.e. corrected for spatial dependence";
+di
+"--------" _col(13) "-------------" _col(29) "----------" _col(42)
+ "-------------------------------------";
+
+while `z'<=`xreg'{;
+ tempvar se1`z' se2`z';
+ local beta`z'=_b[`X`z''];
+ local se`z'=_se[`X`z''];
+ gen `se1`z''=cov_dep[`z',`z'];
+ gen `se2`z''=sqrt(`se1`z'');
+ di "`ind`z''" _col(13) `beta`z'' _col(29) `se`z'' _col(42) `se2`z'';
+local z=`z'+1};
+
+end;
+exit;
+
+
diff --git a/82/replication_package/PACKAGES/xgmlt.ado b/82/replication_package/PACKAGES/xgmlt.ado
new file mode 100644
index 0000000000000000000000000000000000000000..3764d6baac3164646ade65bf23a394a325c5d13f
--- /dev/null
+++ b/82/replication_package/PACKAGES/xgmlt.ado
@@ -0,0 +1,250 @@
+/************************************************************************/
+/* xgmlt.ado */
+/* ESTIMATION OF A LOGIT MODEL FOR X-SECTIONAL DATA */
+/* WITH LOCATION-BASED DEPENDENCE */
+/*for STATA 6.0 */
+/* by Robert Vigfusson (email r-vigfusson@nwu.edu) */
+/* Northwestern University */
+/* October 11, 1999 */
+/* based on code for x_gmm.ado written by Jean-Pierre Dube */
+/* */
+/* reference: */
+/* */
+/* Conley, Timothy G.[1999]. "GMM Estimation with Cross */
+/* Sectional Dependence." J. of Econometrics 92:1, 1-45. */
+/* */
+/************************************************************************/
+/************************************************************************/
+
+
+* WARNING: This program is offered without any guarantee.
+* If you find errors, please contact r-vigfusson@nwu.edu.
+
+
+
+/* To invoke this command type: */
+/* >>xgmlt coordlist cutofflist depvar regressorlist, xreg() coord() */
+/* */
+/* NOTE: (1) If you want a constant in the regression, specify one of */
+/* your input variables as a 1. (ie. include it in list of */
+/* regressors). */
+/* */
+/* (2) MUST specify positive value for xreg() and coord() options. */ */
+/* (3) xreg() denotes # regressors */
+/* */
+/* coord() denotes dimension of coordinates */
+/* */
+/* */
+/* (5) Your cutofflist must correspond to coordlist (same order) */
+/* cutofflist is the values of LM. Zero weight is put on terms */
+/* more than LM units apart in that dimmension in the calculation */
+/* of the covariance term */
+/* */
+/* OUTPUT: */
+/* betalgt= Maximum Likelihood Logit estimator */
+/* cov_nd= variance-covariance matrix of betalgt */
+/* without correction for spatial correlation */
+/* cov_dep= variance-covariance matrix of betalgt */
+/* without correction for spatial correlation */
+ */
+/************************************************************************/
+
+program define xgmlt
+version 6.0
+syntax varlist(min=1) [, xreg(int -1) COord(int -1)]
+/* everything is required. */
+#delimit ; /*sets `;' as end of line*/
+
+
+/* The following IF statments check to make sure everything is set up correctly. */
+
+if `xreg'<1{;
+ if `xreg'==-1{;
+ di in red "option xreg() required!!!";
+ exit 198};
+ di in red "xreg(`xreg') is invalid";
+ exit 198};
+
+
+if `coord'<1{;
+ if `coord'==-1{;
+ di in red "option coord() required!!!";
+ exit 198};
+ di in red "coord(`coord') is invalid";
+ exit 198};
+
+/*Separate input variables: coordinates, cutoffs, dependent, regressors */
+
+
+parse "`varlist'", parse(" ");
+local a=1;
+while `a'<=`coord'{;
+ tempvar coord`a';
+ gen `coord`a''=``a''; /*get coordinates*/
+local a=`a'+1};
+
+local aa=1;
+while `aa'<=`coord'{;
+ tempvar cut`aa';
+ gen `cut`aa''=``a''; /*get cutoffs*/
+ local a=`a'+1;
+local aa=`aa'+1};
+
+tempvar Y;
+gen `Y'=``a''; /*get dep variable*/
+local depend : word `a' of `varlist';
+
+local a=`a'+1;
+
+local b=1;
+while `b'<=`xreg'{;
+ tempvar X`b';
+ local ind`b'="`b'";
+ gen `X`b''= ``a'';
+ local ind`b' : word `a' of `varlist';
+ local a=`a'+1;
+local b=`b'+1}; /*get indep variable(s)*/
+
+
+
+
+
+
+/*ESTIMATE THE LOGIT Model*/
+quietly{
+
+if `xreg'==1{;
+ logit `Y' `X1',noconstant};
+else{;
+ logit `Y' `X1'-`X`xreg'' , noconstant};
+
+/*save the parameter estimates and the variance covariance matrix */
+matrix betalgt = e(b);
+matrix cov_nd = e(V);
+
+/* Create the residual term */
+tempvar phat uhat;
+predict `phat'; /* Phat is exp(XB)/(1+exp(XB)) */
+gen `uhat' = `Y' - `phat'; /* The residual */
+
+
+};
+
+
+/*Create the Variance Covariance matrix that corrects for SPATIAL DEPENDENCE*/
+tempname XUUX XUUk window XUUX1 XUUX2 XUUXt fix ; /* Declare a set of variables */
+matrix `XUUX' = J(`xreg',`xreg',0); /* Intializes the matrix */
+
+quietly{
+
+gen `XUUk'=0;
+gen `window'=1; /*initializes mat.s/var.s to be used*/
+local i=1;
+
+while `i'<=_N{; /*loop through all observations*/
+ local j=1;
+ replace `window'=1;
+ while `j'<=`coord'{; /*loop through coordinates*/
+ if `i'==1{;
+ tempvar dis`j';
+ gen `dis`j''=0};
+
+ replace `dis`j''=abs(`coord`j''-`coord`j''[`i']);
+ replace `window'=`window'*(1-`dis`j''/`cut`j'');
+ replace `window'=0 if `dis`j''>=`cut`j'';
+ local j=`j'+1}; /*create window*/
+
+ /* End of j loop */
+
+ capture mat drop `XUUX2';
+ local k=1;
+ while `k'<=`xreg'{;
+ replace `XUUk'=`X`k''[`i']*`uhat'*`uhat'[`i']*`window';
+ if `xreg'==1{;
+ mat vecaccum `XUUX1'=`XUUk' `X1', noconstant};
+ else{;
+ mat vecaccum `XUUX1'=`XUUk' `X1'-`X`xreg'', noconstant};
+
+ mat `XUUX2'=nullmat(`XUUX2') \ `XUUX1';
+ local k=`k'+1};
+
+ /* End of k loop */
+
+ mat `XUUXt'=`XUUX2'';
+ mat `XUUX1'=`XUUX2' +`XUUXt';
+ scalar `fix'=.5; /*to correct for double-counting*/
+ mat `XUUX1'=`XUUX1'*`fix';
+ mat `XUUX'=`XUUX' +`XUUX1';
+ local i=`i'+1};
+
+/* End of i loop */
+
+matrix `XUUX'=`XUUX'/_N;
+
+/* We just calculated the Variance Covariance matrix and it is stored in */
+/* in the local variable XUUX. */
+
+/* The next step is to calculate dg and construct the var-covar matrix for the parameters */
+/* for the parameter estimates. */
+
+
+
+/* Compute dg */
+/* g = uhat*X so dg = d(uhat)/db * X */
+/* d(uhat)/db(j) = -1*(phat)*(1-phat)*X(j) */
+
+
+/* use phat calculated above using predict */
+tempvar sqdphat dg ;
+gen `sqdphat' = sqrt(`phat'*(1-`phat')); /* I take the square root to make following calculations easier */
+
+local k=1;
+
+while `k'<=`xreg'{;
+ tempvar STF`k';
+ gen `STF`k''=`X`k''*`sqdphat';
+ local k=`k'+1};
+
+/* End of While loop */
+
+if `xreg'==1{;
+ mat accum `dg'=``STF1', noconstant};
+else{;
+ mat accum `dg'=`STF1'-`STF`xreg'', noconstant};
+
+
+matrix `dg' = `dg'/_N;
+/* Create the var-covariance matrix. */
+mat cov_dep = inv(`dg'*inv(`XUUX')*`dg'')/_N; /*corrected covariance matrix*/
+
+
+/*end of the quietly section */
+};
+
+
+/*THIS PART CREATES AND PRINTS THE OUTPUT TABLE IN STATA*/
+local z=1;
+local v=`a';
+di _newline(2) _skip(5)
+"Results for Logit with Spatial Dependence ";
+di _newline _col(20) " number of observations= " _N;
+di _newline "Dependent variable= `depend'";
+di _newline
+"variable" _col(13) "Coef Est." _col(29) "Standard SE" _col(45) "Spatial SE";
+di
+"--------" _col(13) "-------------" _col(29) "---------" _col(45) "------------------";
+
+while `z'<=`xreg'{;
+ tempvar beta`z' beta1`z' se`z' see`z' se1`z' se2`z';
+ gen `beta`z''=betalgt[1,`z'];
+ gen `se`z''=cov_nd[`z',`z'];
+ gen `see`z''=sqrt(`se`z'');
+ gen `se1`z''=cov_dep[`z',`z'];
+ gen `se2`z''=sqrt(`se1`z'');
+ di "`ind`z''" _col(13) `beta`z'' _col(29) `see`z'' _col(45) `se2`z'';
+local z=`z'+1};
+end;
+
+exit;
+
+
diff --git a/82/replication_package/README.docx b/82/replication_package/README.docx
new file mode 100644
index 0000000000000000000000000000000000000000..652bace55b1b061891c2d0f3b85abc7255835462
Binary files /dev/null and b/82/replication_package/README.docx differ
diff --git a/82/should_reproduce.txt b/82/should_reproduce.txt
new file mode 100644
index 0000000000000000000000000000000000000000..479647378c734f9264bd3f4cb9469cbd957d8791
--- /dev/null
+++ b/82/should_reproduce.txt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:cc3b657a8b8fcd4b2f91688ad06cf78835d63fc5d124ed9610fcdafa5ca82803
+size 9
diff --git a/83/paper.pdf b/83/paper.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..04ae5289d69a4ce38c424766a1bf300df0fbf657
--- /dev/null
+++ b/83/paper.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:48f930d111c6e48b500be12e9bfd419946f1a9677e66a231062e1fe280a2b2fa
+size 1935706
diff --git a/83/replication_package/README.pdf b/83/replication_package/README.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..bff9fae1aeb8ecb4d4c623c4b6e8d91990b3e0bf
--- /dev/null
+++ b/83/replication_package/README.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d35012f448c0c3d0e9b247c3d04a341d975a358c220a41151c41c326823870da
+size 183362
diff --git a/83/replication_package/data/Hydropower_USA_Developed_1953.csv b/83/replication_package/data/Hydropower_USA_Developed_1953.csv
new file mode 100644
index 0000000000000000000000000000000000000000..257f5f74b4b8cc75c47661138870e2e1e6c91f23
--- /dev/null
+++ b/83/replication_package/data/Hydropower_USA_Developed_1953.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5137d8361687a4094f0a7af646e326ac2f0440ced94a81e149fa825e9c3c21bd
+size 263094
diff --git a/83/replication_package/data/Hydropower_USA_Developed_1953.dta b/83/replication_package/data/Hydropower_USA_Developed_1953.dta
new file mode 100644
index 0000000000000000000000000000000000000000..8b57550a4547b0cf6445aa98367c1ff405981c06
--- /dev/null
+++ b/83/replication_package/data/Hydropower_USA_Developed_1953.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c0de53840b39bf66e433f22bf6c7ab54014dafabe12d9963299e284e61a09687
+size 465360
diff --git a/83/replication_package/data/Hydropower_USA_Undeveloped_1953.csv b/83/replication_package/data/Hydropower_USA_Undeveloped_1953.csv
new file mode 100644
index 0000000000000000000000000000000000000000..d794f1838723d5cba943b22117a59b927f58733e
--- /dev/null
+++ b/83/replication_package/data/Hydropower_USA_Undeveloped_1953.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:6c6633e467079d0abe581adf561a20126ea74236aafcb40cc559040a962ace5e
+size 281021
diff --git a/83/replication_package/data/Hydropower_USA_Undeveloped_1953.dta b/83/replication_package/data/Hydropower_USA_Undeveloped_1953.dta
new file mode 100644
index 0000000000000000000000000000000000000000..69dc1b529ba41cd7a2a30e7f31d974bd51ec5ea7
--- /dev/null
+++ b/83/replication_package/data/Hydropower_USA_Undeveloped_1953.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f4afff3e229d480833f04c68a997ac0f4cfb7fa0556404df0ecf92c2851f9ee8
+size 562789
diff --git a/83/replication_package/data/NBER_gaz1990countydistance100miles.csv b/83/replication_package/data/NBER_gaz1990countydistance100miles.csv
new file mode 100644
index 0000000000000000000000000000000000000000..cb73d8c9e5d9d0e85620feb89485a8ca9b1045b8
--- /dev/null
+++ b/83/replication_package/data/NBER_gaz1990countydistance100miles.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b71a4ba384617b3a79bdeaa4a3da172dcfb1a6f655bb01b2935a4f89d79c25ab
+size 6353075
diff --git a/83/replication_package/data/NBER_gaz1990countydistance100miles.dta b/83/replication_package/data/NBER_gaz1990countydistance100miles.dta
new file mode 100644
index 0000000000000000000000000000000000000000..bcbd3e8b5206ad8d9588a76079a37fde98f12516
--- /dev/null
+++ b/83/replication_package/data/NBER_gaz1990countydistance100miles.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c7671695efe88df0d479ba480798c8b3fc7b8d8ba5bb55f7a43d665b0ff980f4
+size 8647142
diff --git a/83/replication_package/data/climate1950_2000.csv b/83/replication_package/data/climate1950_2000.csv
new file mode 100644
index 0000000000000000000000000000000000000000..5ae52eeb0576f8ba7b4e0a09b348b4609582701d
--- /dev/null
+++ b/83/replication_package/data/climate1950_2000.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:6ce991759ae6b57dc63629a0c9eb179dbdaafec43c74a6a1da3f49758a81ed86
+size 259675
diff --git a/83/replication_package/data/climate1950_2000.dta b/83/replication_package/data/climate1950_2000.dta
new file mode 100644
index 0000000000000000000000000000000000000000..cbcee12fbc6defd9354c213049c738aab48899a4
--- /dev/null
+++ b/83/replication_package/data/climate1950_2000.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:814b8e21770969e6ffa1a715f9eff21ca1eac0ae7baae853767748cfe6a7bd34
+size 115647
diff --git a/83/replication_package/data/counties_largeplants100mwff.csv b/83/replication_package/data/counties_largeplants100mwff.csv
new file mode 100644
index 0000000000000000000000000000000000000000..1d179f5b77e2eb7c09f80f2d42f4747ec124684f
--- /dev/null
+++ b/83/replication_package/data/counties_largeplants100mwff.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:08b5c781db72d0e68542c0546ac8ee11393c53a8013d24fffa014c27aefe7af1
+size 52126
diff --git a/83/replication_package/data/counties_largeplants100mwff.dta b/83/replication_package/data/counties_largeplants100mwff.dta
new file mode 100644
index 0000000000000000000000000000000000000000..f41084aa603c3e92ecfe488ba6fdcef2a7bba817
--- /dev/null
+++ b/83/replication_package/data/counties_largeplants100mwff.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:63be127fbb1c41fcd59e0f6aaabded974610c058d007d044570669a83351c016
+size 31355
diff --git a/83/replication_package/data/counties_tiger_2000.csv b/83/replication_package/data/counties_tiger_2000.csv
new file mode 100644
index 0000000000000000000000000000000000000000..140e51817ae8bccd993fe962f45c30477f6adeb9
--- /dev/null
+++ b/83/replication_package/data/counties_tiger_2000.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f8ecdc155b6217f1eacd88598ad849fd7beae94f7d82e139f526156ab5a56d6c
+size 53101
diff --git a/83/replication_package/data/counties_tiger_2000.dta b/83/replication_package/data/counties_tiger_2000.dta
new file mode 100644
index 0000000000000000000000000000000000000000..4132697f8a77d525547296644ca9cef061e98381
--- /dev/null
+++ b/83/replication_package/data/counties_tiger_2000.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0d46e0f4d537a29387110ab48a2eda847c0977763618199d5bcb5db23d0ad450
+size 113981
diff --git a/83/replication_package/data/county_distance_trlinesHv.csv b/83/replication_package/data/county_distance_trlinesHv.csv
new file mode 100644
index 0000000000000000000000000000000000000000..94ddd9090506be9abb20ef904e394c8204f985ec
--- /dev/null
+++ b/83/replication_package/data/county_distance_trlinesHv.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:2f800bc6b569dfee6e85f9069909ed61df0e73fa6c36ca9c5889fb2672e4f95b
+size 248943
diff --git a/83/replication_package/data/county_distance_trlinesHv.dta b/83/replication_package/data/county_distance_trlinesHv.dta
new file mode 100644
index 0000000000000000000000000000000000000000..ffa4dfbb854e1d81ff7e306152730e31c8850800
--- /dev/null
+++ b/83/replication_package/data/county_distance_trlinesHv.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4c78a9fbeb5894205b9e01d29730de246010842559e03973457c1323040df538
+size 129197
diff --git a/83/replication_package/data/county_latlon_landarea.csv b/83/replication_package/data/county_latlon_landarea.csv
new file mode 100644
index 0000000000000000000000000000000000000000..0c682321991efedf9ea8cf95e86aedb9aba6ea2c
--- /dev/null
+++ b/83/replication_package/data/county_latlon_landarea.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d4ecc5c76658ce37ad74117e23072333fc9866caeb38cdec38b3f45b0b3bc5a9
+size 150869
diff --git a/83/replication_package/data/county_latlon_landarea.dta b/83/replication_package/data/county_latlon_landarea.dta
new file mode 100644
index 0000000000000000000000000000000000000000..3ca160ee1b69a00ebeaf0e089b5efc6d1d03cc7e
--- /dev/null
+++ b/83/replication_package/data/county_latlon_landarea.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:53548ed5b29e6b796d24484d27adb0dc98da93beecca841d5108ff5a8ebc5c92
+size 142328
diff --git a/83/replication_package/data/deflator.xls b/83/replication_package/data/deflator.xls
new file mode 100644
index 0000000000000000000000000000000000000000..897c945757cf693f3943f13c1005fb4a07e36d05
--- /dev/null
+++ b/83/replication_package/data/deflator.xls
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c6a3cb121cfaf0c33b9afab0c62663f0cf303bdee1371bab8f87f3cdaba4afcf
+size 10240
diff --git a/83/replication_package/data/deflator_historical.xls b/83/replication_package/data/deflator_historical.xls
new file mode 100644
index 0000000000000000000000000000000000000000..dde6e248ce299f05883fd8e5c05ce140b56f9998
--- /dev/null
+++ b/83/replication_package/data/deflator_historical.xls
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:85814fed33c0646876ccc7d66161147a9f6ee2907d8ef4917c6eaf3916a1fefc
+size 34816
diff --git a/83/replication_package/data/egrid2007_generators.csv b/83/replication_package/data/egrid2007_generators.csv
new file mode 100644
index 0000000000000000000000000000000000000000..1cfcbfc1de342bf8ae467bcc165ae3d3b761f202
--- /dev/null
+++ b/83/replication_package/data/egrid2007_generators.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:376fdf72643e8e965dd80e47d158fa0c35b964a403494911db99be02d7fa748a
+size 1106343
diff --git a/83/replication_package/data/egrid2007_generators.dta b/83/replication_package/data/egrid2007_generators.dta
new file mode 100644
index 0000000000000000000000000000000000000000..e5316fc960986ea458beddc6e7ec528da43d8237
--- /dev/null
+++ b/83/replication_package/data/egrid2007_generators.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:7239ee7b9e967eb2a45d98f066204f40e107cbb6648e77a566c6901c2220f607
+size 1510028
diff --git a/83/replication_package/data/egrid2007_plants_counties.csv b/83/replication_package/data/egrid2007_plants_counties.csv
new file mode 100644
index 0000000000000000000000000000000000000000..ee9344bfbb8f08681b881f963248f8db70cdf00d
--- /dev/null
+++ b/83/replication_package/data/egrid2007_plants_counties.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c42d54a8f19fb3a35cbb21c03dfeb72dd6797ac4e95832fa7ea969fb8beae4f9
+size 155481
diff --git a/83/replication_package/data/egrid2007_plants_counties.dta b/83/replication_package/data/egrid2007_plants_counties.dta
new file mode 100644
index 0000000000000000000000000000000000000000..40d4e9975e6cac2fce9c13201128e7b8e14b8e9d
--- /dev/null
+++ b/83/replication_package/data/egrid2007_plants_counties.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5b919256a722191ba00defcc2b67bfe8600dfed81d02435fc8bf867ece7cb1db
+size 82027
diff --git a/83/replication_package/data/egrid_dams_sample.xlsx b/83/replication_package/data/egrid_dams_sample.xlsx
new file mode 100644
index 0000000000000000000000000000000000000000..f2a9091ba95c843ae9539f01c8ca1ff1b41d0429
--- /dev/null
+++ b/83/replication_package/data/egrid_dams_sample.xlsx
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:17e29b550b897378b558fab1db1258e738409fb5f16732b0cd67c3cc35c8c624
+size 30566
diff --git a/83/replication_package/data/eletricity_generation_usa.csv b/83/replication_package/data/eletricity_generation_usa.csv
new file mode 100644
index 0000000000000000000000000000000000000000..fbf07292c34bc5f07315c9fefe3a6bd341c27b71
--- /dev/null
+++ b/83/replication_package/data/eletricity_generation_usa.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:cf7c5cda5986f1699aafad90a97a3f7e5f97b840ea636341023fe408f5cbef3c
+size 3036
diff --git a/83/replication_package/data/eletricity_generation_usa.dta b/83/replication_package/data/eletricity_generation_usa.dta
new file mode 100644
index 0000000000000000000000000000000000000000..7c1e96109f91c265feabff6b667153748616c1d1
--- /dev/null
+++ b/83/replication_package/data/eletricity_generation_usa.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:656a86acb25256c81bcc24bf93d4f8b72f5ba3a29339e6cdc33eaeda8c610833
+size 4516
diff --git a/83/replication_package/data/emp_c1990.csv b/83/replication_package/data/emp_c1990.csv
new file mode 100644
index 0000000000000000000000000000000000000000..9365af402d07f893c4ebe25d42c13b70bd8c2fd9
--- /dev/null
+++ b/83/replication_package/data/emp_c1990.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c83650d10fe848da879709fc67aa5e4a14dcebbeaa85f6e9dbbb485fa9024303
+size 2809946
diff --git a/83/replication_package/data/emp_c1990.dta b/83/replication_package/data/emp_c1990.dta
new file mode 100644
index 0000000000000000000000000000000000000000..7505833e6c1deaa9bffc1919c6edbc962ad7ccad
--- /dev/null
+++ b/83/replication_package/data/emp_c1990.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:452ff873795d2e3d2e1e9b93c1df721ba61a5f14d5e33f91ad2ac07fd2d73333
+size 2656348
diff --git a/83/replication_package/data/highways_data_Michaels_REStat_2008.csv b/83/replication_package/data/highways_data_Michaels_REStat_2008.csv
new file mode 100644
index 0000000000000000000000000000000000000000..7991381a3e0f338dd61fe7aa9ab79bc1eee6c1a4
--- /dev/null
+++ b/83/replication_package/data/highways_data_Michaels_REStat_2008.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:865020ceec903e244bb4b4cc2a80c03ea4a973e20e09c9f5466fe2b14c0eec79
+size 83573
diff --git a/83/replication_package/data/highways_data_Michaels_REStat_2008.dta b/83/replication_package/data/highways_data_Michaels_REStat_2008.dta
new file mode 100644
index 0000000000000000000000000000000000000000..cd9e0e98621178c2daca455a5b93c32b1182bc40
--- /dev/null
+++ b/83/replication_package/data/highways_data_Michaels_REStat_2008.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:9ccbb7f6bb02149489d0c769f2f785e4bb59a7beb1159514061e0029c53742d3
+size 68082
diff --git a/83/replication_package/data/hydropot_1931.csv b/83/replication_package/data/hydropot_1931.csv
new file mode 100644
index 0000000000000000000000000000000000000000..0d2ce616d8f3d5012be92681d3fb96f35b7da4de
--- /dev/null
+++ b/83/replication_package/data/hydropot_1931.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:568bb2ee3cbf562ddc56b63d317e27b1a9a6ddabbeca6101b58a4b25c1a8bcee
+size 1206
diff --git a/83/replication_package/data/hydropot_1931.dta b/83/replication_package/data/hydropot_1931.dta
new file mode 100644
index 0000000000000000000000000000000000000000..5241310bd81d16746c27606a7598109f05ccef49
--- /dev/null
+++ b/83/replication_package/data/hydropot_1931.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:01687405ae402bbb2f1f27cb7e07cf090e66a732f243203a99d22472c086fe13
+size 5372
diff --git a/83/replication_package/data/ihred-29apr03.dta b/83/replication_package/data/ihred-29apr03.dta
new file mode 100644
index 0000000000000000000000000000000000000000..55f6ad3d1fa8f3b5e679fb1183c53a7527ab9b62
--- /dev/null
+++ b/83/replication_package/data/ihred-29apr03.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ffee86ae23174fd0e84a4c1e370905fd19e8474ebfdc17a3b21a43853b691518
+size 635080
diff --git a/83/replication_package/data/ihred-29apr03.dta.csv b/83/replication_package/data/ihred-29apr03.dta.csv
new file mode 100644
index 0000000000000000000000000000000000000000..336639403f217c03213031433220c3c01feebd38
--- /dev/null
+++ b/83/replication_package/data/ihred-29apr03.dta.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d15ebf2b1891f4a008786f477f5fc10d753b64790094340f857438affa20d192
+size 568165
diff --git a/83/replication_package/data/ihred-29apr03.xls b/83/replication_package/data/ihred-29apr03.xls
new file mode 100644
index 0000000000000000000000000000000000000000..73d451739f4105c028800c4c24cf03935e956ffe
--- /dev/null
+++ b/83/replication_package/data/ihred-29apr03.xls
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a38ace42667a4e208bcadf061f4293748a56f6f247ad66dc505c7e3455694436
+size 4284928
diff --git a/83/replication_package/data/inl_all_states.csv b/83/replication_package/data/inl_all_states.csv
new file mode 100644
index 0000000000000000000000000000000000000000..f15ca63326c069979bf21742faf8af6f2e0e7030
--- /dev/null
+++ b/83/replication_package/data/inl_all_states.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:2ed02b2d3b1731b8ddaa202de554f919bc2b04865c702cb8ed55be636a2127c8
+size 1503736
diff --git a/83/replication_package/data/inl_all_states.dta b/83/replication_package/data/inl_all_states.dta
new file mode 100644
index 0000000000000000000000000000000000000000..a5241a2050c8a09bd3fa77d89ca8a5146c4f2a62
--- /dev/null
+++ b/83/replication_package/data/inl_all_states.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4293e53d7cddf7050bec070fd36de6c2602783968cc7e9b31f49bccdf0370755
+size 2513863
diff --git a/83/replication_package/data/installed_capacity_usa.csv b/83/replication_package/data/installed_capacity_usa.csv
new file mode 100644
index 0000000000000000000000000000000000000000..2c9e98f97201eb7c1ce13f0dca7a55d254a7da0f
--- /dev/null
+++ b/83/replication_package/data/installed_capacity_usa.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b04427e9c7bafcf17bc42ea66bf45ad4354e18fef9fc1f28e697855dd47d95ff
+size 2877
diff --git a/83/replication_package/data/installed_capacity_usa.dta b/83/replication_package/data/installed_capacity_usa.dta
new file mode 100644
index 0000000000000000000000000000000000000000..4023b78a84abf31911eb96633646d45a9a3b3d0c
--- /dev/null
+++ b/83/replication_package/data/installed_capacity_usa.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:fb923066b5985d6c7f85e728c72996d2031cc2c148d55b8bf8ba8a23f419481a
+size 4516
diff --git a/83/replication_package/data/market_access.csv b/83/replication_package/data/market_access.csv
new file mode 100644
index 0000000000000000000000000000000000000000..0266404ff35169ce789f09835fe9299288556d98
--- /dev/null
+++ b/83/replication_package/data/market_access.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:578c83010b77ea22ec562bd91bdbf1a2a41d6e3586480792f6afc49c55c451a3
+size 153474
diff --git a/83/replication_package/data/market_access.dta b/83/replication_package/data/market_access.dta
new file mode 100644
index 0000000000000000000000000000000000000000..cf45f8e206f148943e4124d8eb5e284895bafbd3
--- /dev/null
+++ b/83/replication_package/data/market_access.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5b916cc99028589a858fc500aea3f402ed30a7db1fcc61d8f818d98eca1d8c9f
+size 90430
diff --git a/83/replication_package/data/nearmsa_edson_1930.csv b/83/replication_package/data/nearmsa_edson_1930.csv
new file mode 100644
index 0000000000000000000000000000000000000000..663ccae8d6f5f064508151f7c53c46c9bf5d65a6
--- /dev/null
+++ b/83/replication_package/data/nearmsa_edson_1930.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:bdd6c8ec111fc8ffe01a979b379d5f43b403033b1be4cdc3a84ce4468d78b38c
+size 189246
diff --git a/83/replication_package/data/nearmsa_edson_1930.dta b/83/replication_package/data/nearmsa_edson_1930.dta
new file mode 100644
index 0000000000000000000000000000000000000000..761dd0680e6b2bdbc80c0366e5e119dc6e369d76
--- /dev/null
+++ b/83/replication_package/data/nearmsa_edson_1930.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:19ce9291ce78fe139766e2eccb2fdd23e4463d1edade1700071d6689cd47faaa
+size 230382
diff --git a/83/replication_package/data/pop_c1990.csv b/83/replication_package/data/pop_c1990.csv
new file mode 100644
index 0000000000000000000000000000000000000000..2a2cacc146622b172dc31e17978214b514fd2f47
--- /dev/null
+++ b/83/replication_package/data/pop_c1990.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c87c3dd90f8a5f744a40316bc17bcf40b21a64b0d7636f1746a3ffae1029834b
+size 1820816
diff --git a/83/replication_package/data/pop_c1990.dta b/83/replication_package/data/pop_c1990.dta
new file mode 100644
index 0000000000000000000000000000000000000000..6a3d151c5966ee4bf1f77c36cfceb7c5b87cbbe6
--- /dev/null
+++ b/83/replication_package/data/pop_c1990.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:37841970a3ea4b12a0d5e47e8cbd562a8b61f476a6ea355f26874e2fc81c9c09
+size 1727625
diff --git a/83/replication_package/data/sample_1870.csv b/83/replication_package/data/sample_1870.csv
new file mode 100644
index 0000000000000000000000000000000000000000..e951bc4bd5b1e712ba908b002c74acaa4411675e
--- /dev/null
+++ b/83/replication_package/data/sample_1870.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d00a7778856df46d7edb3aa1cc5ab2f8fbf3a014c13dd0232c5baef742cbe34a
+size 794562
diff --git a/83/replication_package/data/sample_1870.dta b/83/replication_package/data/sample_1870.dta
new file mode 100644
index 0000000000000000000000000000000000000000..79c5442a20223e310a6591272e330cca5d55624f
--- /dev/null
+++ b/83/replication_package/data/sample_1870.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c723f07887b2f9f1b12bcb631fe8585deed1441bbf051011ad259eba32f2bba1
+size 536791
diff --git a/83/replication_package/data/sample_308series_costdev_1870.csv b/83/replication_package/data/sample_308series_costdev_1870.csv
new file mode 100644
index 0000000000000000000000000000000000000000..b8fc1b15e1ed0ac9ed8ec74727db59ac193786c6
--- /dev/null
+++ b/83/replication_package/data/sample_308series_costdev_1870.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:469393a7d45191970090d1612129db8ab3cb60d2b03f18c53bb5a17bf79371e2
+size 282281
diff --git a/83/replication_package/data/sample_308series_costdev_1870.dta b/83/replication_package/data/sample_308series_costdev_1870.dta
new file mode 100644
index 0000000000000000000000000000000000000000..f364f2a74fa0a4289efedfdd40aa3a6421fc6fdf
--- /dev/null
+++ b/83/replication_package/data/sample_308series_costdev_1870.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f530ac4dd1d5d03b2dcd3ce54182ee5a98610c831c0dfb834b0abe606f2136c6
+size 227319
diff --git a/83/replication_package/data/sample_unbalanced_1870.csv b/83/replication_package/data/sample_unbalanced_1870.csv
new file mode 100644
index 0000000000000000000000000000000000000000..8e2060b9153e79c8e54bf1280ea93ab2ebfd180e
--- /dev/null
+++ b/83/replication_package/data/sample_unbalanced_1870.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ba6c75ecd08c9b2fd744b77e9cb68bddca17bb3434969a692628a41d82486325
+size 899709
diff --git a/83/replication_package/data/sample_unbalanced_1870.dta b/83/replication_package/data/sample_unbalanced_1870.dta
new file mode 100644
index 0000000000000000000000000000000000000000..13e93bf2cd8556d4f8e62ac29e2caa3c6ea6aa0a
--- /dev/null
+++ b/83/replication_package/data/sample_unbalanced_1870.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:62189738df936f9fca5bd73b8e7a1ec2fc1039f5769efa14470c8c0cdf4cc0ab
+size 598330
diff --git a/83/replication_package/data/tl_2010_us_county00.csv b/83/replication_package/data/tl_2010_us_county00.csv
new file mode 100644
index 0000000000000000000000000000000000000000..516fe3b2ed587635596f514ccbc580fa0dbf8a12
--- /dev/null
+++ b/83/replication_package/data/tl_2010_us_county00.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d5bc48693606ef9b65c6761239cc40b79ca849d8e781c6e419ab222e7dc71878
+size 311734
diff --git a/83/replication_package/data/tl_2010_us_county00.dta b/83/replication_package/data/tl_2010_us_county00.dta
new file mode 100644
index 0000000000000000000000000000000000000000..ab68ea41d09ff8ad7cbce41800d0e6c9d7e1fb0e
--- /dev/null
+++ b/83/replication_package/data/tl_2010_us_county00.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:1d96b3eb36675168df3a00d7d25715a70b93977adc76b364193252e6a442f909
+size 434248
diff --git a/83/replication_package/data/tva.csv b/83/replication_package/data/tva.csv
new file mode 100644
index 0000000000000000000000000000000000000000..eeb49e9f73228338f67acfc2d6cd866ec3e73f3b
--- /dev/null
+++ b/83/replication_package/data/tva.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:3dd22d0169c5fbd74a98a6cef740f88a8d2a44c5179ec0f54c4b36d4ba793c52
+size 1568
diff --git a/83/replication_package/data/tva.dta b/83/replication_package/data/tva.dta
new file mode 100644
index 0000000000000000000000000000000000000000..e5c63e6a2f3e6a79978dfe6b1426b15d4bf4ca4e
--- /dev/null
+++ b/83/replication_package/data/tva.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ccf59928c32a8593230f1db7d876da96144c6821dfbc411190188ed313cdbfa7
+size 1420
diff --git a/83/replication_package/data/uscoord1990.csv b/83/replication_package/data/uscoord1990.csv
new file mode 100644
index 0000000000000000000000000000000000000000..0e981f9e6ce368d29d91faaa4517d4070f34fbcf
--- /dev/null
+++ b/83/replication_package/data/uscoord1990.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:de97e9faa139f215248d2857bcdca7dc7ea5ac390b37e7dca0b357a57279f401
+size 202660019
diff --git a/83/replication_package/data/uscoord1990.dta b/83/replication_package/data/uscoord1990.dta
new file mode 100644
index 0000000000000000000000000000000000000000..ebf8eba41c2029c635f3e6c5cb7b3f6e2d2eca37
--- /dev/null
+++ b/83/replication_package/data/uscoord1990.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:8c617aa944e9470577a1657d4f21ee3e2fda16da6f7c8c851e70c212cb0703d6
+size 88833393
diff --git a/83/replication_package/data/usdb1990_continental.csv b/83/replication_package/data/usdb1990_continental.csv
new file mode 100644
index 0000000000000000000000000000000000000000..b38f79b7e4d63c758c1f93c2cf8b582f4c632a89
--- /dev/null
+++ b/83/replication_package/data/usdb1990_continental.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:bac0033e978284b5bdcb8649c3f388a7065d48ed5bfa19900b5792b8b104c924
+size 499851
diff --git a/83/replication_package/data/usdb1990_continental.dta b/83/replication_package/data/usdb1990_continental.dta
new file mode 100644
index 0000000000000000000000000000000000000000..8153905683cf5bfcd24ad3fa5ddd415d53a899df
--- /dev/null
+++ b/83/replication_package/data/usdb1990_continental.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4474c3d452c85446249156b6a86ebceed3a338f6a624dbaa512691d32ca6991c
+size 514912
diff --git a/83/replication_package/dofiles/Dams_Codes_Analysis.do b/83/replication_package/dofiles/Dams_Codes_Analysis.do
new file mode 100644
index 0000000000000000000000000000000000000000..daa0884e39db699d1ee2f6088a5abd718da7dbf7
--- /dev/null
+++ b/83/replication_package/dofiles/Dams_Codes_Analysis.do
@@ -0,0 +1,5909 @@
+clear all
+set more off
+set matsize 10000
+set maxvar 10000
+update all
+
+cd "/Users/edson/Dropbox/Job_Market_Paper/Dams_Codes_Data"
+*When running these codes, please change the directory to
+*whatever folder the data and codes have been saved.
+*Also, create four subfolders within the main folder:
+*"data," "dofiles," "logfiles," and "graphs" –
+*this is crucial to run the codes smoothly.
+*Make sure all the .dta datasets are saved in the
+*subfolder "data," and the dofile is saved in the
+*subfolder "dofiles." The output will be saved in
+*the subfolder "logfiles," and the figures in the
+*subfolder "graphs." Finally, create a subfolder
+*in the “data” subfolder named “parmest,” and a
+*subfolder in the “graphs” subfolder named “data.”
+
+*Before running the analysis, install the following
+*user-generated codes:
+ssc install did_multiplegt
+ssc install oaxaca
+ssc install outreg2
+ssc install parmest
+ssc install regaxis
+ssc install spmap
+ssc install synth
+ssc install twowayfeweights
+*if any other commands are not recognized, please
+*install them by running "ssc install ..."
+
+
+capture log close
+log using logfiles/Dams_analysis_logfile.log, replace
+
+
+********************************************************************************
+********************************************************************************
+***FIGURE 1
+********************************************************************************
+********************************************************************************
+clear all
+use data/installed_capacity_usa.dta, clear
+*data digitized from "Historical Statistics of the Electric Utility
+*Industry through 1992," edited by Lizette Cintron, 1995
+
+gen ffuel = conv_steam + int_comb
+ren nuc_steam nuclear
+gen other_fuel = wind + solar
+ren total elec_ind
+
+drop conv_steam int_comb wind solar
+
+label var hydro "Hydro"
+label var ffuel "Fossil Fuel"
+label var nuclear "Nuclear"
+label var other_fuel "Others"
+
+order year elec_ind hydro ffuel nuclear other_fuel
+
+foreach var in hydro ffuel nuclear other_fuel {
+ gen p`var' = (`var'/elec_ind)*100
+}
+
+label var phydro "Hydro"
+label var pffuel "Fossil Fuel"
+label var pnuclear "Nuclear"
+label var pother_fuel "Others"
+
+foreach var in elec_ind hydro ffuel nuclear other_fuel {
+ replace `var' = `var'/1000
+}
+*Now, these variables are expressed in thousands of megawatts (1,000 MW).
+
+keep if year<=1992
+regaxis year, cycle(10) ltick(year)
+
+****************************************
+***PANEL A
+****************************************
+twoway (line hydro year, lcolor(black) lwidth(medthick) lpattern(solid)) /*
+*/ (line ffuel year, lcolor(black) lwidth(medthick) lpattern(dash)) /*
+*/ (line nuclear year, lcolor(black) lwidth(medthick) lpattern(dot)) /*
+*/ (line other_fuel year, lcolor(black) lwidth(medthick) lpattern(dash_dot_dot)), /*
+*/ ytitle("") xtitle("") title(Panel A. Installed Capacity (1000 Megawatts)) /*
+*/ xline(1950, lwidth(medium) lpattern(dash) lcolor(black)) xlabel(`year') /*
+*/ legend(on order(1 "Hydro" 2 "Fossil Fuel" /*
+*/ 3 "Nuclear" 4 "Others") rows(1)) /*
+*/ saving(graphs/Fig_1a.gph, replace)
+
+****************************************
+***PANEL B
+****************************************
+twoway (line phydro year, lcolor(black) lwidth(medthick) lpattern(solid)) /*
+*/ (line pffuel year, lcolor(black) lwidth(medthick) lpattern(dash)) /*
+*/ (line pnuclear year, lcolor(black) lwidth(medthick) lpattern(dot)) /*
+*/ (line pother_fuel year, lcolor(black) lwidth(medthick) lpattern(dash_dot_dot)), /*
+*/ ytitle("") xtitle("") title(Panel B. Percentages) /*
+*/ xline(1950, lwidth(medium) lpattern(dash) lcolor(black)) xlabel(`year') /*
+*/ legend(on order(1 "Hydro" 2 "Fossil Fuel" /*
+*/ 3 "Nuclear" 4 "Others") rows(1)) /*
+*/ saving(graphs/Fig_1b.gph, replace)
+
+
+
+clear all
+use data/eletricity_generation_usa.dta, clear
+*data digitized from "Historical Statistics of the Electric Utility
+*Industry through 1992," edited by Lizette Cintron, 1995
+
+gen ffuel = conv_steam + int_comb
+ren nuc_steam nuclear
+gen other_fuel = wind + solar
+ren total elec_ind
+
+drop conv_steam int_comb wind solar
+
+label var hydro "Hydro"
+label var ffuel "Fossil Fuel"
+label var nuclear "Nuclear"
+label var other_fuel "Others"
+
+order year elec_ind hydro ffuel nuclear other_fuel
+
+foreach var in hydro ffuel nuclear other_fuel {
+ gen p`var' = (`var'/elec_ind)*100
+}
+
+label var phydro "Hydro"
+label var pffuel "Fossil Fuel"
+label var pnuclear "Nuclear"
+label var pother_fuel "Others"
+
+foreach var in elec_ind hydro ffuel nuclear other_fuel {
+ replace `var' = `var'/1000
+}
+*Now, these variables are expressed in 1,000MWh.
+
+keep if year<=1992
+regaxis year, cycle(10) ltick(year)
+
+****************************************
+***PANEL C
+****************************************
+twoway (line hydro year, lcolor(black) lwidth(medthick) lpattern(solid)) /*
+*/ (line ffuel year, lcolor(black) lwidth(medthick) lpattern(dash)) /*
+*/ (line nuclear year, lcolor(black) lwidth(medthick) lpattern(dot)) /*
+*/ (line other_fuel year, lcolor(black) lwidth(medthick) lpattern(dash_dot_dot)), /*
+*/ ytitle("") xtitle("") title(Panel C. Electricity Generation (1000 Megawatt Hours)) /*
+*/ xline(1950, lwidth(medium) lpattern(dash) lcolor(black)) xlabel(`year') /*
+*/ legend(on order(1 "Hydro" 2 "Fossil Fuel" /*
+*/ 3 "Nuclear" 4 "Others") rows(1)) /*
+*/ saving(graphs/Fig_1c.gph, replace)
+
+****************************************
+***PANEL D
+****************************************
+twoway (line phydro year, lcolor(black) lwidth(medthick) lpattern(solid)) /*
+*/ (line pffuel year, lcolor(black) lwidth(medthick) lpattern(dash)) /*
+*/ (line pnuclear year, lcolor(black) lwidth(medthick) lpattern(dot)) /*
+*/ (line pother_fuel year, lcolor(black) lwidth(medthick) lpattern(dash_dot_dot)), /*
+*/ ytitle("") xtitle("") title(Panel D. Percentages) /*
+*/ xline(1950, lwidth(medium) lpattern(dash) lcolor(black)) xlabel(`year') /*
+*/ legend(on order(1 "Hydro" 2 "Fossil Fuel" /*
+*/ 3 "Nuclear" 4 "Others") rows(1)) /*
+*/ saving(graphs/Fig_1d.gph, replace)
+
+
+****************************************
+***COMBINING PANELS
+****************************************
+graph combine /*
+*/ graphs/Fig_1a.gph /*
+*/ graphs/Fig_1b.gph /*
+*/ graphs/Fig_1c.gph /*
+*/ graphs/Fig_1d.gph, /*
+*/ xsize(10) ysize(7) scale(0.7) /*
+*/ saving(graphs/Fig_1.gph, replace)
+
+graph export graphs/Fig_1.pdf, replace
+
+erase graphs/Fig_1a.gph
+erase graphs/Fig_1b.gph
+erase graphs/Fig_1c.gph
+erase graphs/Fig_1d.gph
+
+
+********************************************************************************
+********************************************************************************
+***FIGURE 2
+********************************************************************************
+********************************************************************************
+
+*this figure was created in power point, which I'm sending attached
+
+
+********************************************************************************
+********************************************************************************
+***FIGURE 3
+********************************************************************************
+********************************************************************************
+clear all
+use data/sample_1870.dta, clear
+
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_b1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+drop _I*
+gen sample_b1950 = e(sample)
+
+
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_a1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+drop _I*
+gen sample_a1950 = e(sample)
+
+gen sample = (sample_b1950==1 | sample_a1950==1)
+keep if sample==1
+
+capture drop n
+bysort county_fips: gen n=_n
+keep if n==1
+
+keep county_fips state_fips latc1 lonc1 treated_b1950 treated_a1950 falsetreat
+
+compress
+sort county_fips
+save data/treat_control_counties_1870.dta, replace
+
+
+clear
+use data/inl_all_states.dta, clear
+*this dataset refers to the 1998 U.S. Hydropower Resource Assessment was
+*prepared by the Idaho National Engineering and Environmental Laboratory (INL)
+*for the U.S. Department of Energy (DOE) -- see references in the paper
+*(Conner, Francfort, and Rinehart, 1998; INL, 1998)
+
+tab damstatus, m
+
+keep if nameplate>=100000
+
+keep state_fips county_fips fercnumber plantname nameplate damstatus lat lon
+
+replace lon = 8900 if lon==89
+gen lon_aux1 = lon/10000
+gen zero = 0
+
+tostring lat lon, replace
+
+egen lon_aux2 = concat(zero lon) if lon_aux1<1
+
+replace lon = lon_aux2 if lon_aux2~=""
+
+drop lon_aux1 lon_aux2 zero
+
+gen lat_degree = substr(lat,1,2)
+gen lat_min = substr(lat,3,4)
+
+gen lon_degree = substr(lon,1,3)
+gen lon_min = substr(lon,4,5)
+
+destring lat lon lat_degree lat_min lon_degree lon_min, replace
+
+foreach var in lat_degree lat_min lon_degree lon_min {
+ replace `var' = 0 if `var'==.
+}
+
+gen lat_dd = lat_degree + (lat_min/60)
+gen lon_dd = lon_degree + (lon_min/60)
+replace lon_dd = lon_dd*(-1)
+
+
+drop lat_degree lat lon lat_min lon_degree lon_min
+
+ren lat_dd latp
+ren lon_dd lonp
+
+sort county_fips
+merge m:1 county_fips using data/treat_control_counties_1870.dta
+
+tab damstatus if falsetreat==1, m
+keep if falsetreat==1
+
+tab _merge, m
+
+drop _merge treated_b1950 treated_a1950 falsetreat
+
+ren latc1 latc
+ren lonc1 lonc
+
+replace lonc = lonc*(-1)
+
+gen lat = latp if (latp~=0 & latp~=.)
+replace lat = latc if (latp==0 | latp==.)
+
+gen lon = lonp if (lonp~=0 & lonp~=.)
+replace lon = lonc if (lonp==0 | lonp==.)
+
+ren fercnumber idplant
+
+compress
+sort county_fips idplant
+save data/lat_lon_plants_control_1870.dta, replace
+
+
+clear
+use data/egrid2007_generators.dta, clear
+*data source: Emissions & Generation Resource Integrated Database (eGRID)
+*available for download at: https://www.epa.gov/egrid/download-data
+*I've used the 2007 data on generators and plants from the eGRID 2010 dataset
+
+keep if fuelg1=="WAT"
+drop if prmvr=="PS"
+
+sort orispl
+merge m:1 orispl using data/egrid2007_plants_counties.dta
+keep if _merge==3
+drop _merge
+
+bysort county_fips orispl: egen np_plant = sum(namepcap)
+keep if np_plant>=100
+
+capture drop n
+bysort county_fips orispl: gen n = _n
+keep if n==1
+
+gen state_fips = int(county_fips/1000)
+
+keep state_fips county_fips orispl pname np_plant latp lonp
+
+sort county_fips
+merge m:1 county_fips using data/treat_control_counties_1870.dta
+
+keep if (treated_b1950==1 | treated_a1950==1)
+
+tab _merge, m
+drop _merge falsetreat
+
+ren latc1 latc
+ren lonc1 lonc
+
+gen lat = latp if (latp~=0 & latp~=.)
+replace lat = latc if (latp==0 | latp==.)
+
+gen lon = lonp if (lonp~=0 & lonp~=.)
+replace lon = lonc if (lonp==0 | lonp==.)
+
+ren orispl idplant
+tostring idplant, replace
+
+order state_fips county_fips idplant pname np_plant latp lonp latc lonc lat lon
+
+compress
+sort county_fips idplant
+save data/lat_lon_plants_treat_1870.dta, replace
+
+
+clear
+use data/lat_lon_plants_control_1870.dta, clear
+
+append using data/lat_lon_plants_treat_1870.dta
+
+replace plantname = pname if plantname==""
+replace np_plant = (nameplate/1000) if np_plant==.
+
+gen treatcontrol = 3 if treated_b1950==1
+replace treatcontrol = 2 if treated_a1950==1
+replace treatcontrol = 1 if treatcontrol==.
+
+drop nameplate pname treated_b1950 treated_a1950
+
+order state_fips county_fips idplant plantname np_plant damstatus treatcontrol
+
+compress
+sort state_fips county_fips idplant
+sort state_fips
+save data/lat_lon_plants_1870.dta, replace
+
+
+clear
+use data/counties_largeplants100mw.dta, clear
+
+sort county_fips
+merge m:1 county_fips using data/treat_control_counties_1870.dta
+keep if _merge==3
+drop _merge
+
+capture drop n
+bysort county_fips: gen n = _n
+keep if n==1
+
+gen treatcontrol = 3 if treated_b1950==1
+replace treatcontrol = 2 if treated_a1950==1
+replace treatcontrol = 1 if treatcontrol==.
+
+drop np_county_year_aux np_county_year sample_aux treated_b1950 treated_a1950 falsetreat n
+
+order state_fips county_fips year year_treat treatcontrol np_county np_hpot np_pot
+
+ren latc1 latc
+ren lonc1 lonc
+
+compress
+sort county_fips year
+sort county_fips
+save data/lat_lon_counties_1870.dta, replace
+
+
+clear
+use data/lat_lon_counties_1870.dta, clear
+
+sort county_fips
+merge 1:m county_fips using data/usdb1990_continental.dta
+drop _merge
+*usdb1990_continental.dta: this dataset comes from NHGIS county shapefiles
+
+replace treatcontrol = 0 if treatcontrol==.
+
+label define treatcontrol 0 "Not in sample" 1 "Control" /*
+*/ 2 "Treated After 1950" 3 "Treated Before 1950"
+
+label values treatcontrol treatcontrol
+
+sort id
+
+spmap treatcontrol using data/uscoord1990.dta, id(id) /*
+*/ clmethod(unique) fcolor(white yellow red blue) legend(region(lcolor(black))) /*
+*/ osize(vthin) ocolor(gray) /*
+*/ saving(graphs/Fig_3.gph, replace)
+*uscoord1990.dta: this dataset comes from NHGIS county shapefiles
+
+graph export graphs/Fig_3.pdf, replace
+
+
+********************************************************************************
+********************************************************************************
+***FIGURE 4
+********************************************************************************
+********************************************************************************
+clear all
+use data/sample_1870.dta, clear
+
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_b1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TC_b1950_1870.dta, replace)
+
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ keep(evtime100b-evtime20b evtime0-evtime80a) /*
+*/ ctitle(ATC1_c1) nocons se bdec(4) sdec(4) rdec(4) excel replace
+
+
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_a1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TC_a1950_1870.dta, replace)
+
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ keep(evtime100b-evtime20b evtime0-evtime80a) /*
+*/ ctitle(ATC1_c2) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+
+
+clear all
+foreach var in TC_b1950 TC_a1950 {
+
+clear
+use data/parmest/`var'_1870.dta, clear
+
+gen evtime = -100 if parm=="evtime100b"
+replace evtime = -90 if parm=="evtime90b"
+replace evtime = -80 if parm=="evtime80b"
+replace evtime = -70 if parm=="evtime70b"
+replace evtime = -60 if parm=="evtime60b"
+replace evtime = -50 if parm=="evtime50b"
+replace evtime = -40 if parm=="evtime40b"
+replace evtime = -30 if parm=="evtime30b"
+replace evtime = -20 if parm=="evtime20b"
+replace evtime = 0 if parm=="evtime0"
+replace evtime = 10 if parm=="evtime10a"
+replace evtime = 20 if parm=="evtime20a"
+replace evtime = 30 if parm=="evtime30a"
+replace evtime = 40 if parm=="evtime40a"
+replace evtime = 50 if parm=="evtime50a"
+replace evtime = 60 if parm=="evtime60a"
+replace evtime = 70 if parm=="evtime70a"
+replace evtime = 80 if parm=="evtime80a"
+
+keep if evtime~=.
+
+local new = _N + 1
+set obs `new'
+
+ren estimate c`var'
+ren min95 l`var'
+ren max95 u`var'
+
+keep evtime c`var' l`var' u`var'
+order evtime c`var' l`var' u`var'
+
+replace evtime = -10 if evtime==.
+replace c`var' = 0 if c`var'==.
+replace l`var' = 0 if l`var'==.
+replace u`var' = 0 if u`var'==.
+
+compress
+sort evtime
+save graphs/data/`var'_1870.dta, replace
+}
+
+
+clear all
+use graphs/data/evtime_1870.dta, clear
+
+foreach var in TC_b1950 TC_a1950 {
+
+merge 1:1 evtime using graphs/data/`var'_1870.dta
+drop _merge
+sort evtime
+}
+
+compress
+sort evtime
+
+
+keep if (evtime>=-90 & evtime<=70)
+
+egen ymax_aux = rowmax(uTC_b1950 uTC_a1950)
+egen ymin_aux = rowmin(lTC_b1950 lTC_a1950)
+
+egen ymax = max(ymax_aux)
+egen ymin = min(ymin_aux)
+
+gen yscale = ymin if evtime<=0
+replace yscale = ymax if evtime>0
+
+drop ymax_aux-ymin
+
+regaxis evtime, cycle(10) ltick(evtime)
+regaxis yscale, cycle(0.2) ltick(yscale)
+
+sort evtime
+
+****************************************
+***PANEL A
+****************************************
+twoway /*
+*/ (rarea uTC_b1950 lTC_b1950 evtime if (evtime>=-60 & evtime<=70), sort fcolor(bluishgray) lcolor(bluishgray) lwidth(none)) /*
+*/ (connected cTC_b1950 evtime if (evtime>=-60 & evtime<=70), sort mcolor(black) msize(small) msymbol(circle) lcolor(black) lwidth(medium) lpattern(solid)), /*
+*/ ytitle(ln(PopDensity)) ylabel(-0.4(0.2)1.4, angle(horizontal)) /*
+*/ xtitle(Years Relative to Dam Completion) xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(-10, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(-60(10)70) /*
+*/ subtitle(Panel A. Pre-1950 Dams) /*
+*/ legend(off) /*
+*/ xsize(6.5) ysize(5) scale(0.9) /*
+*/ saving(graphs/Fig_4a.gph, replace)
+
+****************************************
+***PANEL B
+****************************************
+twoway /*
+*/ (rarea uTC_a1950 lTC_a1950 evtime if (evtime>=-90 & evtime<=50), sort fcolor(yellow) lcolor(yellow) lwidth(none)) /*
+*/ (connected cTC_a1950 evtime if (evtime>=-90 & evtime<=50), sort mcolor(black) msize(small) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(dash)), /*
+*/ ytitle(ln(PopDensity)) ylabel(-0.4(0.2)1.4, angle(horizontal)) /*
+*/ xtitle(Years Relative to Dam Completion) xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(-10, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(-90(10)50) /*
+*/ subtitle(Panel B. Post-1950 Dams) /*
+*/ legend(off) /*
+*/ xsize(6.5) ysize(5) scale(0.9) /*
+*/ saving(graphs/Fig_4b.gph, replace)
+
+****************************************
+***COMBINING PANELS
+****************************************
+graph combine graphs/Fig_4a.gph graphs/Fig_4b.gph, /*
+*/ xsize(10) ysize(5) scale(1.1) /*
+*/ saving(graphs/Fig_4.gph, replace)
+
+graph export graphs/Fig_4.pdf, replace
+
+erase graphs/Fig_4a.gph
+erase graphs/Fig_4b.gph
+
+
+********************************************************************************
+********************************************************************************
+***FIGURE 5
+********************************************************************************
+********************************************************************************
+clear all
+foreach var in TC_b1950 TC_a1950 {
+
+clear
+use data/parmest/`var'_1870.dta, clear
+
+gen evtime = -100 if parm=="evtime100b"
+replace evtime = -90 if parm=="evtime90b"
+replace evtime = -80 if parm=="evtime80b"
+replace evtime = -70 if parm=="evtime70b"
+replace evtime = -60 if parm=="evtime60b"
+replace evtime = -50 if parm=="evtime50b"
+replace evtime = -40 if parm=="evtime40b"
+replace evtime = -30 if parm=="evtime30b"
+replace evtime = -20 if parm=="evtime20b"
+replace evtime = 0 if parm=="evtime0"
+replace evtime = 10 if parm=="evtime10a"
+replace evtime = 20 if parm=="evtime20a"
+replace evtime = 30 if parm=="evtime30a"
+replace evtime = 40 if parm=="evtime40a"
+replace evtime = 50 if parm=="evtime50a"
+replace evtime = 60 if parm=="evtime60a"
+replace evtime = 70 if parm=="evtime70a"
+replace evtime = 80 if parm=="evtime80a"
+
+keep if evtime~=.
+
+local new = _N + 1
+set obs `new'
+
+ren estimate c`var'
+ren min95 l`var'
+ren max95 u`var'
+
+keep evtime c`var' l`var' u`var'
+order evtime c`var' l`var' u`var'
+
+replace evtime = -10 if evtime==.
+replace c`var' = 0 if c`var'==.
+replace l`var' = 0 if l`var'==.
+replace u`var' = 0 if u`var'==.
+
+compress
+sort evtime
+save graphs/data/`var'_1870.dta, replace
+}
+
+
+clear all
+use graphs/data/evtime_1870.dta, clear
+
+foreach var in TC_b1950 TC_a1950 {
+
+merge 1:1 evtime using graphs/data/`var'_1870.dta
+drop _merge
+sort evtime
+}
+
+compress
+sort evtime
+
+
+
+keep if (evtime>=-60 & evtime<=50)
+
+egen ymax_aux = rowmax(cTC_b1950)
+egen ymin_aux = rowmin(cTC_b1950)
+
+egen ymax = max(ymax_aux)
+egen ymin = min(ymin_aux)
+
+gen yscale = ymin if evtime<=0
+replace yscale = ymax if evtime>0
+
+drop ymax_aux-ymin
+
+regaxis evtime, cycle(10) ltick(evtime)
+regaxis yscale, cycle(0.2) ltick(yscale)
+
+sort evtime
+
+****************************************
+***PANEL A
+****************************************
+twoway /*
+*/ (connected cTC_b1950 evtime, sort mcolor(black) msize(small) msymbol(circle) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected cTC_a1950 evtime, sort mcolor(black) msize(small) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(dash)), /*
+*/ ytitle(ln(density)) ylabel(`yscale', angle(horizontal)) /*
+*/ xtitle(Years Relative to Dam Completion) xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(-10, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(`evtime') /*
+*/ subtitle(Panel A. Main Estimates: Pre- and Post-1950 Dams) /*
+*/ legend(on order(1 "Pre-1950 Dams" 2 "Post-1950 Dams") cols(1) position(5) ring(0) size(small)) /*
+*/ xsize(7) ysize(5) scale(0.9) /*
+*/ saving(graphs/Fig_5a.gph, replace)
+
+****************************************
+***PANEL B
+****************************************
+gen dcTC = cTC_b1950 - cTC_a1950
+
+regaxis evtime, cycle(10) ltick(evtime)
+regaxis yscale, cycle(0.2) ltick(yscale)
+
+sort evtime
+
+twoway /*
+*/ (connected dcTC evtime, sort mcolor(black) msize(small) msymbol(triangle) lcolor(black) lwidth(medium) lpattern(solid)), /*
+*/ ytitle(ln(density)) ylabel(0(0.1)0.5, angle(horizontal)) /*
+*/ xtitle(Years Relative to Dam Completion) xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(-10, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(`evtime') /*
+*/ subtitle(Panel B. Difference: (Pre-1950 - Post-1950)) /*
+*/ xsize(7) ysize(5) scale(0.9) /*
+*/ saving(graphs/Fig_5b.gph, replace)
+
+****************************************
+***COMBINING PANELS
+****************************************
+graph combine graphs/Fig_5a.gph graphs/Fig_5b.gph, /*
+*/ xsize(7) ysize(10) scale(1) cols(1) /*
+*/ saving(graphs/Fig_5.gph, replace)
+
+graph export graphs/Fig_5.pdf, replace
+
+erase graphs/Fig_5a.gph
+erase graphs/Fig_5b.gph
+
+
+********************************************************************************
+********************************************************************************
+***FIGURE 6
+********************************************************************************
+********************************************************************************
+
+****************************************
+***PANEL A
+****************************************
+clear all
+use data/sample_1870.dta, clear
+
+*first two regressions are the same as in Figure 4
+
+drop if (treated_b1950==1 |treated_a1950==1) & tva==1
+
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_b1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TCnotva_b1950_1870.dta, replace)
+
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ keep(evtime100b-evtime20b evtime0-evtime80a) /*
+*/ ctitle(ATC2_c3) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_a1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TCnotva_a1950_1870.dta, replace)
+
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ keep(evtime100b-evtime20b evtime0-evtime80a) /*
+*/ ctitle(ATC2_c4) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+
+clear all
+foreach var in TC_b1950 TC_a1950 TCnotva_b1950 TCnotva_a1950 {
+
+clear
+use data/parmest/`var'_1870.dta, clear
+
+gen evtime = -100 if parm=="evtime100b"
+replace evtime = -90 if parm=="evtime90b"
+replace evtime = -80 if parm=="evtime80b"
+replace evtime = -70 if parm=="evtime70b"
+replace evtime = -60 if parm=="evtime60b"
+replace evtime = -50 if parm=="evtime50b"
+replace evtime = -40 if parm=="evtime40b"
+replace evtime = -30 if parm=="evtime30b"
+replace evtime = -20 if parm=="evtime20b"
+replace evtime = 0 if parm=="evtime0"
+replace evtime = 10 if parm=="evtime10a"
+replace evtime = 20 if parm=="evtime20a"
+replace evtime = 30 if parm=="evtime30a"
+replace evtime = 40 if parm=="evtime40a"
+replace evtime = 50 if parm=="evtime50a"
+replace evtime = 60 if parm=="evtime60a"
+replace evtime = 70 if parm=="evtime70a"
+replace evtime = 80 if parm=="evtime80a"
+
+keep if evtime~=.
+
+local new = _N + 1
+set obs `new'
+
+ren estimate c`var'
+ren min95 l`var'
+ren max95 u`var'
+
+keep evtime c`var' l`var' u`var'
+order evtime c`var' l`var' u`var'
+
+replace evtime = -10 if evtime==.
+replace c`var' = 0 if c`var'==.
+replace l`var' = 0 if l`var'==.
+replace u`var' = 0 if u`var'==.
+
+compress
+sort evtime
+save graphs/data/`var'_1870.dta, replace
+}
+
+
+clear all
+use graphs/data/evtime_1870.dta, clear
+
+foreach var in TC_b1950 TC_a1950 TCnotva_b1950 TCnotva_a1950 {
+
+merge 1:1 evtime using graphs/data/`var'_1870.dta
+drop _merge
+sort evtime
+}
+
+compress
+sort evtime
+
+
+
+keep if (evtime>=-60 & evtime<=50)
+*outside this interval, there's limited number of obs for non-tva counties
+
+egen ymax_aux = rowmax(cTC_b1950 cTCnotva_b1950 cTC_a1950 cTCnotva_a1950)
+egen ymin_aux = rowmin(cTC_b1950 cTCnotva_b1950 cTC_a1950 cTCnotva_a1950)
+
+egen ymax = max(ymax_aux)
+egen ymin = min(ymin_aux)
+
+gen yscale = ymin if evtime<=0
+replace yscale = ymax if evtime>0
+
+drop ymax_aux-ymin
+
+regaxis evtime, cycle(10) ltick(evtime)
+regaxis yscale, cycle(0.2) ltick(yscale)
+
+sort evtime
+
+
+twoway /*
+*/ (connected cTC_b1950 evtime, sort mcolor(black) msymbol(circle) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected cTC_a1950 evtime, sort mcolor(black) msymbol(circle_hollow) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected cTCnotva_b1950 evtime, sort mcolor(black) msymbol(square) lcolor(black) lwidth(medium) lpattern(dash)) /*
+*/ (connected cTCnotva_a1950 evtime, sort mcolor(black) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(dash)), /*
+*/ subtitle(Panel A. All vs. Non-TVA Hydroelectric Dams) /*
+*/ ytitle(ln(PopDensity)) ylabel(-0.2(0.2)0.8, angle(horizontal)) /*
+*/ xtitle(Years Relative to Dam Completion) xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(-10, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(`evtime') /*
+*/ legend(on order(1 "All: Pre-1950 Dams" 2 "All: Post-1950 Dams" /*
+*/ 3 "Non-TVA: Pre-1950 Dams" 4 "Non-TVA: Post-1950 Dams") cols(1) position(5) ring(0)) /*
+*/ xsize(6.5) ysize(5) scale(0.8) /*
+*/ saving(graphs/Fig_6a.gph, replace)
+
+
+****************************************
+***PANEL B
+****************************************
+clear all
+use data/sample_1870.dta, clear
+
+*first two regressions are the same as in Figure 4
+
+drop if (treated_b1950==1 |treated_a1950==1) & reg_fips==4
+
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_b1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TCnowest_b1950_1870.dta, replace)
+
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ keep(evtime100b-evtime20b evtime0-evtime80a) /*
+*/ ctitle(ATC3_c3) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_a1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TCnowest_a1950_1870.dta, replace)
+
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ keep(evtime100b-evtime20b evtime0-evtime80a) /*
+*/ ctitle(ATC3_c4) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+
+
+clear all
+foreach var in TC_b1950 TC_a1950 TCnowest_b1950 TCnowest_a1950 {
+
+clear
+use data/parmest/`var'_1870.dta, clear
+
+gen evtime = -100 if parm=="evtime100b"
+replace evtime = -90 if parm=="evtime90b"
+replace evtime = -80 if parm=="evtime80b"
+replace evtime = -70 if parm=="evtime70b"
+replace evtime = -60 if parm=="evtime60b"
+replace evtime = -50 if parm=="evtime50b"
+replace evtime = -40 if parm=="evtime40b"
+replace evtime = -30 if parm=="evtime30b"
+replace evtime = -20 if parm=="evtime20b"
+replace evtime = 0 if parm=="evtime0"
+replace evtime = 10 if parm=="evtime10a"
+replace evtime = 20 if parm=="evtime20a"
+replace evtime = 30 if parm=="evtime30a"
+replace evtime = 40 if parm=="evtime40a"
+replace evtime = 50 if parm=="evtime50a"
+replace evtime = 60 if parm=="evtime60a"
+replace evtime = 70 if parm=="evtime70a"
+replace evtime = 80 if parm=="evtime80a"
+
+keep if evtime~=.
+
+local new = _N + 1
+set obs `new'
+
+ren estimate c`var'
+ren min95 l`var'
+ren max95 u`var'
+
+keep evtime c`var' l`var' u`var'
+order evtime c`var' l`var' u`var'
+
+replace evtime = -10 if evtime==.
+replace c`var' = 0 if c`var'==.
+replace l`var' = 0 if l`var'==.
+replace u`var' = 0 if u`var'==.
+
+compress
+sort evtime
+save graphs/data/`var'_1870.dta, replace
+}
+
+
+clear all
+use graphs/data/evtime_1870.dta, clear
+
+foreach var in TC_b1950 TC_a1950 TCnowest_b1950 TCnowest_a1950 {
+
+merge 1:1 evtime using graphs/data/`var'_1870.dta
+drop _merge
+sort evtime
+}
+
+compress
+sort evtime
+
+
+
+keep if (evtime>=-60 & evtime<=50)
+*outside this interval, there's limited number of obs for non-tva counties
+
+egen ymax_aux = rowmax(cTC_b1950 cTCnowest_b1950 cTC_a1950 cTCnowest_a1950)
+egen ymin_aux = rowmin(cTC_b1950 cTCnowest_b1950 cTC_a1950 cTCnowest_a1950)
+
+egen ymax = max(ymax_aux)
+egen ymin = min(ymin_aux)
+
+gen yscale = ymin if evtime<=0
+replace yscale = ymax if evtime>0
+
+drop ymax_aux-ymin
+
+regaxis evtime, cycle(10) ltick(evtime)
+regaxis yscale, cycle(0.2) ltick(yscale)
+
+sort evtime
+
+
+twoway /*
+*/ (connected cTC_b1950 evtime, sort mcolor(black) msymbol(circle) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected cTC_a1950 evtime, sort mcolor(black) msymbol(circle_hollow) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected cTCnowest_b1950 evtime, sort mcolor(black) msymbol(square) lcolor(black) lwidth(medium) lpattern(dash)) /*
+*/ (connected cTCnowest_a1950 evtime, sort mcolor(black) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(dash)), /*
+*/ subtitle(Panel B. All vs. Non-West Hydroelectric Dams) /*
+*/ ytitle(ln(PopDensity)) ylabel(-0.2(0.2)0.8, angle(horizontal)) /*
+*/ xtitle(Years Relative to Dam Completion) xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(-10, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(`evtime') /*
+*/ legend(on order(1 "All: Pre-1950 Dams" 2 "All: Post-1950 Dams" /*
+*/ 3 "No West: Pre-1950 Dams" 4 "No West: Post-1950 Dams") cols(1) position(5) ring(0)) /*
+*/ xsize(6.5) ysize(5) scale(0.8) /*
+*/ saving(graphs/Fig_6b.gph, replace)
+
+
+****************************************
+***COMBINING PANELS
+****************************************
+graph combine graphs/Fig_6a.gph graphs/Fig_6b.gph, /*
+*/ xsize(10) ysize(5) ycommon scale(1) /*
+*/ saving(graphs/Fig_6.gph, replace)
+
+graph export graphs/Fig_6.pdf, replace
+
+erase graphs/Fig_6a.gph
+erase graphs/Fig_6b.gph
+
+
+********************************************************************************
+********************************************************************************
+***FIGURE 7
+********************************************************************************
+********************************************************************************
+
+****************************************
+***PANEL A
+****************************************
+clear all
+use data/sample_1870.dta, clear
+
+drop if year==1890
+*there's no data for this census year
+
+*total employment
+xi: areg lndens_emp i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if ((treated_b1950==1 | falsetreat==1) & lndens_emp~=.), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TClndens_emp_b1950_1870.dta, replace)
+
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ keep(evtime100b-evtime20b evtime0-evtime80a) /*
+*/ ctitle(ATC4_c1) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+*manufacturing
+xi: areg lndens1_manuf i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if ((treated_b1950==1 | falsetreat==1) & lndens1_manuf~=.), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TClndens1_manuf_b1950_1870.dta, replace)
+
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ keep(evtime100b-evtime20b evtime0-evtime80a) /*
+*/ ctitle(ATC4_c2) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+*agriculture
+xi: areg lndens1_agr i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if ((treated_b1950==1 | falsetreat==1) & lndens1_agr~=.), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TClndens1_agr_b1950_1870.dta, replace)
+
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ keep(evtime100b-evtime20b evtime0-evtime80a) /*
+*/ ctitle(ATC4_c3) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+*trade
+xi: areg lndens1_trade i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if ((treated_b1950==1 | falsetreat==1) & lndens1_trade~=.), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TClndens1_trade_b1950_1870.dta, replace)
+
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ keep(evtime100b-evtime20b evtime0-evtime80a) /*
+*/ ctitle(ATC4_c4) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+*construction
+xi: areg lndens1_constr i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if ((treated_b1950==1 | falsetreat==1) & lndens1_constr~=.), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TClndens1_constr_b1950_1870.dta, replace)
+
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ keep(evtime100b-evtime20b evtime0-evtime80a) /*
+*/ ctitle(ATC4_c5) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+*other sectors
+xi: areg lndens1_other i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if ((treated_b1950==1 | falsetreat==1) & lndens1_other~=.), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TClndens1_other_b1950_1870.dta, replace)
+
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ keep(evtime100b-evtime20b evtime0-evtime80a) /*
+*/ ctitle(ATC4_c6) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+
+
+clear all
+foreach var in TC_b1950 /*
+*/ TClndens_emp_b1950 /*
+*/ TClndens1_manuf_b1950 /*
+*/ TClndens1_agr_b1950 /*
+*/ TClndens1_constr_b1950 /*
+*/ TClndens1_trade_b1950 /*
+*/ TClndens1_other_b1950 {
+
+clear
+use data/parmest/`var'_1870.dta, clear
+
+gen evtime = -100 if parm=="evtime100b"
+replace evtime = -90 if parm=="evtime90b"
+replace evtime = -80 if parm=="evtime80b"
+replace evtime = -70 if parm=="evtime70b"
+replace evtime = -60 if parm=="evtime60b"
+replace evtime = -50 if parm=="evtime50b"
+replace evtime = -40 if parm=="evtime40b"
+replace evtime = -30 if parm=="evtime30b"
+replace evtime = -20 if parm=="evtime20b"
+replace evtime = 0 if parm=="evtime0"
+replace evtime = 10 if parm=="evtime10a"
+replace evtime = 20 if parm=="evtime20a"
+replace evtime = 30 if parm=="evtime30a"
+replace evtime = 40 if parm=="evtime40a"
+replace evtime = 50 if parm=="evtime50a"
+replace evtime = 60 if parm=="evtime60a"
+replace evtime = 70 if parm=="evtime70a"
+replace evtime = 80 if parm=="evtime80a"
+
+keep if evtime~=.
+
+local new = _N + 1
+set obs `new'
+
+ren estimate c`var'
+ren min95 l`var'
+ren max95 u`var'
+
+keep evtime c`var' l`var' u`var'
+order evtime c`var' l`var' u`var'
+
+replace evtime = -10 if evtime==.
+replace c`var' = 0 if c`var'==.
+replace l`var' = 0 if l`var'==.
+replace u`var' = 0 if u`var'==.
+
+compress
+sort evtime
+save graphs/data/`var'_1870.dta, replace
+}
+
+
+clear all
+use graphs/data/evtime_1870.dta, clear
+
+foreach var in TC_b1950 /*
+*/ TClndens_emp_b1950 /*
+*/ TClndens1_manuf_b1950 /*
+*/ TClndens1_agr_b1950 /*
+*/ TClndens1_constr_b1950 /*
+*/ TClndens1_trade_b1950 /*
+*/ TClndens1_other_b1950 {
+
+merge 1:1 evtime using graphs/data/`var'_1870.dta
+drop _merge
+sort evtime
+}
+
+compress
+sort evtime
+
+
+
+keep if (evtime>=-60 & evtime<=70)
+
+egen ymax_aux = rowmax(cTC_b1950 /*
+ */ cTClndens_emp_b1950 cTClndens1_manuf_b1950 /*
+ */ cTClndens1_agr_b1950 cTClndens1_other_b1950)
+egen ymin_aux = rowmin(cTC_b1950 /*
+ */ cTClndens_emp_b1950 cTClndens1_manuf_b1950 /*
+ */ cTClndens1_agr_b1950 cTClndens1_other_b1950)
+
+egen ymax = max(ymax_aux)
+egen ymin = min(ymin_aux)
+
+gen yscale = ymin if evtime<=0
+replace yscale = ymax if evtime>0
+
+drop ymax_aux-ymin
+
+regaxis evtime, cycle(10) ltick(evtime)
+regaxis yscale, cycle(0.2) ltick(yscale)
+
+sort evtime
+
+
+twoway /*
+*/ (connected cTC_b1950 evtime, sort mcolor(black) msymbol(circle) lcolor(black) lwidth(thick) lpattern(solid)) /*
+*/ (connected cTClndens_emp_b1950 evtime, sort mcolor(black) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (line cTClndens1_manuf_b1950 evtime, sort mcolor(black) lcolor(black) lwidth(medium) lpattern(longdash)) /*
+*/ (line cTClndens1_agr_b1950 evtime, sort mcolor(black) lcolor(black) lwidth(medium) lpattern(dash)) /*
+*/ (line cTClndens1_trade_b1950 evtime, sort mcolor(black) lcolor(black) lwidth(medium) lpattern(dash_3dot)) /*
+*/ (line cTClndens1_constr_b1950 evtime, sort mcolor(black) lcolor(black) lwidth(medium) lpattern(longdash_3dot)) /*
+*/ (line cTClndens1_other_b1950 evtime, sort mcolor(black) lcolor(black) lwidth(medium) lpattern(dot)), /*
+*/ ytitle(ln(EmpDensity)) ylabel(`yscale', angle(horizontal)) /*
+*/ xtitle(Years Relative to Dam Completion) xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(-10, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(`evtime') /*
+*/ subtitle(Panel A. Pre-1950 Dams) /*
+*/ legend(on order(1 "Population" 2 "Employment" 3 "Emp: Manufacturing" 4 "Emp: Agriculture" /*
+*/ 5 "Emp: Trade" 6 "Emp: Construction" 7 "Emp: Others") cols(1) position(10) ring(0) rowgap(minuscule) size(small)) /*
+*/ xsize(6.5) ysize(5) scale(0.9) /*
+*/ saving(graphs/Fig_7a.gph, replace)
+
+
+****************************************
+***PANEL B
+****************************************
+clear all
+use data/sample_1870.dta, clear
+
+drop if year==1890
+*there's no data for this census year
+
+*total employment
+xi: areg lndens_emp i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if ((treated_a1950==1 | falsetreat==1) & lndens_emp~=.), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TClndens_emp_a1950_1870.dta, replace)
+
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ keep(evtime100b-evtime20b evtime0-evtime80a) /*
+*/ ctitle(ATC5_c1) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+*manufacturing
+xi: areg lndens1_manuf i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if ((treated_a1950==1 | falsetreat==1) & lndens1_manuf~=.), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TClndens1_manuf_a1950_1870.dta, replace)
+
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ keep(evtime100b-evtime20b evtime0-evtime80a) /*
+*/ ctitle(ATC5_c2) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+*agriculture
+xi: areg lndens1_agr i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if ((treated_a1950==1 | falsetreat==1) & lndens1_agr~=.), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TClndens1_agr_a1950_1870.dta, replace)
+
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ keep(evtime100b-evtime20b evtime0-evtime80a) /*
+*/ ctitle(ATC5_c3) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+*trade
+xi: areg lndens1_trade i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if ((treated_a1950==1 | falsetreat==1) & lndens1_trade~=.), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TClndens1_trade_a1950_1870.dta, replace)
+
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ keep(evtime100b-evtime20b evtime0-evtime80a) /*
+*/ ctitle(ATC5_c4) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+*construction
+xi: areg lndens1_constr i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if ((treated_a1950==1 | falsetreat==1) & lndens1_constr~=.), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TClndens1_constr_a1950_1870.dta, replace)
+
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ keep(evtime100b-evtime20b evtime0-evtime80a) /*
+*/ ctitle(ATC5_c5) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+*other sectors
+xi: areg lndens1_other i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if ((treated_a1950==1 | falsetreat==1) & lndens1_other~=.), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TClndens1_other_a1950_1870.dta, replace)
+
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ keep(evtime100b-evtime20b evtime0-evtime80a) /*
+*/ ctitle(ATC5_c6) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+
+
+
+
+clear all
+foreach var in TC_a1950 /*
+*/ TClndens_emp_a1950 /*
+*/ TClndens1_manuf_a1950 /*
+*/ TClndens1_agr_a1950 /*
+*/ TClndens1_constr_a1950 /*
+*/ TClndens1_trade_a1950 /*
+*/ TClndens1_other_a1950 {
+
+clear
+use data/parmest/`var'_1870.dta, clear
+
+gen evtime = -100 if parm=="evtime100b"
+replace evtime = -90 if parm=="evtime90b"
+replace evtime = -80 if parm=="evtime80b"
+replace evtime = -70 if parm=="evtime70b"
+replace evtime = -60 if parm=="evtime60b"
+replace evtime = -50 if parm=="evtime50b"
+replace evtime = -40 if parm=="evtime40b"
+replace evtime = -30 if parm=="evtime30b"
+replace evtime = -20 if parm=="evtime20b"
+replace evtime = 0 if parm=="evtime0"
+replace evtime = 10 if parm=="evtime10a"
+replace evtime = 20 if parm=="evtime20a"
+replace evtime = 30 if parm=="evtime30a"
+replace evtime = 40 if parm=="evtime40a"
+replace evtime = 50 if parm=="evtime50a"
+replace evtime = 60 if parm=="evtime60a"
+replace evtime = 70 if parm=="evtime70a"
+replace evtime = 80 if parm=="evtime80a"
+
+keep if evtime~=.
+
+local new = _N + 1
+set obs `new'
+
+ren estimate c`var'
+ren min95 l`var'
+ren max95 u`var'
+
+keep evtime c`var' l`var' u`var'
+order evtime c`var' l`var' u`var'
+
+replace evtime = -10 if evtime==.
+replace c`var' = 0 if c`var'==.
+replace l`var' = 0 if l`var'==.
+replace u`var' = 0 if u`var'==.
+
+compress
+sort evtime
+save graphs/data/`var'_1870.dta, replace
+}
+
+
+clear all
+use graphs/data/evtime_1870.dta, clear
+
+foreach var in TC_a1950 /*
+*/ TClndens_emp_a1950 /*
+*/ TClndens1_manuf_a1950 /*
+*/ TClndens1_agr_a1950 /*
+*/ TClndens1_constr_a1950 /*
+*/ TClndens1_trade_a1950 /*
+*/ TClndens1_other_a1950 {
+
+merge 1:1 evtime using graphs/data/`var'_1870.dta
+drop _merge
+sort evtime
+}
+
+compress
+sort evtime
+
+
+keep if (evtime>=-90 & evtime<=50)
+
+egen ymax_aux = rowmax(cTC_a1950 /*
+ */ cTClndens_emp_a1950 cTClndens1_manuf_a1950 /*
+ */ cTClndens1_agr_a1950 cTClndens1_other_a1950)
+egen ymin_aux = rowmin(cTC_a1950 /*
+ */ cTClndens_emp_a1950 cTClndens1_manuf_a1950 /*
+ */ cTClndens1_agr_a1950 cTClndens1_other_a1950)
+
+egen ymax = max(ymax_aux)
+egen ymin = min(ymin_aux)
+
+gen yscale = ymin if evtime<=0
+replace yscale = ymax if evtime>0
+
+drop ymax_aux-ymin
+
+regaxis evtime, cycle(10) ltick(evtime)
+regaxis yscale, cycle(0.2) ltick(yscale)
+
+sort evtime
+
+
+twoway /*
+*/ (connected cTC_a1950 evtime, sort mcolor(black) msymbol(circle) lcolor(black) lwidth(thick) lpattern(solid)) /*
+*/ (connected cTClndens_emp_a1950 evtime, sort mcolor(black) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (line cTClndens1_manuf_a1950 evtime, sort mcolor(black) lcolor(black) lwidth(medium) lpattern(longdash)) /*
+*/ (line cTClndens1_agr_a1950 evtime, sort mcolor(black) lcolor(black) lwidth(medium) lpattern(dash)) /*
+*/ (line cTClndens1_trade_a1950 evtime, sort mcolor(black) lcolor(black) lwidth(medium) lpattern(dash_3dot)) /*
+*/ (line cTClndens1_constr_a1950 evtime, sort mcolor(black) lcolor(black) lwidth(medium) lpattern(longdash_3dot)) /*
+*/ (line cTClndens1_other_a1950 evtime, sort mcolor(black) lcolor(black) lwidth(medium) lpattern(dot)), /*
+*/ ytitle(ln(EmpDensity)) ylabel(-0.2(0.2)1.2, angle(horizontal)) /*
+*/ xtitle(Years Relative to Dam Completion) xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(-10, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(`evtime') /*
+*/ subtitle(Panel B. Post-1950 Dams) /*
+*/ legend(on order(1 "Population" 2 "Employment" 3 "Emp: Manufacturing" 4 "Emp: Agriculture" /*
+*/ 5 "Emp: Trade" 6 "Emp: Construction" 7 "Emp: Others") cols(1) position(10) ring(0) rowgap(minuscule) size(small)) /*
+*/ xsize(6.5) ysize(5) scale(0.9) /*
+*/ saving(graphs/Fig_7b.gph, replace)
+
+
+****************************************
+***COMBINING PANELS
+****************************************
+graph combine graphs/Fig_7a.gph graphs/Fig_7b.gph, /*
+*/ xsize(10) ysize(5) scale(1) /*
+*/ saving(graphs/Fig_7.gph, replace)
+
+graph export graphs/Fig_7.pdf, replace
+
+erase graphs/Fig_7a.gph
+erase graphs/Fig_7b.gph
+
+
+********************************************************************************
+********************************************************************************
+***FIGURE 8
+********************************************************************************
+********************************************************************************
+
+****************************************
+***PANEL A
+****************************************
+clear all
+use data/sample_1870.dta, clear
+
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_b1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+drop _I*
+
+capture drop sample_b1950
+gen sample_b1950 = e(sample)
+keep if sample_b1950==1
+
+capture drop n
+bysort county_fips: gen n=_n
+
+tab treated_b1950 if n==1
+tab year_treat if (year_treat>0 & n==1)
+
+tab state_name if (n==1 & treated_b1950==1)
+tab state_name if (n==1 & treated_b1950==0)
+
+sum treated_b1950 if (treated_b1950==0 & n==1)
+local ncontrol = r(N)
+
+sum year_treat if (year_treat>0 & n==1)
+local miny_treat = r(min)
+local maxy_treat = r(max)
+
+forvalues i=`miny_treat'(10)`maxy_treat' {
+ sum year_treat if (year_treat==`i' & n==1)
+ scalar ntreat`i' = r(N)
+}
+
+drop n
+bysort treated_b1950 county_fips: gen n = _n
+replace n = . if n>1
+
+sort n treated_b1950 year_treat county_fips
+bysort n treated_b1950: gen n2 = _n
+replace n2 = . if n==.
+
+gen n3 = _n
+replace n3 = . if n==.
+
+bysort county_fips: egen id = max(n3)
+
+drop n n2 n3
+
+compress
+order county_fips id year
+
+tsset id year
+
+sort id year
+save data/sample_b1950_1870.dta, replace
+save data/sample_b1950_merge_1870.dta, replace
+
+
+clear
+use data/sample_b1950_merge_1870.dta, clear
+
+local l_1910 = `ncontrol' + 1
+local u_1910 = `ncontrol' + ntreat1910
+forvalues i=`l_1910'(1)`u_1910' {
+ synth lndensity lndensity(1870) lndensity(1880) lndensity(1890) lndensity(1900) lndensity(1910) /*
+ */ latc1 lonc1 latc2 lonc2 latc3 lonc3 reg1 reg2 reg3 reg4 railtrack waterway distnearmsa_miles inst1944 mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1, /*
+ */ trunit(`i') counit(1(1)`ncontrol') trperiod(1920) keep(synth`i'_1870, replace)
+}
+
+local l_1920 = `u_1910' + 1
+local u_1920 = `u_1910' + ntreat1920
+forvalues i=`l_1920'(1)`u_1920' {
+ synth lndensity lndensity(1870) lndensity(1880) lndensity(1890) lndensity(1900) lndensity(1910) lndensity(1920) /*
+ */ latc1 lonc1 latc2 lonc2 latc3 lonc3 reg1 reg2 reg3 reg4 railtrack waterway distnearmsa_miles inst1944 mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1, /*
+ */ trunit(`i') counit(1(1)`ncontrol') trperiod(1930) keep(synth`i'_1870, replace)
+}
+
+local l_1930 = `u_1920' + 1
+local u_1930 = `u_1920' + ntreat1930
+forvalues i=`l_1930'(1)`u_1930' {
+ synth lndensity lndensity(1870) lndensity(1880) lndensity(1890) lndensity(1900) lndensity(1910) lndensity(1920) lndensity(1930) /*
+ */ latc1 lonc1 latc2 lonc2 latc3 lonc3 reg1 reg2 reg3 reg4 railtrack waterway distnearmsa_miles inst1944 mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1, /*
+ */ trunit(`i') counit(1(1)`ncontrol') trperiod(1940) keep(synth`i'_1870, replace)
+}
+
+local l_1940 = `u_1930' + 1
+local u_1940 = `u_1930' + ntreat1940
+forvalues i=`l_1940'(1)`u_1940' {
+ synth lndensity lndensity(1870) lndensity(1880) lndensity(1890) lndensity(1900) lndensity(1910) lndensity(1920) lndensity(1930) lndensity(1940) /*
+ */ latc1 lonc1 latc2 lonc2 latc3 lonc3 reg1 reg2 reg3 reg4 railtrack waterway distnearmsa_miles inst1944 mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1, /*
+ */ trunit(`i') counit(1(1)`ncontrol') trperiod(1950) keep(synth`i'_1870,replace)
+}
+
+
+
+clear
+forvalues i=`l_1910'(1)`u_1940' {
+ clear
+ use synth`i'_1870.dta, clear
+ keep _Co_Number _W_Weight
+ ren _Co_Number id
+ ren _W_Weight weight
+ save synth`i'tomerge_1870.dta, replace
+
+ clear
+ use data/sample_b1950_merge_1870.dta, clear
+ sort id
+ merge m:1 id using synth`i'tomerge_1870.dta
+ drop _merge
+ gen id2 = `i'
+ save data/synth`i'toappend_1870.dta, replace
+
+ clear
+ erase synth`i'_1870.dta
+ erase synth`i'tomerge_1870.dta
+}
+
+clear
+use data/sample_b1950_merge_1870.dta, clear
+
+forvalues i=`l_1910'(1)`u_1940' {
+ append using data/synth`i'toappend_1870.dta
+ erase data/synth`i'toappend_1870.dta
+}
+
+order county_fips id id2
+
+drop if id2==.
+drop if id2~=id & weight==.
+
+replace weight = 1 if weight==.
+drop if weight==0
+
+gen idts = id2 if id2==id
+replace idts = id2*1000 if id2~=id
+*idts: id treat x synth control
+
+gen idcase = idts
+replace idcase = idts/1000 if idts>999
+
+drop id2
+order county_fips idcase idts id year
+
+compress
+sort idcase idts id year
+save data/sample_b1950_1870.dta, replace
+
+
+clear
+use data/sample_b1950_1870.dta, clear
+
+xi: reg lndensity i.county_fips i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3, /*
+*/ cluster(county_fips) level(95)
+
+foreach var of varlist lndensity _I* /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 {
+ replace `var' = `var'*weight
+}
+
+collapse county_fips year_treat idcase (sum) lndensity _I* /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3, by(idts year)
+
+foreach var of varlist idcase lndensity _I* /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 {
+ label var `var' ""
+}
+
+reg lndensity _I* /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3, /*
+*/ cluster(idcase) level(95)
+
+parmest, saving(data/parmest/TS_b1950_1870.dta, replace)
+
+compress
+sort idcase idts year
+save data/sample_b1950_agg_1870.dta, replace
+
+keep idcase idts county_fips year year_treat lndensity
+order idcase idts county_fips year year_treat lndensity
+
+compress
+sort idcase idts year
+save data/sample_b1950_graphs_summary_statistics_1870.dta, replace
+
+
+*HISTOGRAMS OF INDIVIDUAL DAM EFFECTS
+clear all
+use data/sample_b1950_graphs_summary_statistics_1870.dta, clear
+
+gen lndensity_synth_aux = lndensity if idts>999
+bysort idcase year: egen lndensity_synth = max(lndensity_synth_aux)
+drop lndensity_synth_aux
+
+gen dyear = year - year_treat
+replace dyear = . if dyear<0
+
+gen dlndensity = lndensity - lndensity_synth
+replace dlndensity = . if idts>999
+replace dlndensity = . if dyear<0
+
+replace dyear = . if dlndensity==.
+
+gen dlndensity0_aux = dlndensity if dyear==0
+bysort idts: egen dlndensity0 = max(dlndensity0_aux )
+drop dlndensity0_aux
+
+sort idcase idts year
+
+gen dlndens_rt0 = dlndensity - dlndensity0
+*replace dlndens_rt0 = dlndens_rt0*100
+
+
+forvalues i = 10(20)70 {
+histogram dlndens_rt0 if dyear==`i', bin(12) percent kdensity title(`i' years) /*
+*/ kdenopts(lcolor(cranberry) lwidth(thick)) /*
+*/ ytitle(Percentages) ylabel(, angle(horizontal)) /*
+*/ xtitle(Estimates in Log Points) xtitle(, alignment(bottom)) xlabel(-1(0.5)2) xscale(titlegap(3)) /*
+*/ xline(0, lwidth(medthick) lpattern(solid) lcolor(black)) /*
+*/ xsize(7) ysize(4) scale(0.9) /*
+*/ saving(graphs/hist`i'_b1950.gph, replace)
+}
+
+
+****************************************
+***PANEL B
+****************************************
+clear all
+use data/sample_1870.dta, clear
+
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_a1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+drop _I*
+
+capture drop sample_a1950
+gen sample_a1950 = e(sample)
+keep if sample_a1950==1
+
+capture drop n
+bysort county_fips: gen n=_n
+
+tab treated_a1950 if n==1
+tab year_treat if (year_treat>0 & n==1)
+
+tab state_name if (n==1 & treated_a1950==1)
+tab state_name if (n==1 & treated_a1950==0)
+
+sum treated_a1950 if (treated_a1950==0 & n==1)
+local ncontrol = r(N)
+
+sum year_treat if (year_treat>0 & n==1)
+local miny_treat = r(min)
+local maxy_treat = r(max)
+
+forvalues i=`miny_treat'(10)`maxy_treat' {
+ sum year_treat if (year_treat==`i' & n==1)
+ scalar ntreat`i' = r(N)
+}
+
+
+
+drop n
+bysort treated_a1950 county_fips: gen n = _n
+replace n = . if n>1
+
+sort n treated_a1950 year_treat county_fips
+bysort n treated_a1950: gen n2 = _n
+replace n2 = . if n==.
+
+gen n3 = _n
+replace n3 = . if n==.
+
+bysort county_fips: egen id = max(n3)
+
+drop n n2 n3
+
+compress
+order county_fips id year
+
+tsset id year
+
+sort id year
+save data/sample_a1950_1870.dta, replace
+save data/sample_a1950_merge_1870.dta, replace
+
+
+clear
+use data/sample_a1950_merge_1870.dta, clear
+
+local l_1950 = `ncontrol' + 1
+local u_1950 = `ncontrol' + ntreat1950
+forvalues i=`l_1950'(1)`u_1950' {
+ synth lndensity lndensity(1870) lndensity(1880) lndensity(1890) lndensity(1900) lndensity(1910) lndensity(1920) lndensity(1930) lndensity(1940) /*
+ */ lndensity(1950) /*
+ */ latc1 lonc1 latc2 lonc2 latc3 lonc3 reg1 reg2 reg3 reg4 railtrack waterway distnearmsa_miles inst1944 mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1, /*
+ */ trunit(`i') counit(1(1)`ncontrol') trperiod(1960) keep(synth`i'_1870,replace)
+}
+
+local l_1960 = `u_1950' + 1
+local u_1960 = `u_1950' + ntreat1960
+forvalues i=`l_1960'(1)`u_1960' {
+ synth lndensity lndensity(1870) lndensity(1880) lndensity(1890) lndensity(1900) lndensity(1910) lndensity(1920) lndensity(1930) lndensity(1940) /*
+ */ lndensity(1950) lndensity(1960) /*
+ */ latc1 lonc1 latc2 lonc2 latc3 lonc3 reg1 reg2 reg3 reg4 railtrack waterway distnearmsa_miles inst1944 mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1, /*
+ */ trunit(`i') counit(1(1)`ncontrol') trperiod(1970) keep(synth`i'_1870,replace)
+}
+
+local l_1970 = `u_1960' + 1
+local u_1970 = `u_1960' + ntreat1970
+forvalues i=`l_1970'(1)`u_1970' {
+ synth lndensity lndensity(1870) lndensity(1880) lndensity(1890) lndensity(1900) lndensity(1910) lndensity(1920) lndensity(1930) lndensity(1940) /*
+ */ lndensity(1950) lndensity(1960) lndensity(1970) /*
+ */ latc1 lonc1 latc2 lonc2 latc3 lonc3 reg1 reg2 reg3 reg4 railtrack waterway distnearmsa_miles inst1944 mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1, /*
+ */ trunit(`i') counit(1(1)`ncontrol') trperiod(1980) keep(synth`i'_1870,replace)
+}
+
+local l_1980 = `u_1970' + 1
+local u_1980 = `u_1970' + ntreat1980
+forvalues i=`l_1980'(1)`u_1980' {
+ synth lndensity lndensity(1870) lndensity(1880) lndensity(1890) lndensity(1900) lndensity(1910) lndensity(1920) lndensity(1930) lndensity(1940) /*
+ */ lndensity(1950) lndensity(1960) lndensity(1970) lndensity(1980) /*
+ */ latc1 lonc1 latc2 lonc2 latc3 lonc3 reg1 reg2 reg3 reg4 railtrack waterway distnearmsa_miles inst1944 mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1, /*
+ */ trunit(`i') counit(1(1)`ncontrol') trperiod(1990) keep(synth`i'_1870,replace)
+}
+
+local l_1990 = `u_1980' + 1
+local u_1990 = `u_1980' + ntreat1990
+forvalues i=`l_1990'(1)`u_1990' {
+ synth lndensity lndensity(1870) lndensity(1880) lndensity(1890) lndensity(1900) lndensity(1910) lndensity(1920) lndensity(1930) lndensity(1940) /*
+ */ lndensity(1950) lndensity(1960) lndensity(1970) lndensity(1980) lndensity(1990) /*
+ */ latc1 lonc1 latc2 lonc2 latc3 lonc3 reg1 reg2 reg3 reg4 railtrack waterway distnearmsa_miles inst1944 mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1, /*
+ */ trunit(`i') counit(1(1)`ncontrol') trperiod(2000) keep(synth`i'_1870,replace)
+}
+
+
+clear
+forvalues i=`l_1950'(1)`u_1990' {
+ clear
+ use synth`i'_1870.dta, clear
+ keep _Co_Number _W_Weight
+ ren _Co_Number id
+ ren _W_Weight weight
+ save synth`i'tomerge_1870.dta, replace
+
+ clear
+ use data/sample_a1950_merge_1870.dta, clear
+ sort id
+ merge m:1 id using synth`i'tomerge_1870.dta
+ drop _merge
+ gen id2 = `i'
+ save data/synth`i'toappend_1870.dta, replace
+
+ clear
+ erase synth`i'_1870.dta
+ erase synth`i'tomerge_1870.dta
+}
+
+clear
+use data/sample_a1950_merge_1870.dta, clear
+
+forvalues i=`l_1950'(1)`u_1990' {
+ append using data/synth`i'toappend_1870.dta
+ erase data/synth`i'toappend_1870.dta
+}
+
+order county_fips id id2
+
+drop if id2==.
+drop if id2~=id & weight==.
+
+replace weight = 1 if weight==.
+drop if weight==0
+
+gen idts = id2 if id2==id
+replace idts = id2*1000 if id2~=id
+*idts: id treat x synth control
+
+gen idcase = idts
+replace idcase = idts/1000 if idts>999
+
+drop id2
+order county_fips idcase idts id year
+
+compress
+sort idcase idts id year
+save data/sample_a1950_1870.dta, replace
+
+
+clear
+use data/sample_a1950_1870.dta, clear
+
+xi: reg lndensity i.county_fips i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3, /*
+*/ cluster(county_fips) level(95)
+
+foreach var of varlist lndensity _I* /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 {
+ replace `var' = `var'*weight
+}
+
+collapse county_fips year_treat idcase (sum) lndensity _I* /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3, by(idts year)
+
+foreach var of varlist idcase lndensity _I* /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 {
+ label var `var' ""
+}
+
+reg lndensity _I* /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3, /*
+*/ cluster(idcase) level(95)
+
+parmest, saving(data/parmest/TS_a1950_1870.dta, replace)
+
+compress
+sort idcase idts year
+save data/sample_a1950_agg_1870.dta, replace
+
+keep idcase idts county_fips year year_treat lndensity
+order idcase idts county_fips year year_treat lndensity
+
+compress
+sort idcase idts year
+save data/sample_a1950_graphs_summary_statistics_1870.dta, replace
+
+
+*HISTOGRAMS OF INDIVIDUAL DAM EFFECTS
+clear all
+use data/sample_a1950_graphs_summary_statistics_1870.dta, clear
+
+gen lndensity_synth_aux = lndensity if idts>999
+bysort idcase year: egen lndensity_synth = max(lndensity_synth_aux)
+drop lndensity_synth_aux
+
+gen dyear = year - year_treat
+replace dyear = . if dyear<0
+
+gen dlndensity = lndensity - lndensity_synth
+replace dlndensity = . if idts>999
+replace dlndensity = . if dyear<0
+
+replace dyear = . if dlndensity==.
+
+gen dlndensity0_aux = dlndensity if dyear==0
+bysort idts: egen dlndensity0 = max(dlndensity0_aux )
+drop dlndensity0_aux
+
+sort idcase idts year
+
+gen dlndens_rt0 = dlndensity - dlndensity0
+*replace dlndens_rt0 = dlndens_rt0*100
+
+
+forvalues i = 10(20)50 {
+histogram dlndens_rt0 if dyear==`i', bin(12) percent kdensity title(`i' years) /*
+*/ kdenopts(lcolor(cranberry) lwidth(thick)) /*
+*/ ytitle(Percentages) ylabel(, angle(horizontal)) /*
+*/ xtitle(Estimates in Log Points) xtitle(, alignment(bottom)) xlabel(-1(0.5)2) xscale(titlegap(3)) /*
+*/ xline(0, lwidth(medthick) lpattern(solid) lcolor(black)) /*
+*/ xsize(7) ysize(4) scale(0.9) /*
+*/ saving(graphs/hist`i'_a1950.gph, replace)
+}
+
+
+****************************************
+***COMBINING HISTOGRAMS
+****************************************
+graph combine graphs/hist10_b1950.gph graphs/hist10_a1950.gph /*
+*/ graphs/hist30_b1950.gph graphs/hist30_a1950.gph /*
+*/ graphs/hist50_b1950.gph graphs/hist50_a1950.gph /*
+*/ graphs/hist70_b1950.gph, /*
+*/ ycommon xcommon /*
+*/ subtitle(Panel A. Pre-1950 Dams Panel B. Post-1950 Dams) /*
+*/ xsize(8) ysize(11) scale(0.9) cols(2) /*
+*/ saving(graphs/Fig_8.gph, replace)
+
+graph export graphs/Fig_8.pdf, replace
+
+forvalues i = 10(10)80 {
+ capture erase graphs/hist`i'_b1950.gph
+}
+
+forvalues i = 10(10)50 {
+ capture erase graphs/hist`i'_a1950.gph
+}
+
+
+********************************************************************************
+********************************************************************************
+***FIGURE 9
+********************************************************************************
+********************************************************************************
+clear all
+use data/sample_b1950_graphs_summary_statistics_1870.dta, clear
+*this dataset was created in the analysis for Figure 8
+
+
+regaxis year, cycle(10) ltick(year)
+sort year
+
+/* Martin Dam (1920s) - Elmore County (AL) FIPS: 1051*/
+twoway /*
+*/ (connected lndensity year if idts==33, sort mcolor(black) msize(small) msymbol(circle) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected lndensity year if idts==33*1000, sort mcolor(black) msize(small) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(dash)), /*
+*/ ytitle(ln(PopDensity)) ylabel(, angle(horizontal)) /*
+*/ xtitle("") xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(1920, lwidth(medium) lpattern(solid) lcolor(black)) /*
+*/ xline(1950, lwidth(medium) lpattern(dash) lcolor(black)) xlabel(`year', angle(45)) /*
+*/ subtitle(Panel A. Martin Dam (1920s)) /*
+*/ t2title(Elmore County (AL)) /*
+*/ legend(off) /*
+*/ xsize(6.5) ysize(5) scale(0.9) /*
+*/ saving(graphs/Figure_Synth_b50_FasterGrowth_1870.gph, replace)
+
+
+regaxis year, cycle(10) ltick(year)
+sort year
+
+/* Calderwood Dam (1930s) - Blount County (TN) FIPS: 47009*/
+twoway /*
+*/ (connected lndensity year if idts==45, sort mcolor(black) msize(small) msymbol(circle) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected lndensity year if idts==45*1000, sort mcolor(black) msize(small) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(dash)), /*
+*/ ytitle(ln(PopDensity)) ylabel(, angle(horizontal)) /*
+*/ xtitle("") xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(1930, lwidth(medium) lpattern(solid) lcolor(black)) /*
+*/ xline(1950, lwidth(medium) lpattern(dash) lcolor(black)) xlabel(`year', angle(45)) /*
+*/ subtitle(Panel B. Calderwood Dam (1930s)) /*
+*/ t2title(Blount County (TN)) /*
+*/ legend(off) /*
+*/ xsize(6.5) ysize(5) scale(0.9) /*
+*/ saving(graphs/Figure_Synth_b50_Emblematic_1870.gph, replace)
+
+
+regaxis year, cycle(10) ltick(year)
+sort year
+
+/* Norris Dam (1930s) - Anderson County (TN) FIPS: 47001 */
+twoway /*
+*/ (connected lndensity year if idts==44, sort mcolor(black) msize(small) msymbol(circle) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected lndensity year if idts==44*1000, sort mcolor(black) msize(small) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(dash)), /*
+*/ ytitle(ln(PopDensity)) ylabel(, angle(horizontal)) /*
+*/ xtitle("") xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(1930, lwidth(medium) lpattern(solid) lcolor(black)) /*
+*/ xline(1950, lwidth(medium) lpattern(dash) lcolor(black)) xlabel(`year', angle(45)) /*
+*/ subtitle(Panel C. Norris Dam (1930s)) /*
+*/ t2title(Anderson County (TN)) /*
+*/ legend(on order(1 "Observed Trend" 2 "Synthetic Control") symxsize(1)) /*
+*/ xsize(6.5) ysize(5) scale(0.9) /*
+*/ saving(graphs/Figure_Synth_b50_NoAgg_1870.gph, replace)
+
+
+regaxis year, cycle(10) ltick(year)
+sort year
+
+/* Hawks Nest Dam (1930s) - Fayette County (WV) FIPS: 54019 */
+twoway /*
+*/ (connected lndensity year if idts==46, sort mcolor(black) msize(small) msymbol(circle) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected lndensity year if idts==46*1000, sort mcolor(black) msize(small) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(dash)), /*
+*/ ytitle(ln(PopDensity)) ylabel(, angle(horizontal)) /*
+*/ xtitle("") xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(1930, lwidth(medium) lpattern(solid) lcolor(black)) /*
+*/ xline(1950, lwidth(medium) lpattern(dash) lcolor(black)) xlabel(`year', angle(45)) /*
+*/ subtitle(Panel D. Hawks Nest Dam (1930s)) /*
+*/ t2title(Fayette County (WV)) /*
+*/ legend(on order(1 "Observed Trend" 2 "Synthetic Control") symxsize(1)) /*
+*/ xsize(6.5) ysize(5) scale(0.9) /*
+*/ saving(graphs/Figure_Synth_b50_Reversion_1870.gph, replace)
+
+
+/* Combining graphs that display distinctive paths */
+
+graph combine /*
+*/ graphs/Figure_Synth_b50_FasterGrowth_1870.gph /*
+*/ graphs/Figure_Synth_b50_Emblematic_1870.gph /*
+*/ graphs/Figure_Synth_b50_NoAgg_1870.gph /*
+*/ graphs/Figure_Synth_b50_Reversion_1870.gph , /*
+*/ xsize(10.5) ysize(9) scale(0.8) cols(2) /*
+*/ saving(graphs/Fig_9.gph, replace)
+
+graph export graphs/Fig_9.pdf, replace
+
+erase graphs/Figure_Synth_b50_FasterGrowth_1870.gph
+erase graphs/Figure_Synth_b50_Emblematic_1870.gph
+erase graphs/Figure_Synth_b50_NoAgg_1870.gph
+erase graphs/Figure_Synth_b50_Reversion_1870.gph
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX FIGURE B.1
+********************************************************************************
+********************************************************************************
+*installed hydroelectric capacity
+clear all
+use data/egrid2007_generators.dta, clear
+
+keep if fuelg1=="WAT"
+drop if prmvr=="PS"
+
+sort orispl
+merge m:1 orispl using data/egrid2007_plants_counties.dta
+keep if _merge==3
+drop _merge
+
+gen state_fips = int(county_fips/1000)
+
+bysort state_fips: egen instcap = sum(namepcap)
+
+bysort state_fips: gen n=_n
+keep if n==1
+
+keep state_fips instcap
+
+compress
+save data/instcap_egrid.dta, replace
+
+
+*undeveloped hydroelectric capacity
+clear all
+use data/inl_all_states.dta, clear
+
+replace nameplate = nameplate/1000
+*now measured in MW
+
+bysort state_fips: egen undevcap = sum(nameplate)
+
+bysort state_fips: gen n=_n
+keep if n==1
+
+keep state_fips undevcap
+
+compress
+save data/undevcap_inl.dta, replace
+
+
+use data/instcap_egrid.dta, clear
+
+merge 1:1 state_fips using data/undevcap_inl.dta
+drop _merge
+
+egen hydro_1998 = rowtotal(instcap undevcap)
+
+gen log_hydro_1998 = ln(hydro_1998)
+
+compress
+save data/hydropot_1998.dta, replace
+
+
+
+clear all
+use data/hydropot_1931.dta, clear
+*data digitized from the Statistical Abstract
+*of the United States (U.S. DOC, 1931)
+
+merge 1:1 state_fips using data/hydropot_1998.dta
+drop _merge
+
+replace log_hydro_1998 = 0 if log_hydro_1998==.
+
+gen log_hydro_1931 = ln(hydro_potential_SA31_90)
+
+drop if state_fips==11
+
+
+reg log_hydro_1998 log_hydro_1931, robust
+
+corr log_hydro_1998 log_hydro_1931
+
+
+twoway (lfit log_hydro_1998 log_hydro_1931, lpattern(dash) lcolor(black)) /*
+*/ (scatter log_hydro_1998 log_hydro_1931, mlabel(state_code) m(i)), /*
+*/ ytitle(log_hydro_1998) xtitle(log_hydro_1931) legend(off) /*
+*/ text(1 4 "Slope: 0.91, t-statistic: 4.37", /*
+*/ place(e) fcolor(white) just(left)) /*
+*/ text(0.4 4 "R2: 0.66, Observations: 48, Correlation: 0.81", /*
+*/ place(e) fcolor(white) just(left)) /*
+*/ saving(graphs/AFig_B1.gph, replace)
+
+graph export graphs/AFig_B1.pdf, replace
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX FIGURE B.2
+********************************************************************************
+********************************************************************************
+
+*figure reproduced from McNerneya, Farmer and Trancik (2011)
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX FIGURE B.3
+********************************************************************************
+********************************************************************************
+
+*figure reproduced from Hales (1976)
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX FIGURE B.4
+********************************************************************************
+********************************************************************************
+clear all
+use data/sample_1870.dta, clear
+
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_b1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+drop _I*
+gen sample_b1950 = e(sample)
+
+
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_a1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+drop _I*
+gen sample_a1950 = e(sample)
+
+gen sample = (sample_b1950==1 | sample_a1950==1)
+keep if sample==1
+
+gen treatcontrol = 1 if treated_b1950==1
+replace treatcontrol = 2 if treated_a1950==1
+replace treatcontrol = 3 if treatcontrol==.
+
+keep reg_fips div_fips state_fips county_fips year year_treat latc1 lonc1 /*
+*/ treatcontrol treated_b1950 treated_a1950 falsetreat np_hpot np_pot /*
+*/ np_county np_county_year npff_county npff_county_year density dens_emp /*
+*/ lndensity lndens_emp
+
+compress
+sort county_fips
+save data/treat_control_counties_outcomes_1870.dta, replace
+
+
+clear all
+use data/treat_control_counties_outcomes_1870.dta, clear
+
+collapse lndensity lndens_emp, by(treatcontrol year)
+
+
+****************************************
+***PANEL A
+****************************************
+regaxis year, cycle(10) ltick(year)
+sort year
+
+twoway /*
+*/ (connected lndensity year if treatcontrol==1, sort mcolor(black) msymbol(circle) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected lndensity year if treatcontrol==2, sort mcolor(black) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(dash)) /*
+*/ (line lndensity year if treatcontrol==3, sort mcolor(black) lcolor(black) lwidth(thick) lpattern(solid)), /*
+*/ ytitle(ln(density)) ylabel(, angle(horizontal)) /*
+*/ xtitle("") xline(1950, lwidth(medium) lpattern(dash) lcolor(black)) xlabel(`year', angle(45)) /*
+*/ title(Panel A. Population) /*
+*/ legend(on order(1 "Treatment: Before-1950" 2 "Treatment: After-1950" 3 "Control") cols(1) position(5) ring(0)) /*
+*/ xsize(7) ysize(5) scale(0.9) /*
+*/ saving(graphs/AFig_B4a.gph, replace)
+
+
+****************************************
+***PANEL B
+****************************************
+regaxis year, cycle(10) ltick(year)
+sort year
+
+twoway /*
+*/ (connected lndens_emp year if treatcontrol==1, sort mcolor(black) msymbol(circle) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected lndens_emp year if treatcontrol==2, sort mcolor(black) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(dash)) /*
+*/ (line lndens_emp year if treatcontrol==3, sort mcolor(black) lcolor(black) lwidth(thick) lpattern(solid)), /*
+*/ ytitle(ln(density)) ylabel(, angle(horizontal)) /*
+*/ xtitle("") xline(1950, lwidth(medium) lpattern(dash) lcolor(black)) xlabel(`year', angle(45)) /*
+*/ title(Panel B. Employment) /*
+*/ legend(on order(1 "Treatment: Before-1950" 2 "Treatment: After-1950" 3 "Control") cols(1) position(5) ring(0)) /*
+*/ xsize(7) ysize(5) scale(0.9) /*
+*/ saving(graphs/AFig_B4b.gph, replace)
+
+
+****************************************
+***COMBINING PANELS
+****************************************
+graph combine /*
+*/ graphs/AFig_B4a.gph /*
+*/ graphs/AFig_B4b.gph, /*
+*/ xsize(10) ysize(5) scale(0.9) /*
+*/ saving(graphs/AFig_B4.gph, replace)
+
+graph export graphs/AFig_B4.pdf, replace
+
+erase graphs/AFig_B4a.gph
+erase graphs/AFig_B4b.gph
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX FIGURE B.5
+********************************************************************************
+********************************************************************************
+clear all
+use data/treat_control_counties_outcomes_1870.dta, clear
+*this dataset was created for Figure B.4
+
+collapse lndensity lndens_emp, by(treatcontrol year_treat year)
+
+
+****************************************
+***PANEL A
+****************************************
+regaxis year, cycle(10) ltick(year)
+sort year
+
+*Excluding 1910 (1 dam) and 1990 (2 dams)
+twoway /*
+*/ (connected lndensity year if (treatcontrol==1 & year_treat==1920), sort mcolor(black) msymbol(diamond) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected lndensity year if (treatcontrol==1 & year_treat==1930), sort mcolor(black) msymbol(square) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected lndensity year if (treatcontrol==1 & year_treat==1940), sort mcolor(black) msymbol(triangle) lcolor(black) lwidth(medium) lpattern(solid)) /*
+
+*/ (connected lndensity year if (treatcontrol==2 & year_treat==1950), sort mcolor(black) msymbol(circle_hollow) lcolor(black) lwidth(medium) lpattern(dash)) /*
+*/ (connected lndensity year if (treatcontrol==2 & year_treat==1960), sort mcolor(black) msymbol(diamond_hollow) lcolor(black) lwidth(medium) lpattern(dash)) /*
+*/ (connected lndensity year if (treatcontrol==2 & year_treat==1970), sort mcolor(black) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(dash)) /*
+*/ (connected lndensity year if (treatcontrol==2 & year_treat==1980), sort mcolor(black) msymbol(triangle_hollow) lcolor(black) lwidth(medium) lpattern(dash)) /*
+
+*/ (line lndensity year if treatcontrol==3, sort mcolor(black) lcolor(black) lwidth(thick) lpattern(solid)), /*
+
+*/ ytitle(ln(density)) ylabel(, angle(horizontal)) /*
+*/ xtitle("") xline(1950, lwidth(medium) lpattern(dash) lcolor(black)) xlabel(`year', angle(45)) /*
+*/ title(Panel A. Population) /*
+*/ legend(on order(1 "1920" 2 "1930" 3 "1940" 4 "1950" /*
+*/ 5 "1960" 6 "1970" 7 "1980" 8 "Control") cols(2) position(5) ring(0)) /*
+*/ xsize(7) ysize(5) scale(0.8) /*
+*/ saving(graphs/AFig_B5a.gph, replace)
+
+
+****************************************
+***PANEL B
+****************************************
+regaxis year, cycle(10) ltick(year)
+sort year
+
+*Excluding 1910 (1 dam) and 1990 (2 dams)
+twoway /*
+*/ (connected lndens_emp year if (treatcontrol==1 & year_treat==1920), sort mcolor(black) msymbol(diamond) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected lndens_emp year if (treatcontrol==1 & year_treat==1930), sort mcolor(black) msymbol(square) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected lndens_emp year if (treatcontrol==1 & year_treat==1940), sort mcolor(black) msymbol(triangle) lcolor(black) lwidth(medium) lpattern(solid)) /*
+
+*/ (connected lndens_emp year if (treatcontrol==2 & year_treat==1950), sort mcolor(black) msymbol(circle_hollow) lcolor(black) lwidth(medium) lpattern(dash)) /*
+*/ (connected lndens_emp year if (treatcontrol==2 & year_treat==1960), sort mcolor(black) msymbol(diamond_hollow) lcolor(black) lwidth(medium) lpattern(dash)) /*
+*/ (connected lndens_emp year if (treatcontrol==2 & year_treat==1970), sort mcolor(black) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(dash)) /*
+*/ (connected lndens_emp year if (treatcontrol==2 & year_treat==1980), sort mcolor(black) msymbol(triangle_hollow) lcolor(black) lwidth(medium) lpattern(dash)) /*
+
+*/ (line lndens_emp year if treatcontrol==3, sort mcolor(black) lcolor(black) lwidth(thick) lpattern(solid)), /*
+
+*/ ytitle(ln(density)) ylabel(, angle(horizontal)) /*
+*/ xtitle("") xline(1950, lwidth(medium) lpattern(dash) lcolor(black)) xlabel(`year', angle(45)) /*
+*/ title(Panel B. Employment) /*
+*/ legend(on order(1 "1920" 2 "1930" 3 "1940" 4 "1950" /*
+*/ 5 "1960" 6 "1970" 7 "1980" 8 "Control") cols(2) position(5) ring(0)) /*
+*/ xsize(7) ysize(5) scale(0.8) /*
+*/ saving(graphs/AFig_B5b.gph, replace)
+
+
+****************************************
+***COMBINING PANELS
+****************************************
+graph combine /*
+*/ graphs/AFig_B5a.gph /*
+*/ graphs/AFig_B5b.gph, /*
+*/ xsize(10) ysize(5) scale(0.9) /*
+*/ saving(graphs/AFig_B5.gph, replace)
+
+graph export graphs/AFig_B5.pdf, replace
+
+erase graphs/AFig_B5a.gph
+erase graphs/AFig_B5b.gph
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX FIGURE C.1
+********************************************************************************
+********************************************************************************
+clear all
+use data/sample_1870.dta, clear
+
+*Pre-1950 dams
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ if (treated_b1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TC_b1950geo_1870.dta, replace)
+
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ if (treated_b1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TC_b1950accessmarkets_1870.dta, replace)
+
+*Post-1950 dams
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ if (treated_a1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TC_a1950geo_1870.dta, replace)
+
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ if (treated_a1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TC_a1950accessmarkets_1870.dta, replace)
+
+
+
+clear all
+foreach var in TC_b1950 TC_b1950geo TC_b1950accessmarkets /*
+*/ TC_a1950 TC_a1950geo TC_a1950accessmarkets {
+
+clear
+use data/parmest/`var'_1870.dta, clear
+
+gen evtime = -100 if parm=="evtime100b"
+replace evtime = -90 if parm=="evtime90b"
+replace evtime = -80 if parm=="evtime80b"
+replace evtime = -70 if parm=="evtime70b"
+replace evtime = -60 if parm=="evtime60b"
+replace evtime = -50 if parm=="evtime50b"
+replace evtime = -40 if parm=="evtime40b"
+replace evtime = -30 if parm=="evtime30b"
+replace evtime = -20 if parm=="evtime20b"
+replace evtime = 0 if parm=="evtime0"
+replace evtime = 10 if parm=="evtime10a"
+replace evtime = 20 if parm=="evtime20a"
+replace evtime = 30 if parm=="evtime30a"
+replace evtime = 40 if parm=="evtime40a"
+replace evtime = 50 if parm=="evtime50a"
+replace evtime = 60 if parm=="evtime60a"
+replace evtime = 70 if parm=="evtime70a"
+replace evtime = 80 if parm=="evtime80a"
+
+keep if evtime~=.
+
+local new = _N + 1
+set obs `new'
+
+ren estimate c`var'
+ren min95 l`var'
+ren max95 u`var'
+
+keep evtime c`var' l`var' u`var'
+order evtime c`var' l`var' u`var'
+
+replace evtime = -10 if evtime==.
+replace c`var' = 0 if c`var'==.
+replace l`var' = 0 if l`var'==.
+replace u`var' = 0 if u`var'==.
+
+compress
+sort evtime
+save graphs/data/`var'_1870.dta, replace
+}
+
+
+clear all
+use graphs/data/evtime_1870.dta, clear
+
+foreach var in TC_b1950 TC_b1950geo TC_b1950accessmarkets /*
+*/ TC_a1950 TC_a1950geo TC_a1950accessmarkets {
+
+merge 1:1 evtime using graphs/data/`var'_1870.dta
+drop _merge
+sort evtime
+}
+
+compress
+sort evtime
+
+
+keep if (evtime>=-90 & evtime<=70)
+
+egen ymax_aux = rowmax(cTC_* uTC_b1950 uTC_a1950)
+egen ymin_aux = rowmin(cTC_* lTC_b1950 lTC_a1950)
+
+egen ymax = max(ymax_aux)
+egen ymin = min(ymin_aux)
+
+gen yscale = ymin if evtime<=0
+replace yscale = ymax if evtime>0
+
+drop ymax_aux-ymin
+
+regaxis evtime, cycle(10) ltick(evtime)
+regaxis yscale, cycle(0.2) ltick(yscale)
+
+sort evtime
+
+
+****************************************
+***PANEL A
+****************************************
+twoway /*
+*/ (rarea uTC_b1950 lTC_b1950 evtime if evtime>=-60, sort fcolor(bluishgray) lcolor(bluishgray) lwidth(none)) /*
+*/ (connected cTC_b1950geo evtime if evtime>=-60, sort mcolor(black) msymbol(triangle_hollow) lcolor(black) lwidth(medium) lpattern(dash)) /*
+*/ (connected cTC_b1950accessmarkets evtime if evtime>=-60, sort mcolor(black) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(longdash)) /*
+*/ (connected cTC_b1950 evtime if evtime>=-60, sort mcolor(black) msymbol(circle) lcolor(black) lwidth(medthick) lpattern(solid)), /*
+*/ ytitle(ln(PopDensity)) ylabel(`yscale', angle(horizontal)) /*
+*/ xtitle(Years Relative to Dam Completion) xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(-10, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(-60(10)70) /*
+*/ subtitle(Panel A. Pre-1950 Dams) /*
+*/ legend(on order(2 "Basic Specification" "(FEs + Geography)" 3 "+ Access to Markets" /*
+*/ 4 "+ Steam Power Plants" " (Main Specification)") cols(1) position(5) ring(0)) /*
+*/ xsize(6.5) ysize(5) scale(0.9) /*
+*/ saving(graphs/AFig_C1a.gph, replace)
+
+****************************************
+***PANEL B
+****************************************
+twoway /*
+*/ (rarea uTC_a1950 lTC_a1950 evtime if evtime<=50, sort fcolor(bluishgray) lcolor(bluishgray) lwidth(none)) /*
+*/ (connected cTC_a1950geo evtime if evtime<=50, sort mcolor(black) msymbol(triangle_hollow) lcolor(black) lwidth(medium) lpattern(dash)) /*
+*/ (connected cTC_a1950accessmarkets evtime if evtime<=50, sort mcolor(black) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(longdash)) /*
+*/ (connected cTC_a1950 evtime if evtime<=50, sort mcolor(black) msymbol(circle) lcolor(black) lwidth(medthick) lpattern(solid)), /*
+*/ ytitle(ln(PopDensity)) ylabel(`yscale', angle(horizontal)) /*
+*/ xtitle(Years Relative to Dam Completion) xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(-10, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(-90(10)50) /*
+*/ subtitle(Panel B. Post-1950 Dams) /*
+*/ legend(on order(2 "Basic Specification" "(FEs + Geography)" 3 "+ Access to Markets" /*
+*/ 4 "+ Steam Power Plants" " (Main Specification)") cols(1) position(5) ring(0)) /*
+*/ xsize(6.5) ysize(5) scale(0.9) /*
+*/ saving(graphs/AFig_C1b.gph, replace)
+
+****************************************
+***COMBINING PANELS
+****************************************
+graph combine graphs/AFig_C1a.gph graphs/AFig_C1b.gph, /*
+*/ xsize(10) ysize(5) scale(1) /*
+*/ saving(graphs/AFig_C1.gph, replace)
+
+graph export graphs/AFig_C1.pdf, replace
+
+erase graphs/AFig_C1a.gph
+erase graphs/AFig_C1b.gph
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX FIGURE C.2
+********************************************************************************
+********************************************************************************
+clear all
+use data/sample_unbalanced_1870.dta, clear
+
+*Pre-1950 dams
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_b1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TCunbal_b1950_1870.dta, replace)
+
+*Post-1950 dams
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_a1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TCunbal_a1950_1870.dta, replace)
+
+
+
+clear all
+foreach var in TCunbal_b1950 TCunbal_a1950 {
+
+clear
+use data/parmest/`var'_1870.dta, clear
+
+gen evtime = -100 if parm=="evtime100b"
+replace evtime = -90 if parm=="evtime90b"
+replace evtime = -80 if parm=="evtime80b"
+replace evtime = -70 if parm=="evtime70b"
+replace evtime = -60 if parm=="evtime60b"
+replace evtime = -50 if parm=="evtime50b"
+replace evtime = -40 if parm=="evtime40b"
+replace evtime = -30 if parm=="evtime30b"
+replace evtime = -20 if parm=="evtime20b"
+replace evtime = 0 if parm=="evtime0"
+replace evtime = 10 if parm=="evtime10a"
+replace evtime = 20 if parm=="evtime20a"
+replace evtime = 30 if parm=="evtime30a"
+replace evtime = 40 if parm=="evtime40a"
+replace evtime = 50 if parm=="evtime50a"
+replace evtime = 60 if parm=="evtime60a"
+replace evtime = 70 if parm=="evtime70a"
+replace evtime = 80 if parm=="evtime80a"
+
+keep if evtime~=.
+
+local new = _N + 1
+set obs `new'
+
+ren estimate c`var'
+ren min95 l`var'
+ren max95 u`var'
+
+keep evtime c`var' l`var' u`var'
+order evtime c`var' l`var' u`var'
+
+replace evtime = -10 if evtime==.
+replace c`var' = 0 if c`var'==.
+replace l`var' = 0 if l`var'==.
+replace u`var' = 0 if u`var'==.
+
+compress
+sort evtime
+save graphs/data/`var'_1870.dta, replace
+}
+
+
+clear all
+use graphs/data/evtime_1870.dta, clear
+
+foreach var in TCunbal_b1950 TCunbal_a1950 {
+
+merge 1:1 evtime using graphs/data/`var'_1870.dta
+drop _merge
+sort evtime
+}
+
+compress
+sort evtime
+
+
+keep if (evtime>=-90 & evtime<=70)
+
+egen ymax_aux = rowmax(uTCunbal_b1950 uTCunbal_a1950)
+egen ymin_aux = rowmin(lTCunbal_b1950 lTCunbal_a1950)
+
+egen ymax = max(ymax_aux)
+egen ymin = min(ymin_aux)
+
+gen yscale = ymin if evtime<=0
+replace yscale = ymax if evtime>0
+
+drop ymax_aux-ymin
+
+regaxis evtime, cycle(10) ltick(evtime)
+regaxis yscale, cycle(0.2) ltick(yscale)
+
+sort evtime
+
+
+****************************************
+***PANEL A
+****************************************
+twoway /*
+*/ (rarea uTCunbal_b1950 lTCunbal_b1950 evtime if (evtime>=-60 & evtime<=70), sort fcolor(bluishgray) lcolor(bluishgray) lwidth(none)) /*
+*/ (connected cTCunbal_b1950 evtime if (evtime>=-60 & evtime<=70), sort mcolor(black) msize(small) msymbol(circle) lcolor(black) lwidth(medium) lpattern(solid)), /*
+*/ ytitle(ln(PopDensity)) ylabel(-0.4(0.2)1.4, angle(horizontal)) /*
+*/ xtitle(Years Relative to Dam Completion) xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(-10, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(-60(10)70) /*
+*/ subtitle(Panel A. Pre-1950 Dams) /*
+*/ legend(off) /*
+*/ xsize(6.5) ysize(5) scale(0.9) /*
+*/ saving(graphs/AFig_C2a.gph, replace)
+
+****************************************
+***PANEL B
+****************************************
+twoway /*
+*/ (rarea uTCunbal_a1950 lTCunbal_a1950 evtime if (evtime>=-90 & evtime<=50), sort fcolor(yellow) lcolor(yellow) lwidth(none)) /*
+*/ (connected cTCunbal_a1950 evtime if (evtime>=-90 & evtime<=50), sort mcolor(black) msize(small) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(dash)), /*
+*/ ytitle(ln(PopDensity)) ylabel(-0.4(0.2)1.4, angle(horizontal)) /*
+*/ xtitle(Years Relative to Dam Completion) xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(-10, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(-90(10)50) /*
+*/ subtitle(Panel B. Post-1950 Dams) /*
+*/ legend(off) /*
+*/ xsize(6.5) ysize(5) scale(0.9) /*
+*/ saving(graphs/AFig_C2b.gph, replace)
+
+****************************************
+***COMBINING PANELS
+****************************************
+graph combine graphs/AFig_C2a.gph graphs/AFig_C2b.gph, /*
+*/ xsize(10) ysize(5) scale(1.1) /*
+*/ saving(graphs/AFig_C2.gph, replace)
+
+graph export graphs/AFig_C2.pdf, replace
+
+erase graphs/AFig_C2a.gph
+erase graphs/AFig_C2b.gph
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX FIGURE C.3
+********************************************************************************
+********************************************************************************
+
+****************************************
+***PANEL A
+****************************************
+
+*CONSTRUCTING CLUSTERS BASED ON THE WEIGHTS FOR THE SYNTHETIC CONTROLS
+clear all
+use data/sample_b1950_1870.dta, clear
+*this dataset was created in the analysis for Figure 8
+
+bysort idcase county_fips: gen n = _n
+keep if n==1
+
+keep county_fips idcase idts id state_fips state_name county_name weight
+
+gen cname=substr(county_name, 1, 1)+ lower(substr(county_name, 2, .))
+replace county_name = cname
+drop cname
+
+*creating alternative clusters: all cases sharing a county from the donor
+*pool, whose weight in the synthetic control is 0.50 and above
+gen hweight = (weight>=0.5 & weight~=1)
+
+bysort hweight county_fips: gen Ncase = _N
+replace Ncase = . if hweight==0 | (hweight==1 & Ncase==1)
+
+egen cluster_aux = group(hweight county_fips Ncase)
+replace cluster_aux = cluster_aux*100
+bysort idcase: egen cluster = max(cluster_aux)
+replace cluster = idcase if cluster==.
+drop hweight Ncase cluster_aux
+
+bysort idcase: gen ncase = _n
+keep if ncase==1
+drop ncase
+
+compress
+sort idcase idts county_fips
+save data/newclusters_b1950_1870.dta, replace
+
+*RUNNING THE EVENT STUDY - SYNTHETIC CONTROL WITH NEW CLUSTERS
+clear all
+use data/sample_b1950_agg_1870.dta, clear
+*this dataset was also created in the analysis for Figure 8
+
+merge m:1 idcase using data/newclusters_b1950_1870.dta
+drop _merge
+
+reg lndensity _I* /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3, /*
+*/ cluster(cluster) level(95)
+
+parmest, saving(data/parmest/TScluster_b1950_1870.dta, replace)
+
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ keep(evtime100b-evtime20b evtime0-evtime80a) /*
+*/ ctitle(ATE1_c1) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+
+
+clear all
+foreach var in TScluster_b1950 {
+
+clear
+use data/parmest/`var'_1870.dta, clear
+
+gen evtime = -100 if parm=="evtime100b"
+replace evtime = -90 if parm=="evtime90b"
+replace evtime = -80 if parm=="evtime80b"
+replace evtime = -70 if parm=="evtime70b"
+replace evtime = -60 if parm=="evtime60b"
+replace evtime = -50 if parm=="evtime50b"
+replace evtime = -40 if parm=="evtime40b"
+replace evtime = -30 if parm=="evtime30b"
+replace evtime = -20 if parm=="evtime20b"
+replace evtime = 0 if parm=="evtime0"
+replace evtime = 10 if parm=="evtime10a"
+replace evtime = 20 if parm=="evtime20a"
+replace evtime = 30 if parm=="evtime30a"
+replace evtime = 40 if parm=="evtime40a"
+replace evtime = 50 if parm=="evtime50a"
+replace evtime = 60 if parm=="evtime60a"
+replace evtime = 70 if parm=="evtime70a"
+replace evtime = 80 if parm=="evtime80a"
+
+keep if evtime~=.
+
+local new = _N + 1
+set obs `new'
+
+ren estimate c`var'
+ren min95 l`var'
+ren max95 u`var'
+
+keep evtime c`var' l`var' u`var'
+order evtime c`var' l`var' u`var'
+
+replace evtime = -10 if evtime==.
+replace c`var' = 0 if c`var'==.
+replace l`var' = 0 if l`var'==.
+replace u`var' = 0 if u`var'==.
+
+compress
+sort evtime
+save graphs/data/`var'_1870.dta, replace
+}
+
+
+clear all
+use graphs/data/evtime_1870.dta, clear
+
+foreach var in TScluster_b1950 {
+
+merge 1:1 evtime using graphs/data/`var'_1870.dta
+drop _merge
+sort evtime
+}
+
+compress
+sort evtime
+
+
+keep if (evtime>=-90 & evtime<=70)
+
+regaxis evtime, cycle(10) ltick(evtime)
+
+sort evtime
+
+
+twoway /*
+*/ (rarea uTScluster_b1950 lTScluster_b1950 evtime if (evtime>=-60 & evtime<=70), sort fcolor(bluishgray) lcolor(bluishgray) lwidth(none)) /*
+*/ (connected cTScluster_b1950 evtime if (evtime>=-60 & evtime<=70), sort mcolor(black) msize(small) msymbol(circle) lcolor(black) lwidth(medium) lpattern(solid)), /*
+*/ ytitle(ln(PopDensity)) ylabel(-0.4(0.2)1.4, angle(horizontal)) /*
+*/ xtitle(Years Relative to Dam Completion) xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(-10, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(-60(10)70) /*
+*/ subtitle(Panel A. Pre-1950 Dams) /*
+*/ legend(off) /*
+*/ xsize(6.5) ysize(5) scale(0.9) /*
+*/ saving(graphs/AFig_C3a.gph, replace)
+
+
+****************************************
+***PANEL B
+****************************************
+
+*CONSTRUCTING CLUSTERS BASED ON THE WEIGHTS FOR THE SYNTHETIC CONTROLS
+clear all
+use data/sample_a1950_1870.dta, clear
+*this dataset was created in the analysis for Figure 8
+
+bysort idcase county_fips: gen n = _n
+keep if n==1
+
+keep county_fips idcase idts id state_fips state_name county_name weight
+
+gen cname=substr(county_name, 1, 1)+ lower(substr(county_name, 2, .))
+replace county_name = cname
+drop cname
+
+*creating alternative clusters: all cases sharing a county from the donor
+*pool, whose weight in the synthetic control is 0.50 and above
+gen hweight = (weight>=0.5 & weight~=1)
+
+bysort hweight county_fips: gen Ncase = _N
+replace Ncase = . if hweight==0 | (hweight==1 & Ncase==1)
+
+egen cluster_aux = group(hweight county_fips Ncase)
+replace cluster_aux = cluster_aux*100
+bysort idcase: egen cluster = max(cluster_aux)
+replace cluster = idcase if cluster==.
+drop hweight Ncase cluster_aux
+
+bysort idcase: gen ncase = _n
+keep if ncase==1
+drop ncase
+
+compress
+sort idcase idts county_fips
+save data/newclusters_a1950_1870.dta, replace
+
+
+*RUNNING THE EVENT STUDY - SYNTHETIC CONTROL WITH NEW CLUSTERS
+clear all
+use data/sample_a1950_agg_1870.dta, clear
+*this dataset was also created in the analysis for Figure 8
+
+merge m:1 idcase using data/newclusters_a1950_1870.dta
+drop _merge
+
+reg lndensity _I* /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3, /*
+*/ cluster(cluster) level(95)
+
+parmest, saving(data/parmest/TScluster_a1950_1870.dta, replace)
+
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ keep(evtime100b-evtime20b evtime0-evtime80a) /*
+*/ ctitle(ATE1_c2) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+
+
+clear all
+foreach var in TScluster_a1950 {
+
+clear
+use data/parmest/`var'_1870.dta, clear
+
+gen evtime = -100 if parm=="evtime100b"
+replace evtime = -90 if parm=="evtime90b"
+replace evtime = -80 if parm=="evtime80b"
+replace evtime = -70 if parm=="evtime70b"
+replace evtime = -60 if parm=="evtime60b"
+replace evtime = -50 if parm=="evtime50b"
+replace evtime = -40 if parm=="evtime40b"
+replace evtime = -30 if parm=="evtime30b"
+replace evtime = -20 if parm=="evtime20b"
+replace evtime = 0 if parm=="evtime0"
+replace evtime = 10 if parm=="evtime10a"
+replace evtime = 20 if parm=="evtime20a"
+replace evtime = 30 if parm=="evtime30a"
+replace evtime = 40 if parm=="evtime40a"
+replace evtime = 50 if parm=="evtime50a"
+replace evtime = 60 if parm=="evtime60a"
+replace evtime = 70 if parm=="evtime70a"
+replace evtime = 80 if parm=="evtime80a"
+
+keep if evtime~=.
+
+local new = _N + 1
+set obs `new'
+
+ren estimate c`var'
+ren min95 l`var'
+ren max95 u`var'
+
+keep evtime c`var' l`var' u`var'
+order evtime c`var' l`var' u`var'
+
+replace evtime = -10 if evtime==.
+replace c`var' = 0 if c`var'==.
+replace l`var' = 0 if l`var'==.
+replace u`var' = 0 if u`var'==.
+
+compress
+sort evtime
+save graphs/data/`var'_1870.dta, replace
+}
+
+
+clear all
+use graphs/data/evtime_1870.dta, clear
+
+foreach var in TScluster_a1950 {
+
+merge 1:1 evtime using graphs/data/`var'_1870.dta
+drop _merge
+sort evtime
+}
+
+compress
+sort evtime
+
+
+keep if (evtime>=-90 & evtime<=70)
+
+regaxis evtime, cycle(10) ltick(evtime)
+
+sort evtime
+
+twoway /*
+*/ (rarea uTScluster_a1950 lTScluster_a1950 evtime if (evtime>=-90 & evtime<=50), sort fcolor(yellow) lcolor(yellow) lwidth(none)) /*
+*/ (connected cTScluster_a1950 evtime if (evtime>=-90 & evtime<=50), sort mcolor(black) msize(small) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(dash)), /*
+*/ ytitle(ln(PopDensity)) ylabel(-0.4(0.2)1.4, angle(horizontal)) /*
+*/ xtitle(Years Relative to Dam Completion) xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(-10, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(-90(10)50) /*
+*/ subtitle(Panel B. Post-1950 Dams) /*
+*/ legend(off) /*
+*/ xsize(6.5) ysize(5) scale(0.9) /*
+*/ saving(graphs/AFig_C3b.gph, replace)
+
+
+****************************************
+***COMBINING PANELS
+****************************************
+graph combine graphs/AFig_C3a.gph graphs/AFig_C3b.gph, /*
+*/ xsize(10) ysize(5) scale(1.1) /*
+*/ saving(graphs/AFig_C3.gph, replace)
+
+graph export graphs/AFig_C3.pdf, replace
+
+erase graphs/AFig_C3a.gph
+erase graphs/AFig_C3b.gph
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX FIGURE C.4
+********************************************************************************
+********************************************************************************
+forvalues p = 1(1)100 {
+clear all
+use data/sample_1870.dta, clear
+
+set seed `p'
+
+
+capture drop n
+bysort county_fips: gen n = _n
+
+sum treated_b1950 if (treated_b1950==1 & n==1)
+scalar ntreat_b1950 = r(N)
+
+sum treated_a1950 if (treated_a1950==1 & n==1)
+scalar ntreat_a1950 = r(N)
+
+drop year_treat treated_b1950 treated_a1950 falsetreat treated_ba1950 evtime evtime100b-evtime80a n
+
+
+gen rand = (100*uniform())
+bysort county_fips: egen maxrand = max(rand)
+
+gen rand_b1950 = rand if (year>1900 & year<1950)
+bysort county_fips: egen maxrand_b1950 = max(rand_b1950)
+
+gen rand_a1950 = rand if (year>=1950 & year<2000)
+bysort county_fips: egen maxrand_a1950 = max(rand_a1950)
+
+gsort - maxrand + year
+capture drop n
+gen n = _n
+
+gen treated_b1950 = (n<=(ntreat_b1950*15))
+gen treated_a1950 = (n>(ntreat_b1950*15) & n<=((ntreat_b1950*15)+(ntreat_a1950*15)))
+gen falsetreat = (n>((ntreat_b1950*15)+(ntreat_a1950*15)))
+drop n
+
+replace treated_b1950 = . if treated_a1950==1
+replace treated_a1950 = . if treated_b1950==1
+
+gen treated_ba1950 = 1 if treated_b1950==1
+replace treated_ba1950 = 0 if treated_a1950==1
+
+gen year_treat_b1950_aux = year if (rand_b1950==maxrand_b1950)
+gen year_treat_a1950_aux = year if (rand_a1950==maxrand_a1950)
+bysort county_fips: egen year_treat_b1950 = max(year_treat_b1950_aux)
+bysort county_fips: egen year_treat_a1950 = max(year_treat_a1950_aux)
+gen year_treat = year_treat_b1950 if treated_b1950==1
+replace year_treat = year_treat_a1950 if treated_a1950==1
+replace year_treat = 0 if year_treat==.
+drop year_treat_b1950_aux year_treat_a1950_aux year_treat_b1950 year_treat_a1950
+
+
+gen evtime = year - year_treat
+
+replace evtime = . if evtime>100
+replace evtime = -100 if (evtime==-110 |evtime==-120)
+replace evtime = 80 if (evtime==90 |evtime==100)
+*I'm grouping 80 and 90 because there were few 1's for 90. Same for -110 and -120.
+
+tab evtime, gen(evtime)
+
+forvalues i=1(1)19 {
+ replace evtime`i' = 0 if evtime`i'==.
+}
+
+ren evtime1 evtime100b
+ren evtime2 evtime90b
+ren evtime3 evtime80b
+ren evtime4 evtime70b
+ren evtime5 evtime60b
+ren evtime6 evtime50b
+ren evtime7 evtime40b
+ren evtime8 evtime30b
+ren evtime9 evtime20b
+ren evtime10 evtime10b
+ren evtime11 evtime0
+ren evtime12 evtime10a
+ren evtime13 evtime20a
+ren evtime14 evtime30a
+ren evtime15 evtime40a
+ren evtime16 evtime50a
+ren evtime17 evtime60a
+ren evtime18 evtime70a
+ren evtime19 evtime80a
+
+foreach var of varlist evtime100b-evtime80a {
+ label var `var' ""
+}
+
+compress
+sort county_fips year
+save data/samplep`p'_1870.dta, replace
+
+
+*Pre-1950 dams
+clear all
+use data/samplep`p'_1870.dta, clear
+
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_b1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+drop _I*
+
+capture drop sample_b1950
+gen sample_b1950 = e(sample)
+keep if sample_b1950==1
+
+capture drop n
+bysort county_fips: gen n=_n
+
+tab treated_b1950 if n==1
+tab year_treat if (year_treat>0 & n==1)
+
+tab state_name if (n==1 & treated_b1950==1)
+tab state_name if (n==1 & treated_b1950==0)
+
+sum treated_b1950 if (treated_b1950==0 & n==1)
+local ncontrol = r(N)
+
+sum year_treat if (year_treat>0 & n==1)
+local miny_treat = r(min)
+local maxy_treat = r(max)
+
+forvalues i=`miny_treat'(10)`maxy_treat' {
+ sum year_treat if (year_treat==`i' & n==1)
+ scalar ntreat`i' = r(N)
+}
+
+
+capture drop n
+bysort treated_b1950 county_fips: gen n = _n
+replace n = . if n>1
+
+sort n treated_b1950 year_treat county_fips
+bysort n treated_b1950: gen n2 = _n
+replace n2 = . if n==.
+
+gen n3 = _n
+replace n3 = . if n==.
+
+bysort county_fips: egen id = max(n3)
+
+drop n n2 n3
+
+compress
+order county_fips id year
+
+tsset id year
+
+sort id year
+save data/samplep`p'_b1950_1870.dta, replace
+save data/samplep`p'_b1950_merge_1870.dta, replace
+
+
+clear
+use data/samplep`p'_b1950_merge_1870.dta, clear
+
+local l_1910 = `ncontrol' + 1
+local u_1910 = `ncontrol' + ntreat1910
+forvalues i=`l_1910'(1)`u_1910' {
+ synth lndensity lndensity(1870) lndensity(1880) lndensity(1890) lndensity(1900) lndensity(1910) /*
+ */ latc1 lonc1 latc2 lonc2 latc3 lonc3 reg1 reg2 reg3 reg4 railtrack waterway distnearmsa_miles inst1944 mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1, /*
+ */ trunit(`i') counit(1(1)`ncontrol') trperiod(1920) keep(synth`i'_1870, replace)
+}
+
+local l_1920 = `u_1910' + 1
+local u_1920 = `u_1910' + ntreat1920
+forvalues i=`l_1920'(1)`u_1920' {
+ synth lndensity lndensity(1870) lndensity(1880) lndensity(1890) lndensity(1900) lndensity(1910) lndensity(1920) /*
+ */ latc1 lonc1 latc2 lonc2 latc3 lonc3 reg1 reg2 reg3 reg4 railtrack waterway distnearmsa_miles inst1944 mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1, /*
+ */ trunit(`i') counit(1(1)`ncontrol') trperiod(1930) keep(synth`i'_1870, replace)
+}
+
+local l_1930 = `u_1920' + 1
+local u_1930 = `u_1920' + ntreat1930
+forvalues i=`l_1930'(1)`u_1930' {
+ synth lndensity lndensity(1870) lndensity(1880) lndensity(1890) lndensity(1900) lndensity(1910) lndensity(1920) lndensity(1930) /*
+ */ latc1 lonc1 latc2 lonc2 latc3 lonc3 reg1 reg2 reg3 reg4 railtrack waterway distnearmsa_miles inst1944 mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1, /*
+ */ trunit(`i') counit(1(1)`ncontrol') trperiod(1940) keep(synth`i'_1870, replace)
+}
+
+local l_1940 = `u_1930' + 1
+local u_1940 = `u_1930' + ntreat1940
+forvalues i=`l_1940'(1)`u_1940' {
+ synth lndensity lndensity(1870) lndensity(1880) lndensity(1890) lndensity(1900) lndensity(1910) lndensity(1920) lndensity(1930) lndensity(1940) /*
+ */ latc1 lonc1 latc2 lonc2 latc3 lonc3 reg1 reg2 reg3 reg4 railtrack waterway distnearmsa_miles inst1944 mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1, /*
+ */ trunit(`i') counit(1(1)`ncontrol') trperiod(1950) keep(synth`i'_1870,replace)
+}
+
+
+
+clear
+forvalues i=`l_1910'(1)`u_1940' {
+ clear
+ use synth`i'_1870.dta, clear
+ keep _Co_Number _W_Weight
+ ren _Co_Number id
+ ren _W_Weight weight
+ save synth`i'tomerge_1870.dta, replace
+
+ clear
+ use data/samplep`p'_b1950_merge_1870.dta, clear
+ sort id
+ merge m:1 id using synth`i'tomerge_1870.dta
+ drop _merge
+ gen id2 = `i'
+ save data/synth`i'toappend_1870.dta, replace
+
+ clear
+ erase synth`i'_1870.dta
+ erase synth`i'tomerge_1870.dta
+}
+
+clear
+use data/samplep`p'_b1950_merge_1870.dta, clear
+
+forvalues i=`l_1910'(1)`u_1940' {
+ append using data/synth`i'toappend_1870.dta
+ erase data/synth`i'toappend_1870.dta
+}
+
+order county_fips id id2
+
+drop if id2==.
+drop if id2~=id & weight==.
+
+replace weight = 1 if weight==.
+drop if weight==0
+
+gen idts = id2 if id2==id
+replace idts = id2*1000 if id2~=id
+*idts: id treat x synth control
+
+gen idcase = idts
+replace idcase = idts/1000 if idts>999
+
+drop id2
+order county_fips idcase idts id year
+
+compress
+sort idcase idts id year
+save data/samplep`p'_b1950_1870.dta, replace
+
+
+clear
+use data/samplep`p'_b1950_1870.dta, clear
+
+xi: reg lndensity i.county_fips i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3, /*
+*/ cluster(county_fips) level(95)
+
+foreach var of varlist lndensity _I* /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 {
+ replace `var' = `var'*weight
+}
+
+collapse idcase (sum) lndensity _I* /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3, by(idts year)
+
+foreach var of varlist idcase lndensity _I* /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 {
+ label var `var' ""
+}
+
+reg lndensity _I* /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3, /*
+*/ cluster(idcase) level(95)
+
+parmest, saving(data/parmest/TSp`p'_b1950_1870.dta, replace)
+
+
+
+*Post-1950 dams
+clear all
+use data/samplep`p'_1870.dta, clear
+
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_a1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+drop _I*
+
+capture drop sample_a1950
+gen sample_a1950 = e(sample)
+keep if sample_a1950==1
+
+capture drop n
+bysort county_fips: gen n=_n
+
+tab treated_a1950 if n==1
+tab year_treat if (year_treat>0 & n==1)
+
+tab state_name if (n==1 & treated_a1950==1)
+tab state_name if (n==1 & treated_a1950==0)
+
+sum treated_a1950 if (treated_a1950==0 & n==1)
+local ncontrol = r(N)
+
+sum year_treat if (year_treat>0 & n==1)
+local miny_treat = r(min)
+local maxy_treat = r(max)
+
+forvalues i=`miny_treat'(10)`maxy_treat' {
+ sum year_treat if (year_treat==`i' & n==1)
+ scalar ntreat`i' = r(N)
+}
+
+
+
+drop n
+bysort treated_a1950 county_fips: gen n = _n
+replace n = . if n>1
+
+sort n treated_a1950 year_treat county_fips
+bysort n treated_a1950: gen n2 = _n
+replace n2 = . if n==.
+
+gen n3 = _n
+replace n3 = . if n==.
+
+bysort county_fips: egen id = max(n3)
+
+drop n n2 n3
+
+compress
+order county_fips id year
+
+tsset id year
+
+sort id year
+save data/samplep`p'_a1950_1870.dta, replace
+save data/samplep`p'_a1950_merge_1870.dta, replace
+
+
+clear
+use data/samplep`p'_a1950_merge_1870.dta, clear
+
+local l_1950 = `ncontrol' + 1
+local u_1950 = `ncontrol' + ntreat1950
+forvalues i=`l_1950'(1)`u_1950' {
+ synth lndensity lndensity(1870) lndensity(1880) lndensity(1890) lndensity(1900) lndensity(1910) lndensity(1920) lndensity(1930) lndensity(1940) /*
+ */ lndensity(1950) /*
+ */ latc1 lonc1 latc2 lonc2 latc3 lonc3 reg1 reg2 reg3 reg4 railtrack waterway distnearmsa_miles inst1944 mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1, /*
+ */ trunit(`i') counit(1(1)`ncontrol') trperiod(1960) keep(synth`i'_1870,replace)
+}
+
+local l_1960 = `u_1950' + 1
+local u_1960 = `u_1950' + ntreat1960
+forvalues i=`l_1960'(1)`u_1960' {
+ synth lndensity lndensity(1870) lndensity(1880) lndensity(1890) lndensity(1900) lndensity(1910) lndensity(1920) lndensity(1930) lndensity(1940) /*
+ */ lndensity(1950) lndensity(1960) /*
+ */ latc1 lonc1 latc2 lonc2 latc3 lonc3 reg1 reg2 reg3 reg4 railtrack waterway distnearmsa_miles inst1944 mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1, /*
+ */ trunit(`i') counit(1(1)`ncontrol') trperiod(1970) keep(synth`i'_1870,replace)
+}
+
+local l_1970 = `u_1960' + 1
+local u_1970 = `u_1960' + ntreat1970
+forvalues i=`l_1970'(1)`u_1970' {
+ synth lndensity lndensity(1870) lndensity(1880) lndensity(1890) lndensity(1900) lndensity(1910) lndensity(1920) lndensity(1930) lndensity(1940) /*
+ */ lndensity(1950) lndensity(1960) lndensity(1970) /*
+ */ latc1 lonc1 latc2 lonc2 latc3 lonc3 reg1 reg2 reg3 reg4 railtrack waterway distnearmsa_miles inst1944 mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1, /*
+ */ trunit(`i') counit(1(1)`ncontrol') trperiod(1980) keep(synth`i'_1870,replace)
+}
+
+local l_1980 = `u_1970' + 1
+local u_1980 = `u_1970' + ntreat1980
+forvalues i=`l_1980'(1)`u_1980' {
+ synth lndensity lndensity(1870) lndensity(1880) lndensity(1890) lndensity(1900) lndensity(1910) lndensity(1920) lndensity(1930) lndensity(1940) /*
+ */ lndensity(1950) lndensity(1960) lndensity(1970) lndensity(1980) /*
+ */ latc1 lonc1 latc2 lonc2 latc3 lonc3 reg1 reg2 reg3 reg4 railtrack waterway distnearmsa_miles inst1944 mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1, /*
+ */ trunit(`i') counit(1(1)`ncontrol') trperiod(1990) keep(synth`i'_1870,replace)
+}
+
+local l_1990 = `u_1980' + 1
+local u_1990 = `u_1980' + ntreat1990
+forvalues i=`l_1990'(1)`u_1990' {
+ synth lndensity lndensity(1870) lndensity(1880) lndensity(1890) lndensity(1900) lndensity(1910) lndensity(1920) lndensity(1930) lndensity(1940) /*
+ */ lndensity(1950) lndensity(1960) lndensity(1970) lndensity(1980) lndensity(1990) /*
+ */ latc1 lonc1 latc2 lonc2 latc3 lonc3 reg1 reg2 reg3 reg4 railtrack waterway distnearmsa_miles inst1944 mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1, /*
+ */ trunit(`i') counit(1(1)`ncontrol') trperiod(2000) keep(synth`i'_1870,replace)
+}
+
+
+clear
+forvalues i=`l_1950'(1)`u_1990' {
+ clear
+ use synth`i'_1870.dta, clear
+ keep _Co_Number _W_Weight
+ ren _Co_Number id
+ ren _W_Weight weight
+ save synth`i'tomerge_1870.dta, replace
+
+ clear
+ use data/samplep`p'_a1950_merge_1870.dta, clear
+ sort id
+ merge m:1 id using synth`i'tomerge_1870.dta
+ drop _merge
+ gen id2 = `i'
+ save data/synth`i'toappend_1870.dta, replace
+
+ clear
+ erase synth`i'_1870.dta
+ erase synth`i'tomerge_1870.dta
+}
+
+clear
+use data/samplep`p'_a1950_merge_1870.dta, clear
+
+forvalues i=`l_1950'(1)`u_1990' {
+ append using data/synth`i'toappend_1870.dta
+ erase data/synth`i'toappend_1870.dta
+}
+
+order county_fips id id2
+
+drop if id2==.
+drop if id2~=id & weight==.
+
+replace weight = 1 if weight==.
+drop if weight==0
+
+gen idts = id2 if id2==id
+replace idts = id2*1000 if id2~=id
+*idts: id treat x synth control
+
+gen idcase = idts
+replace idcase = idts/1000 if idts>999
+
+drop id2
+order county_fips idcase idts id year
+
+compress
+sort idcase idts id year
+save data/samplep`p'_a1950_1870.dta, replace
+
+
+clear
+use data/samplep`p'_a1950_1870.dta, clear
+
+xi: reg lndensity i.county_fips i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3, /*
+*/ cluster(county_fips) level(95)
+
+foreach var of varlist lndensity _I* /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 {
+ replace `var' = `var'*weight
+}
+
+collapse idcase (sum) lndensity _I* /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3, by(idts year)
+
+foreach var of varlist idcase lndensity _I* /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 {
+ label var `var' ""
+}
+
+reg lndensity _I* /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3, /*
+*/ cluster(idcase) level(95)
+
+parmest, saving(data/parmest/TSp`p'_a1950_1870.dta, replace)
+}
+
+
+forvalues p = 1(1)100 {
+foreach var in TSp`p'_b1950 TSp`p'_a1950 {
+clear
+use data/parmest/`var'_1870.dta, clear
+
+gen evtime = -100 if parm=="evtime100b"
+replace evtime = -90 if parm=="evtime90b"
+replace evtime = -80 if parm=="evtime80b"
+replace evtime = -70 if parm=="evtime70b"
+replace evtime = -60 if parm=="evtime60b"
+replace evtime = -50 if parm=="evtime50b"
+replace evtime = -40 if parm=="evtime40b"
+replace evtime = -30 if parm=="evtime30b"
+replace evtime = -20 if parm=="evtime20b"
+replace evtime = 0 if parm=="evtime0"
+replace evtime = 10 if parm=="evtime10a"
+replace evtime = 20 if parm=="evtime20a"
+replace evtime = 30 if parm=="evtime30a"
+replace evtime = 40 if parm=="evtime40a"
+replace evtime = 50 if parm=="evtime50a"
+replace evtime = 60 if parm=="evtime60a"
+replace evtime = 70 if parm=="evtime70a"
+replace evtime = 80 if parm=="evtime80a"
+
+keep if evtime~=.
+
+local new = _N + 1
+set obs `new'
+
+ren estimate c`var'
+ren min95 l`var'
+ren max95 u`var'
+
+keep evtime c`var' l`var' u`var'
+order evtime c`var' l`var' u`var'
+
+replace evtime = -10 if evtime==.
+replace c`var' = 0 if c`var'==.
+replace l`var' = 0 if l`var'==.
+replace u`var' = 0 if u`var'==.
+
+*replace c`var' = c`var'*100
+*replace l`var' = l`var'*100
+*replace u`var' = u`var'*100
+
+compress
+sort evtime
+save graphs/data/`var'_1870.dta, replace
+}
+}
+
+
+****************************************
+***PANEL A
+****************************************
+clear all
+use graphs/data/evtime_1870.dta, clear
+
+foreach var in TScluster_b1950 {
+merge 1:1 evtime using graphs/data/`var'_1870.dta
+drop _merge
+sort evtime
+}
+
+forvalues p = 1(1)100 {
+ foreach var in TSp`p'_b1950 {
+ merge 1:1 evtime using graphs/data/`var'_1870.dta
+ drop _merge
+ sort evtime
+ }
+}
+
+keep if (evtime>=-60 & evtime<=70)
+
+compress
+sort evtime
+save data/main_results_placebo_b1950_1870.dta, replace
+
+
+clear all
+use data/main_results_placebo_b1950_1870.dta, clear
+
+forvalues p = 1(1)100 {
+gen rcTSp`p'_b1950 = abs(cTSp`p'_b1950/cTScluster_b1950) if evtime<0
+gen rcTSp`p'_1aux = (rcTSp`p'_b1950>10 & rcTSp`p'_b1950~=.)
+egen rcTSp`p'_1 = max(rcTSp`p'_1aux)
+replace cTSp`p'_b1950=. if rcTSp`p'_1==1
+}
+
+egen ymax_aux = rowmax(cTS*)
+egen ymin_aux = rowmin(cTS*)
+
+egen ymax = max(ymax_aux)
+egen ymin = min(ymin_aux)
+
+gen yscale = ymin if evtime<=0
+replace yscale = ymax if evtime>0
+
+drop ymax_aux-ymin
+
+regaxis evtime, cycle(10) ltick(evtime)
+regaxis yscale, cycle(0.2) ltick(yscale)
+
+sort evtime
+
+forvalues p = 1(1)100 {
+ foreach var in TSp`p'_b1950 {
+ local grTS_b1950 `grTS_b1950' (line c`var' evtime, sort mcolor(gray) lcolor(gray) lwidth(medium) lpattern(solid))
+ }
+}
+
+graph twoway `grTS_b1950' /*
+*/ (line cTScluster_b1950 evtime, sort mcolor(black) lcolor(black) lwidth(thick) lpattern(solid)), /*
+*/ ytitle(ln(PopDensity)) ylabel(-1(0.2)1, angle(horizontal)) yscale(titlegap(*-40)) /*
+*/ xtitle(Years Relative to Dam Completion) xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(-10, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(`evtime') /*
+*/ subtitle(Panel A. Pre-1950 Dams) /*
+*/ legend(on order(101 "SC-Based Effects" 1 "Placebo Effects") cols(1) position(5) ring(0)) /*
+*/ xsize(6.5) ysize(5) scale(0.9) /*
+*/ saving(graphs/AFig_C4a.gph, replace)
+
+****************************************
+***PANEL B
+****************************************
+clear all
+use graphs/data/evtime_1870.dta, clear
+
+foreach var in TScluster_a1950 {
+merge 1:1 evtime using graphs/data/`var'_1870.dta
+drop _merge
+sort evtime
+}
+
+forvalues p = 1(1)100 {
+ foreach var in TSp`p'_a1950 {
+ merge 1:1 evtime using graphs/data/`var'_1870.dta
+ drop _merge
+ sort evtime
+ }
+}
+
+keep if (evtime>=-90 & evtime<=50)
+
+compress
+sort evtime
+save data/main_results_placebo_a1950_1870.dta, replace
+
+clear all
+use data/main_results_placebo_a1950_1870.dta, clear
+
+forvalues p = 1(1)100 {
+gen rcTSp`p'_a1950 = abs(cTSp`p'_a1950/cTScluster_a1950) if evtime<0
+gen rcTSp`p'_1aux = (rcTSp`p'_a1950>10 & rcTSp`p'_a1950~=.)
+egen rcTSp`p'_1 = max(rcTSp`p'_1aux)
+replace cTSp`p'_a1950=. if rcTSp`p'_1==1
+}
+
+egen ymax_aux = rowmax(cTS*)
+egen ymin_aux = rowmin(cTS*)
+
+egen ymax = max(ymax_aux)
+egen ymin = min(ymin_aux)
+
+gen yscale = ymin if evtime<=0
+replace yscale = ymax if evtime>0
+
+drop ymax_aux-ymin
+
+regaxis evtime, cycle(10) ltick(evtime)
+regaxis yscale, cycle(0.2) ltick(yscale)
+
+sort evtime
+
+forvalues p = 1(1)100 {
+ foreach var in TSp`p'_a1950 {
+ local grTS_a1950 `grTS_a1950' (line c`var' evtime, sort mcolor(gray) lcolor(gray) lwidth(medium) lpattern(solid))
+ }
+}
+
+graph twoway `grTS_a1950' /*
+*/ (line cTScluster_a1950 evtime, sort mcolor(black) lcolor(black) lwidth(thick) lpattern(solid)), /*
+*/ ytitle(ln(PopDensity)) yscale(titlegap(-13)) ylabel(-1(0.2)1, angle(horizontal)) /*
+*/ xtitle(Years Relative to Dam Completion) xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(-10, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(`evtime') /*
+*/ subtitle(Panel B. Post-1950 Dams) /*
+*/ legend(on order(101 "SC-Based Effects" 1 "Placebo Effects") cols(1) position(5) ring(0)) /*
+*/ xsize(6.5) ysize(5) scale(0.9) /*
+*/ saving(graphs/AFig_C4b.gph, replace)
+
+****************************************
+***COMBINING PANELS
+****************************************
+graph combine graphs/AFig_C4a.gph graphs/AFig_C4b.gph, /*
+*/ xsize(10) ysize(5) ycommon scale(1) /*
+*/ saving(graphs/AFig_C4.gph, replace)
+
+graph export graphs/AFig_C4.pdf, replace
+
+erase graphs/AFig_C4a.gph
+erase graphs/AFig_C4b.gph
+
+
+forvalues p = 1(1)100 {
+ erase data/samplep`p'_1870.dta
+ erase data/samplep`p'_a1950_1870.dta
+ erase data/samplep`p'_a1950_merge_1870.dta
+ erase data/samplep`p'_b1950_1870.dta
+ erase data/samplep`p'_b1950_merge_1870.dta
+}
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX FIGURE C.5
+********************************************************************************
+********************************************************************************
+
+****************************************
+***PANEL A
+****************************************
+clear all
+use data/sample_308series_costdev_1870.dta, clear
+
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 i.year*costdev /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_b1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TC_b1950_308series_costdev_1870.dta, replace)
+
+
+drop _I*
+
+gen sample_b1950 = e(sample)
+keep if sample_b1950==1
+
+capture drop n
+bysort county_fips: gen n=_n
+
+tab treated_b1950 if n==1
+tab year_treat if (year_treat>0 & n==1)
+
+tab state_name if (n==1 & treated_b1950==1)
+tab state_name if (n==1 & treated_b1950==0)
+
+sum treated_b1950 if (treated_b1950==0 & n==1)
+local ncontrol = r(N)
+
+sum year_treat if (year_treat>0 & n==1)
+local miny_treat = r(min)
+local maxy_treat = r(max)
+
+forvalues i=`miny_treat'(10)`maxy_treat' {
+ sum year_treat if (year_treat==`i' & n==1)
+ scalar ntreat`i' = r(N)
+}
+
+
+drop n
+bysort treated_b1950 county_fips: gen n = _n
+replace n = . if n>1
+
+sort n treated_b1950 year_treat county_fips
+bysort n treated_b1950: gen n2 = _n
+replace n2 = . if n==.
+
+gen n3 = _n
+replace n3 = . if n==.
+
+bysort county_fips: egen id = max(n3)
+
+drop n n2 n3
+
+compress
+order county_fips id year
+
+tsset id year
+
+sort id year
+save data/sample_b1950_308series_costdev_1870.dta, replace
+save data/sample_b1950_merge_308series_costdev_1870.dta, replace
+
+
+clear
+use data/sample_b1950_merge_308series_costdev_1870.dta, clear
+
+local l_1920 = `ncontrol' + 1
+local u_1920 = `ncontrol' + ntreat1920
+forvalues i=`l_1920'(1)`u_1920' {
+ synth lndensity lndensity(1870) lndensity(1880) lndensity(1890) lndensity(1900) lndensity(1910) lndensity(1920) costdev /*
+ */ latc1 lonc1 latc2 lonc2 latc3 lonc3 reg1 reg2 reg3 reg4 railtrack waterway distnearmsa_miles inst1944 mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1, /*
+ */ trunit(`i') counit(1(1)`ncontrol') trperiod(1930) keep(synth`i'_308series_costdev_1870, replace)
+}
+
+local l_1930 = `u_1920' + 1
+local u_1930 = `u_1920' + ntreat1930
+forvalues i=`l_1930'(1)`u_1930' {
+ synth lndensity lndensity(1870) lndensity(1880) lndensity(1890) lndensity(1900) lndensity(1910) lndensity(1920) lndensity(1930) costdev /*
+ */ latc1 lonc1 latc2 lonc2 latc3 lonc3 reg1 reg2 reg3 reg4 railtrack waterway distnearmsa_miles inst1944 mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1, /*
+ */ trunit(`i') counit(1(1)`ncontrol') trperiod(1940) keep(synth`i'_308series_costdev_1870, replace)
+}
+
+local l_1940 = `u_1930' + 1
+local u_1940 = `u_1930' + ntreat1940
+forvalues i=`l_1940'(1)`u_1940' {
+ synth lndensity lndensity(1870) lndensity(1880) lndensity(1890) lndensity(1900) lndensity(1910) lndensity(1920) lndensity(1930) lndensity(1940) costdev /*
+ */ latc1 lonc1 latc2 lonc2 latc3 lonc3 reg1 reg2 reg3 reg4 railtrack waterway distnearmsa_miles inst1944 mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1, /*
+ */ trunit(`i') counit(1(1)`ncontrol') trperiod(1950) keep(synth`i'_308series_costdev_1870,replace)
+}
+
+
+
+clear all
+forvalues i=`l_1920'(1)`u_1940' {
+ clear
+ use synth`i'_308series_costdev_1870.dta, clear
+ keep _Co_Number _W_Weight
+ ren _Co_Number id
+ ren _W_Weight weight
+ save synth`i'tomerge_308series_costdev_1870.dta, replace
+
+ clear
+ use data/sample_b1950_merge_308series_costdev_1870.dta, clear
+ sort id
+ merge m:1 id using synth`i'tomerge_308series_costdev_1870.dta
+ drop _merge
+ gen id2 = `i'
+ save data/synth`i'toappend_308series_costdev_1870.dta, replace
+
+ clear
+ erase synth`i'_308series_costdev_1870.dta
+ erase synth`i'tomerge_308series_costdev_1870.dta
+}
+
+clear all
+use data/sample_b1950_merge_308series_costdev_1870.dta, clear
+
+forvalues i=`l_1920'(1)`u_1940' {
+ append using data/synth`i'toappend_308series_costdev_1870.dta
+ erase data/synth`i'toappend_308series_costdev_1870.dta
+}
+
+order county_fips id id2
+
+drop if id2==.
+drop if id2~=id & weight==.
+
+replace weight = 1 if weight==.
+drop if weight==0
+
+gen idts = id2 if id2==id
+replace idts = id2*1000 if id2~=id
+*idts: id treat x synth control
+
+gen idcase = idts
+replace idcase = idts/1000 if idts>999
+
+drop id2
+order county_fips idcase idts id year
+
+compress
+sort idcase idts id year
+save data/sample_b1950_308series_costdev_1870.dta, replace
+
+
+clear all
+use data/sample_b1950_308series_costdev_1870.dta, clear
+
+xi: reg lndensity i.county_fips i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 i.year*costdev /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3, /*
+*/ cluster(county_fips) level(95)
+
+foreach var of varlist lndensity _I* /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 {
+ replace `var' = `var'*weight
+}
+
+collapse county_fips year_treat idcase (sum) lndensity _I* /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3, by(idts year)
+
+foreach var of varlist idcase lndensity _I* /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 {
+ label var `var' ""
+}
+
+reg lndensity _I* /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3, /*
+*/ cluster(idcase) level(95)
+
+parmest, saving(data/parmest/TS_b1950_308series_costdev_1870.dta, replace)
+
+compress
+sort idcase idts year
+save data/sample_b1950_308series_costdev_agg_1870.dta, replace
+
+
+
+*CONSTRUCTING CLUSTERS BASED ON THE WEIGHTS FOR THE SYNTHETIC CONTROLS*
+clear all
+use data/sample_b1950_308series_costdev_1870.dta, clear
+
+bysort idcase county_fips: gen n = _n
+keep if n==1
+
+keep county_fips idcase idts id state_fips state_name county_name weight
+
+gen cname=substr(county_name, 1, 1)+ lower(substr(county_name, 2, .))
+replace county_name = cname
+drop cname
+
+*creating alternative clusters: all cases sharing a county from the donor
+*pool, whose weight in the synthetic control is 0.50 and above
+gen hweight = (weight>=0.5 & weight~=1)
+
+bysort hweight county_fips: gen Ncase = _N
+replace Ncase = . if hweight==0 | (hweight==1 & Ncase==1)
+
+egen cluster_aux = group(hweight county_fips Ncase)
+replace cluster_aux = cluster_aux*100
+bysort idcase: egen cluster = max(cluster_aux)
+replace cluster = idcase if cluster==.
+drop hweight Ncase cluster_aux
+
+bysort idcase: gen ncase = _n
+keep if ncase==1
+drop ncase
+
+*to check number of new clusters (number of rows is number of idcase -- old clusters)
+*egen numberclusters_aux = group(cluster)
+*egen numberclusters = max(numberclusters_aux)
+
+compress
+sort idcase idts county_fips
+save data/newclusters_b1950_308series_costdev_1870.dta, replace
+
+
+*RUNNING THE EVENT STUDY - SYNTHETIC CONTROL WITH NEW CLUSTERS*
+clear all
+use data/sample_b1950_308series_costdev_agg_1870.dta, clear
+
+merge m:1 idcase using data/newclusters_b1950_308series_costdev_1870.dta
+drop _merge
+
+reg lndensity _I* /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3, /*
+*/ cluster(cluster) level(95)
+
+parmest, saving(data/parmest/TScluster_b1950_308series_costdev_1870.dta, replace)
+
+
+
+
+*Data for graph of treat vs. control
+clear all
+use data/parmest/TC_b1950_308series_costdev_1870.dta, clear
+
+gen evtime = -100 if parm=="evtime100b"
+replace evtime = -90 if parm=="evtime90b"
+replace evtime = -80 if parm=="evtime80b"
+replace evtime = -70 if parm=="evtime70b"
+replace evtime = -60 if parm=="evtime60b"
+replace evtime = -50 if parm=="evtime50b"
+replace evtime = -40 if parm=="evtime40b"
+replace evtime = -30 if parm=="evtime30b"
+replace evtime = -20 if parm=="evtime20b"
+replace evtime = 0 if parm=="evtime0"
+replace evtime = 10 if parm=="evtime10a"
+replace evtime = 20 if parm=="evtime20a"
+replace evtime = 30 if parm=="evtime30a"
+replace evtime = 40 if parm=="evtime40a"
+replace evtime = 50 if parm=="evtime50a"
+replace evtime = 60 if parm=="evtime60a"
+replace evtime = 70 if parm=="evtime70a"
+replace evtime = 80 if parm=="evtime80a"
+
+keep if evtime~=.
+
+local new = _N + 1
+set obs `new'
+
+ren estimate cTC_b1950
+ren min95 lTC_b1950
+ren max95 uTC_b1950
+
+keep evtime cTC_b1950 lTC_b1950 uTC_b1950
+order evtime cTC_b1950 lTC_b1950 uTC_b1950
+
+replace evtime = -10 if evtime==.
+replace cTC_b1950 = 0 if cTC_b1950==.
+replace lTC_b1950 = 0 if lTC_b1950==.
+replace uTC_b1950 = 0 if uTC_b1950==.
+
+compress
+sort evtime
+save graphs/data/TC_b1950_308series_costdev_1870.dta, replace
+
+
+*Data for graph of treat vs. synthetic control
+clear all
+use data/parmest/TScluster_b1950_308series_costdev_1870.dta, clear
+
+gen evtime = -100 if parm=="evtime100b"
+replace evtime = -90 if parm=="evtime90b"
+replace evtime = -80 if parm=="evtime80b"
+replace evtime = -70 if parm=="evtime70b"
+replace evtime = -60 if parm=="evtime60b"
+replace evtime = -50 if parm=="evtime50b"
+replace evtime = -40 if parm=="evtime40b"
+replace evtime = -30 if parm=="evtime30b"
+replace evtime = -20 if parm=="evtime20b"
+replace evtime = 0 if parm=="evtime0"
+replace evtime = 10 if parm=="evtime10a"
+replace evtime = 20 if parm=="evtime20a"
+replace evtime = 30 if parm=="evtime30a"
+replace evtime = 40 if parm=="evtime40a"
+replace evtime = 50 if parm=="evtime50a"
+replace evtime = 60 if parm=="evtime60a"
+replace evtime = 70 if parm=="evtime70a"
+replace evtime = 80 if parm=="evtime80a"
+
+keep if evtime~=.
+
+local new = _N + 1
+set obs `new'
+
+ren estimate cTS_b1950
+ren min95 lTS_b1950
+ren max95 uTS_b1950
+
+keep evtime cTS_b1950 lTS_b1950 uTS_b1950
+order evtime cTS_b1950 lTS_b1950 uTS_b1950
+
+replace evtime = -10 if evtime==.
+replace cTS_b1950 = 0 if cTS_b1950==.
+replace lTS_b1950 = 0 if lTS_b1950==.
+replace uTS_b1950 = 0 if uTS_b1950==.
+
+compress
+sort evtime
+save graphs/data/TS_b1950_308series_costdev_1870.dta, replace
+
+
+*Graph
+clear
+use graphs/data/TC_b1950_308series_costdev_1870.dta, clear
+
+merge 1:1 evtime using graphs/data/TS_b1950_308series_costdev_1870.dta
+drop _merge
+
+keep if (evtime>=-60 & evtime<=70)
+
+egen ymax_aux = rowmax(cTS* uTS_b1950)
+egen ymin_aux = rowmin(cTS* lTS_b1950)
+
+egen ymax = max(ymax_aux)
+egen ymin = min(ymin_aux)
+
+gen yscale = ymin if evtime<=0
+replace yscale = ymax if evtime>0
+
+drop ymax_aux-ymin
+
+regaxis evtime, cycle(10) ltick(evtime)
+regaxis yscale, cycle(0.2) ltick(yscale)
+
+sort evtime
+
+twoway /*
+*/ (rarea uTC_b1950 lTC_b1950 evtime, sort fcolor(bluishgray) lcolor(bluishgray) lwidth(none)) /*
+*/ (connected cTC_b1950 evtime, sort mcolor(black) msymbol(circle) lcolor(black) lwidth(medthick) lpattern(solid)) /*
+*/ (connected cTS_b1950 evtime, sort mcolor(black) msymbol(square_hollow) lcolor(black) lwidth(medthick) lpattern(dash)), /*
+*/ ytitle(ln(PopDensity)) ylabel(-0.8(0.2)1.6, angle(horizontal)) yscale(titlegap(*-40)) /*
+*/ xtitle(Years Relative to Dam Completion) xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(-10, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(`evtime') /*
+*/ subtitle(Panel A. Accounting for Ex-Ante Cost of Hydroelectric Development) /*
+*/ legend(on order(2 "Treatment vs. Control" 3 "Treatment vs. Synthetic Control") cols(1) position(5) ring(0)) /*
+*/ xsize(7) ysize(5) scale(0.9) /*
+*/ saving(graphs/AFig_C5a.gph, replace)
+
+****************************************
+***PANEL B
+****************************************
+clear all
+use data/sample_1870.dta, clear
+
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_b1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TC_b1950_1870.dta, replace)
+
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ np_county_year1-np_county_year3 /*
+*/ if (treated_b1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TC_b1950hydrocap_1870.dta, replace)
+
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ i.year*ddisttrHv1930_60 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_b1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TC_b1950tlines_1870.dta, replace)
+
+
+
+clear all
+foreach var in TC_b1950 TC_b1950hydrocap TC_b1950tlines {
+
+clear
+use data/parmest/`var'_1870.dta, clear
+
+gen evtime = -100 if parm=="evtime100b"
+replace evtime = -90 if parm=="evtime90b"
+replace evtime = -80 if parm=="evtime80b"
+replace evtime = -70 if parm=="evtime70b"
+replace evtime = -60 if parm=="evtime60b"
+replace evtime = -50 if parm=="evtime50b"
+replace evtime = -40 if parm=="evtime40b"
+replace evtime = -30 if parm=="evtime30b"
+replace evtime = -20 if parm=="evtime20b"
+replace evtime = 0 if parm=="evtime0"
+replace evtime = 10 if parm=="evtime10a"
+replace evtime = 20 if parm=="evtime20a"
+replace evtime = 30 if parm=="evtime30a"
+replace evtime = 40 if parm=="evtime40a"
+replace evtime = 50 if parm=="evtime50a"
+replace evtime = 60 if parm=="evtime60a"
+replace evtime = 70 if parm=="evtime70a"
+replace evtime = 80 if parm=="evtime80a"
+
+keep if evtime~=.
+
+local new = _N + 1
+set obs `new'
+
+ren estimate c`var'
+ren min95 l`var'
+ren max95 u`var'
+
+keep evtime c`var' l`var' u`var'
+order evtime c`var' l`var' u`var'
+
+replace evtime = -10 if evtime==.
+replace c`var' = 0 if c`var'==.
+replace l`var' = 0 if l`var'==.
+replace u`var' = 0 if u`var'==.
+
+compress
+sort evtime
+save graphs/data/`var'_1870.dta, replace
+}
+
+
+clear all
+use graphs/data/evtime_1870.dta, clear
+
+foreach var in TC_b1950 TC_b1950hydrocap TC_b1950tlines {
+
+merge 1:1 evtime using graphs/data/`var'_1870.dta
+drop _merge
+sort evtime
+}
+
+compress
+sort evtime
+
+keep if (evtime>=-60 & evtime<=70)
+
+egen ymax_aux = rowmax(cTC_b1950hydrocap cTC_b1950tlines uTC_b1950)
+egen ymin_aux = rowmin(cTC_b1950hydrocap cTC_b1950tlines lTC_b1950)
+
+egen ymax = max(ymax_aux)
+egen ymin = min(ymin_aux)
+
+gen yscale = ymin if evtime<=0
+replace yscale = ymax if evtime>0
+
+drop ymax_aux-ymin
+
+regaxis evtime, cycle(10) ltick(evtime)
+regaxis yscale, cycle(0.2) ltick(yscale)
+
+sort evtime
+
+twoway /*
+*/ (rarea uTC_b1950 lTC_b1950 evtime, sort fcolor(bluishgray) lcolor(bluishgray) lwidth(none)) /*
+*/ (connected cTC_b1950hydrocap evtime, sort mcolor(black) msymbol(triangle_hollow) lcolor(black) lwidth(medium) lpattern(dash)) /*
+*/ (connected cTC_b1950tlines evtime, sort mcolor(black) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(longdash)) /*
+*/ (connected cTC_b1950 evtime, sort mcolor(black) msymbol(circle) lcolor(black) lwidth(medthick) lpattern(solid)), /*
+*/ ytitle(ln(PopDensity)) ylabel(-0.8(0.2)1.6, angle(horizontal)) yscale(titlegap(*-40)) /*
+*/ xtitle(Years Relative to Dam Completion) xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(-10, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(`evtime') /*
+*/ subtitle(Panel B. Accounting for Ex-Post Infrastructure Investment) /*
+*/ legend(on order(4 "Main Specification (MS)" 2 "MS + Hydro Capacity" 3 "MS + High-Tension Lines") /*
+*/ cols(1) position(5) ring(0)) /*
+*/ xsize(6.5) ysize(5) scale(0.9) /*
+*/ saving(graphs/AFig_C5b.gph, replace)
+
+graph export graphs/AFig_C5b.pdf, replace
+
+****************************************
+***COMBINING PANELS
+****************************************
+graph combine graphs/AFig_C5a.gph graphs/AFig_C5b.gph, /*
+*/ xsize(10) ysize(5) scale(1) /*
+*/ saving(graphs/AFig_C5.gph, replace)
+
+graph export graphs/AFig_C5.pdf, replace
+
+erase graphs/AFig_C5a.gph
+erase graphs/AFig_C5b.gph
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX FIGURE C.6
+********************************************************************************
+********************************************************************************
+clear all
+use data/sample_1870.dta, clear
+
+*Pre-1950 dams
+xi: areg densityr1870 i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_b1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TCr1870_b1950_1870.dta, replace)
+
+*Post-1950 dams
+xi: areg densityr1870 i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_a1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+parmest, saving(data/parmest/TCr1870_a1950_1870.dta, replace)
+
+
+
+clear all
+foreach var in TC_b1950 TCr1870_b1950 TC_a1950 TCr1870_a1950 {
+
+clear
+use data/parmest/`var'_1870.dta, clear
+
+gen evtime = -100 if parm=="evtime100b"
+replace evtime = -90 if parm=="evtime90b"
+replace evtime = -80 if parm=="evtime80b"
+replace evtime = -70 if parm=="evtime70b"
+replace evtime = -60 if parm=="evtime60b"
+replace evtime = -50 if parm=="evtime50b"
+replace evtime = -40 if parm=="evtime40b"
+replace evtime = -30 if parm=="evtime30b"
+replace evtime = -20 if parm=="evtime20b"
+replace evtime = 0 if parm=="evtime0"
+replace evtime = 10 if parm=="evtime10a"
+replace evtime = 20 if parm=="evtime20a"
+replace evtime = 30 if parm=="evtime30a"
+replace evtime = 40 if parm=="evtime40a"
+replace evtime = 50 if parm=="evtime50a"
+replace evtime = 60 if parm=="evtime60a"
+replace evtime = 70 if parm=="evtime70a"
+replace evtime = 80 if parm=="evtime80a"
+
+keep if evtime~=.
+
+local new = _N + 1
+set obs `new'
+
+ren estimate c`var'
+ren min95 l`var'
+ren max95 u`var'
+
+keep evtime c`var' l`var' u`var'
+order evtime c`var' l`var' u`var'
+
+replace evtime = -10 if evtime==.
+replace c`var' = 0 if c`var'==.
+replace l`var' = 0 if l`var'==.
+replace u`var' = 0 if u`var'==.
+
+compress
+sort evtime
+save graphs/data/`var'_1870.dta, replace
+}
+
+
+clear all
+use graphs/data/evtime_1870.dta, clear
+
+foreach var in TC_b1950 TCr1870_b1950 TC_a1950 TCr1870_a1950 {
+
+merge 1:1 evtime using graphs/data/`var'_1870.dta
+drop _merge
+sort evtime
+}
+
+compress
+sort evtime
+
+
+keep if (evtime>=-90 & evtime<=70)
+
+egen ymax_aux = rowmax(cTC_b1950 cTCr1870_b1950 cTC_a1950 cTCr1870_a1950)
+egen ymin_aux = rowmin(cTC_b1950 cTCr1870_b1950 cTC_a1950 cTCr1870_a1950)
+
+egen ymax = max(ymax_aux)
+egen ymin = min(ymin_aux)
+
+gen yscale = ymin if evtime<=0
+replace yscale = ymax if evtime>0
+
+drop ymax_aux-ymin
+
+regaxis evtime, cycle(10) ltick(evtime)
+regaxis yscale, cycle(0.2) ltick(yscale)
+
+sort evtime
+
+
+****************************************
+***PANEL A
+****************************************
+twoway /*
+*/ (connected cTC_b1950 evtime if (evtime>=-60 & evtime<=70), sort yaxis(1) mcolor(black) msymbol(circle) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected cTCr1870_b1950 evtime if (evtime>=-60 & evtime<=70), yaxis(2) sort mcolor(black) msymbol(square) lcolor(black) lwidth(medium) lpattern(dash)), /*
+*/ subtitle(Panel A. Pre-1950 Dams) /*
+*/ ytitle(ln(PopDensity), axis(1)) ylabel(-0.2(0.1)1, angle(horizontal)) /*
+*/ ytitle(Density w.r.t. 1870, axis(2)) ylabel(-2(1)8, axis(2) angle(horizontal)) /*
+*/ xtitle(Years Relative to Dam Completion) xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(-10, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(-60(10)70) /*
+*/ legend(on order(1 "ln(PopDensity)" 2 "Density w.r.t. 1870") cols(1) position(5) ring(0)) /*
+*/ xsize(6.5) ysize(5) scale(0.8) /*
+*/ saving(graphs/AFig_C6a.gph, replace)
+
+****************************************
+***PANEL B
+****************************************
+twoway /*
+*/ (connected cTC_a1950 evtime if (evtime>=-90 & evtime<=50), sort yaxis(1) mcolor(black) msymbol(circle_hollow) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected cTCr1870_a1950 evtime if (evtime>=-90 & evtime<=50), yaxis(2) sort mcolor(black) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(dash)), /*
+*/ subtitle(Panel B. Post-1950 Dams) /*
+*/ ytitle(ln(PopDensity), axis(1)) ylabel(-0.2(0.1)1, angle(horizontal)) /*
+*/ ytitle(Density w.r.t. 1870, axis(2)) ylabel(-2(1)8, axis(2) angle(horizontal)) /*
+*/ xtitle(Years Relative to Dam Completion) xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(-10, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(-90(10)50) /*
+*/ legend(on order(1 "ln(PopDensity)" 2 "Density w.r.t. 1870") cols(1) position(5) ring(0)) /*
+*/ xsize(6.5) ysize(5) scale(0.8) /*
+*/ saving(graphs/AFig_C6b.gph, replace)
+
+****************************************
+***COMBINING PANELS
+****************************************
+graph combine graphs/AFig_C6a.gph graphs/AFig_C6b.gph, /*
+*/ xsize(10) ysize(5) ycommon scale(1) /*
+*/ saving(graphs/AFig_C6.gph, replace)
+
+graph export graphs/AFig_C6.pdf, replace
+
+erase graphs/AFig_C6a.gph
+erase graphs/AFig_C6b.gph
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX FIGURE C.7
+********************************************************************************
+********************************************************************************
+*Pre-1950 Dams
+clear all
+use data/sample_1870.dta, clear
+
+gen treat = (evtime>=0 & evtime~=.)
+
+gen year_reg1 = year * reg1
+gen year_reg2 = year * reg2
+gen year_reg3 = year * reg3
+gen year_reg4 = year * reg4
+gen year_latc1 = year * latc1
+gen year_latc2 = year * latc2
+gen year_latc3 = year * latc3
+gen year_lonc1 = year * lonc1
+gen year_lonc2 = year * lonc2
+gen year_lonc3 = year * lonc3
+gen year_mt_summer1 = year * mt_summer1
+gen year_mt_fall1 = year * mt_fall1
+gen year_mt_winter1 = year * mt_winter1
+gen year_mt_spring1 = year * mt_spring1
+gen year_mp_summer1 = year * mp_summer1
+gen year_mp_fall1 = year * mp_fall1
+gen year_mp_winter1 = year * mp_winter1
+gen year_mp_spring1 = year * mp_spring1
+gen year_railtrack = year * railtrack
+gen year_waterway = year * waterway
+gen year_distnearmsa_miles = year * distnearmsa_miles
+gen year_inst1944 = year * inst1944
+
+*Estimate the estimator proposed by de Chaisemartin and D’Haultfœuille (2020)
+twowayfeweights lndensity county_fips year treat if (treated_b1950==1 | falsetreat==1), type(feTR) /*
+*/ controls(year_reg1 year_reg2 year_reg3 year_reg4 year_latc1 year_latc2 year_latc3 year_lonc1 year_lonc2 year_lonc3 /*
+*/ year_mt_summer1 year_mt_fall1 year_mt_winter1 year_mt_spring1 year_mp_summer1 year_mp_fall1 year_mp_winter1 year_mp_spring1 /*
+*/ year_railtrack year_waterway year_distnearmsa_miles year_inst1944 npff_county_year1 npff_county_year2 npff_county_year3)
+
+did_multiplegt lndensity county_fips year treat if (treated_b1950==1 | falsetreat==1), robust_dynamic dynamic(7) average_effect /*
+*/ placebo(6) longdiff_placebo jointtestplacebo controls(year_reg1 year_reg2 year_reg3 year_reg4 year_latc1 year_latc2 year_latc3 /*
+*/ year_lonc1 year_lonc2 year_lonc3 year_mt_summer1 year_mt_fall1 year_mt_winter1 year_mt_spring1 year_mp_summer1 year_mp_fall1 /*
+*/ year_mp_winter1 year_mp_spring1 year_railtrack year_waterway year_distnearmsa_miles year_inst1944 npff_county_year1 /*
+*/ npff_county_year2 npff_county_year3) breps(1000) seed(1) cluster(county_fips) save_results(data/chaisehault_allcont_b1950_1870)
+
+
+
+*Post-1950 Dams
+clear all
+use data/sample_1870.dta, clear
+
+gen treat = (evtime>=0 & evtime~=.)
+
+gen year_reg1 = year * reg1
+gen year_reg2 = year * reg2
+gen year_reg3 = year * reg3
+gen year_reg4 = year * reg4
+gen year_latc1 = year * latc1
+gen year_latc2 = year * latc2
+gen year_latc3 = year * latc3
+gen year_lonc1 = year * lonc1
+gen year_lonc2 = year * lonc2
+gen year_lonc3 = year * lonc3
+gen year_mt_summer1 = year * mt_summer1
+gen year_mt_fall1 = year * mt_fall1
+gen year_mt_winter1 = year * mt_winter1
+gen year_mt_spring1 = year * mt_spring1
+gen year_mp_summer1 = year * mp_summer1
+gen year_mp_fall1 = year * mp_fall1
+gen year_mp_winter1 = year * mp_winter1
+gen year_mp_spring1 = year * mp_spring1
+gen year_railtrack = year * railtrack
+gen year_waterway = year * waterway
+gen year_distnearmsa_miles = year * distnearmsa_miles
+gen year_inst1944 = year * inst1944
+
+*Estimate the estimator proposed by de Chaisemartin and D’Haultfœuille (2020)
+twowayfeweights lndensity county_fips year treat if (treated_a1950==1 | falsetreat==1), type(feTR) /*
+*/ controls(year_reg1 year_reg2 year_reg3 year_reg4 year_latc1 year_latc2 year_latc3 year_lonc1 year_lonc2 year_lonc3 /*
+*/ year_mt_summer1 year_mt_fall1 year_mt_winter1 year_mt_spring1 year_mp_summer1 year_mp_fall1 year_mp_winter1 year_mp_spring1 /*
+*/ year_railtrack year_waterway year_distnearmsa_miles year_inst1944 npff_county_year1 npff_county_year2 npff_county_year3)
+
+did_multiplegt lndensity county_fips year treat if (treated_a1950==1 | falsetreat==1), robust_dynamic dynamic(9) average_effect /*
+*/ placebo(9) longdiff_placebo jointtestplacebo controls(year_reg1 year_reg2 year_reg3 year_reg4 year_latc1 year_latc2 year_latc3 /*
+*/ year_lonc1 year_lonc2 year_lonc3 year_mt_summer1 year_mt_fall1 year_mt_winter1 year_mt_spring1 year_mp_summer1 year_mp_fall1 /*
+*/ year_mp_winter1 year_mp_spring1 year_railtrack year_waterway year_distnearmsa_miles year_inst1944 npff_county_year1 /*
+*/ npff_county_year2 npff_county_year3) breps(1000) seed(1) cluster(county_fips) save_results(data/chaisehault_allcont_a1950_1870)
+
+
+
+
+*for graphs
+clear all
+use data/chaisehault_allcont_b1950_1870.dta, clear
+
+ren time_to_treatment evtime
+drop if evtime==.
+replace evtime = evtime *10
+
+ren treatment_effect chaisehault_b50
+
+keep evtime chaisehault_b50
+save data/graph_chaisehault_b1950_1870.dta, replace
+
+clear all
+use data/chaisehault_allcont_a1950_1870.dta, clear
+
+ren time_to_treatment evtime
+drop if evtime==.
+replace evtime = evtime *10
+
+ren treatment_effect chaisehault_a50
+
+keep evtime chaisehault_a50
+save data/graph_chaisehault_a1950_1870.dta, replace
+
+
+
+
+clear all
+foreach var in TC_b1950 TC_a1950 {
+
+clear
+use data/parmest/`var'_1870.dta, clear
+
+gen evtime = -100 if parm=="evtime100b"
+replace evtime = -90 if parm=="evtime90b"
+replace evtime = -80 if parm=="evtime80b"
+replace evtime = -70 if parm=="evtime70b"
+replace evtime = -60 if parm=="evtime60b"
+replace evtime = -50 if parm=="evtime50b"
+replace evtime = -40 if parm=="evtime40b"
+replace evtime = -30 if parm=="evtime30b"
+replace evtime = -20 if parm=="evtime20b"
+replace evtime = 0 if parm=="evtime0"
+replace evtime = 10 if parm=="evtime10a"
+replace evtime = 20 if parm=="evtime20a"
+replace evtime = 30 if parm=="evtime30a"
+replace evtime = 40 if parm=="evtime40a"
+replace evtime = 50 if parm=="evtime50a"
+replace evtime = 60 if parm=="evtime60a"
+replace evtime = 70 if parm=="evtime70a"
+replace evtime = 80 if parm=="evtime80a"
+
+keep if evtime~=.
+
+local new = _N + 1
+set obs `new'
+
+ren estimate c`var'
+ren min95 l`var'
+ren max95 u`var'
+
+keep evtime c`var' l`var' u`var'
+order evtime c`var' l`var' u`var'
+
+replace evtime = -10 if evtime==.
+replace c`var' = 0 if c`var'==.
+replace l`var' = 0 if l`var'==.
+replace u`var' = 0 if u`var'==.
+
+compress
+sort evtime
+save graphs/data/`var'_1870.dta, replace
+}
+
+
+clear all
+use graphs/data/evtime_1870.dta, clear
+
+foreach var in TC_b1950 TC_a1950 {
+
+merge 1:1 evtime using graphs/data/`var'_1870.dta
+drop _merge
+sort evtime
+}
+
+compress
+sort evtime
+
+
+
+merge 1:1 evtime using data/graph_chaisehault_b1950_1870.dta
+drop if _merge==2
+drop _merge
+
+merge 1:1 evtime using data/graph_chaisehault_a1950_1870.dta
+drop if _merge==2
+drop _merge
+
+
+keep if (evtime>=-90 & evtime<=70)
+
+egen ymax_aux = rowmax(uTC_b1950 uTC_a1950)
+egen ymin_aux = rowmin(lTC_b1950 lTC_a1950)
+
+egen ymax = max(ymax_aux)
+egen ymin = min(ymin_aux)
+
+gen yscale = ymin if evtime<=0
+replace yscale = ymax if evtime>0
+
+drop ymax_aux-ymin
+
+regaxis evtime, cycle(10) ltick(evtime)
+regaxis yscale, cycle(0.2) ltick(yscale)
+
+sort evtime
+
+
+****************************************
+***PANEL A
+****************************************
+twoway /*
+*/ (rarea uTC_b1950 lTC_b1950 evtime if (evtime>=-60 & evtime<=70), sort fcolor(bluishgray) lcolor(bluishgray) lwidth(none)) /*
+*/ (connected cTC_b1950 evtime if (evtime>=-60 & evtime<=70), sort mcolor(black) msize(small) msymbol(circle) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected chaisehault_b50 evtime if (evtime>=-60 & evtime<=70), sort mcolor(black) msize(small) msymbol(circle_hollow) lcolor(black) lwidth(medium) lpattern(dash)), /*
+*/ ytitle(ln(PopDensity)) ylabel(-0.4(0.2)1.4, angle(horizontal)) /*
+*/ xtitle(Years Relative to Dam Completion) xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(-10, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(-60(10)70) /*
+*/ subtitle(Panel A. Pre-1950 Dams) /*
+*/ legend(on order(2 "Main Analysis" 1 "Main: 95% CI" 3 "dCDH Approach") cols(1) position(5) ring(0)) /*
+*/ xsize(6.5) ysize(5) scale(0.9) /*
+*/ saving(graphs/AFig_C7a.gph, replace)
+
+****************************************
+***PANEL B
+****************************************
+twoway /*
+*/ (rarea uTC_a1950 lTC_a1950 evtime if (evtime>=-90 & evtime<=50), sort fcolor(yellow) lcolor(yellow) lwidth(none)) /*
+*/ (connected cTC_a1950 evtime if (evtime>=-90 & evtime<=50), sort mcolor(black) msize(small) msymbol(square) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected chaisehault_a50 evtime if (evtime>=-90 & evtime<=50), sort mcolor(black) msize(small) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(dash)), /*
+*/ ytitle(ln(PopDensity)) ylabel(-0.4(0.2)1.4, angle(horizontal)) /*
+*/ xtitle(Years Relative to Dam Completion) xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(-10, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(-90(10)50) /*
+*/ subtitle(Panel B. Post-1950 Dams) /*
+*/ legend(on order(2 "Main Analysis" 1 "Main: 95% CI" 3 "dCDH Approach") cols(1) position(5) ring(0)) /*
+*/ xsize(6.5) ysize(5) scale(0.9) /*
+*/ saving(graphs/AFig_C7b.gph, replace)
+
+****************************************
+***COMBINING PANELS
+****************************************
+graph combine graphs/AFig_C7a.gph graphs/AFig_C7b.gph, /*
+*/ xsize(10) ysize(5) scale(1.1) /*
+*/ saving(graphs/AFig_C7.gph, replace)
+
+graph export graphs/AFig_C7.pdf, replace
+
+erase graphs/AFig_C7a.gph
+erase graphs/AFig_C7b.gph
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX FIGURE C.8
+********************************************************************************
+********************************************************************************
+clear all
+use data/sample_b1950_graphs_summary_statistics_1870.dta, clear
+*this dataset was created in the analysis for Figure 8
+
+
+regaxis year, cycle(10) ltick(year)
+sort year
+
+/* Walters Dam (1930s) - Haywood County (NC) FIPS: 37087 */
+twoway /*
+*/ (connected lndensity year if idts==41, sort mcolor(black) msize(small) msymbol(circle) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected lndensity year if idts==41*1000, sort mcolor(black) msize(small) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(dash)), /*
+*/ ytitle(ln(PopDensity)) ylabel(, angle(horizontal)) /*
+*/ xtitle("") xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(1930, lwidth(medium) lpattern(solid) lcolor(black)) /*
+*/ xline(1940, lwidth(medium) lpattern(dot) lcolor(black)) /*
+*/ xline(1950, lwidth(medium) lpattern(dash) lcolor(black)) xlabel(`year', angle(45)) /*
+*/ title(Panel A. Walters Dam (1930s)) /*
+*/ subtitle(Haywood County (NC)) /*
+*/ legend(on order(1 "Treatment: 1930s" 2 "Synthetic Control") cols(1) position(5) ring(0)) /*
+*/ xsize(6.5) ysize(5) scale(0.9) /*
+*/ saving(graphs/Figure_Synth_b50_TimingAttHydro1_1870.gph, replace)
+
+
+regaxis year, cycle(10) ltick(year)
+sort year
+
+/* Parker Dam (1940s) - San Bernardino County (CA) FIPS: 6071 */
+twoway /*
+*/ (connected lndensity year if idts==49, sort mcolor(black) msize(small) msymbol(circle) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected lndensity year if idts==49*1000, sort mcolor(black) msize(small) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(dash)), /*
+*/ ytitle(ln(PopDensity)) ylabel(, angle(horizontal)) /*
+*/ xtitle("") xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(1940, lwidth(medium) lpattern(solid) lcolor(black)) /*
+*/ xline(1950, lwidth(medium) lpattern(dash) lcolor(black)) /*
+*/ xline(1960, lwidth(medium) lpattern(dot) lcolor(black)) xlabel(`year', angle(45)) /*
+*/ title(Panel B. Parker Dam (1940s)) /*
+*/ subtitle(San Bernardino County (CA)) /*
+*/ legend(on order(1 "Treatment: 1940s" 2 "Synthetic Control") cols(1) position(5) ring(0)) /*
+*/ xsize(6.5) ysize(5) scale(0.9) /*
+*/ saving(graphs/Figure_Synth_b50_TimingAttHydro2_1870.gph, replace)
+
+
+/* Combining graphs that display Timing of Attenuation of Hydro Advantage */
+
+graph combine /*
+*/ graphs/Figure_Synth_b50_TimingAttHydro1_1870.gph /*
+*/ graphs/Figure_Synth_b50_TimingAttHydro2_1870.gph, /*
+*/ xsize(10) ysize(5) scale(0.9) cols(2) /*
+*/ saving(graphs/AFig_C8.gph, replace)
+
+graph export graphs/AFig_C8.pdf, replace
+
+erase graphs/Figure_Synth_b50_TimingAttHydro1_1870.gph
+erase graphs/Figure_Synth_b50_TimingAttHydro2_1870.gph
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX FIGURE C.9
+********************************************************************************
+********************************************************************************
+clear all
+use data/sample_a1950_graphs_summary_statistics_1870.dta, clear
+*this dataset was created in the analysis for Figure 8
+
+
+regaxis year, cycle(10) ltick(year)
+sort year
+
+/* Carters Dam (1970s) - Murray County (GA) FIPS: 13213 */
+twoway /*
+*/ (connected lndensity year if idts==73, sort mcolor(black) msize(small) msymbol(circle) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected lndensity year if idts==73*1000, sort mcolor(black) msize(small) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(dash)), /*
+*/ ytitle(ln(PopDensity)) ylabel(, angle(horizontal)) /*
+*/ xtitle("") xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(1950, lwidth(medium) lpattern(dash) lcolor(black)) /*
+*/ xline(1970, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(`year', angle(45)) /*
+*/ subtitle(Panel A. Carters Dam (1970s)) /*
+*/ t2title(Murray County (GA)) /*
+*/ legend(off) /*
+*/ xsize(6.5) ysize(5) scale(0.9) /*
+*/ saving(graphs/Figure_Synth_a50_LargeEff_1870.gph, replace)
+
+
+regaxis year, cycle(10) ltick(year)
+sort year
+
+/* Keowee Dam (1970s) - Pickens County (SC) FIPS: 45077 */
+twoway /*
+*/ (connected lndensity year if idts==74, sort mcolor(black) msize(small) msymbol(circle) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected lndensity year if idts==74*1000, sort mcolor(black) msize(small) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(dash)), /*
+*/ ytitle(ln(PopDensity)) ylabel(, angle(horizontal)) /*
+*/ xtitle("") xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(1950, lwidth(medium) lpattern(dash) lcolor(black)) /*
+*/ xline(1970, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(`year', angle(45)) /*
+*/ subtitle(Panel B. Keowee Dam (1970s)) /*
+*/ t2title(Pickens County (SC)) /*
+*/ legend(off) /*
+*/ xsize(6.5) ysize(5) scale(0.9) /*
+*/ saving(graphs/Figure_Synth_a50_ModerateEff_1870.gph, replace)
+
+
+regaxis year, cycle(10) ltick(year)
+sort year
+
+/* Nickajack Dam (1960s) - Marion County (TN) FIPS: 47115 */
+twoway /*
+*/ (connected lndensity year if idts==69, sort mcolor(black) msize(small) msymbol(circle) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected lndensity year if idts==69*1000, sort mcolor(black) msize(small) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(dash)), /*
+*/ ytitle(ln(PopDensity)) ylabel(, angle(horizontal)) /*
+*/ xtitle("") xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(1950, lwidth(medium) lpattern(dash) lcolor(black)) /*
+*/ xline(1960, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(`year', angle(45)) /*
+*/ subtitle(Panel C. Nickajack Dam (1960s)) /*
+*/ t2title(Marion County (TN)) /*
+*/ legend(on order(1 "Observed Trend" 2 "Synthetic Control") symxsize(1)) /*
+*/ xsize(6.5) ysize(5) scale(0.9) /*
+*/ saving(graphs/Figure_Synth_a50_NoEff_1870.gph, replace)
+
+
+regaxis year, cycle(10) ltick(year)
+sort year
+
+/* John H. Kerr Dam (1950s) - Mecklenburg County (VA) FIPS: 51117 */
+twoway /*
+*/ (connected lndensity year if idts==49, sort mcolor(black) msize(small) msymbol(circle) lcolor(black) lwidth(medium) lpattern(solid)) /*
+*/ (connected lndensity year if idts==49*1000, sort mcolor(black) msize(small) msymbol(square_hollow) lcolor(black) lwidth(medium) lpattern(dash)), /*
+*/ ytitle(ln(PopDensity)) ylabel(, angle(horizontal)) /*
+*/ xtitle("") xtitle(, alignment(bottom)) xscale(titlegap(3)) /*
+*/ xline(1949.86, lwidth(medium) lpattern(dash) lcolor(black)) /*
+*/ xline(1950.14, lwidth(medium) lpattern(solid) lcolor(black)) xlabel(`year', angle(45)) /*
+*/ subtitle(Panel D. John H. Kerr Dam (1950s)) /*
+*/ t2title(Mecklenburg County (VA)) /*
+*/ legend(on order(1 "Observed Trend" 2 "Synthetic Control") symxsize(1)) /*
+*/ xsize(7) ysize(5) scale(0.9) /*
+*/ saving(graphs/Figure_Synth_a50_NegEff_1870.gph, replace)
+
+
+/* Combining graphs that display distinctive paths */
+
+graph combine /*
+*/ graphs/Figure_Synth_a50_LargeEff_1870.gph /*
+*/ graphs/Figure_Synth_a50_ModerateEff_1870.gph /*
+*/ graphs/Figure_Synth_a50_NoEff_1870.gph /*
+*/ graphs/Figure_Synth_a50_NegEff_1870.gph, /*
+*/ xsize(10.5) ysize(9) scale(0.8) cols(2) /*
+*/ saving(graphs/AFig_C9.gph, replace)
+
+graph export graphs/AFig_C9.pdf, replace
+
+erase graphs/Figure_Synth_a50_LargeEff_1870.gph
+erase graphs/Figure_Synth_a50_ModerateEff_1870.gph
+erase graphs/Figure_Synth_a50_NoEff_1870.gph
+erase graphs/Figure_Synth_a50_NegEff_1870.gph
+
+
+
+
+
+
+
+
+
+
+
+
+
+********************************************************************************
+********************************************************************************
+***TABLE 1
+********************************************************************************
+********************************************************************************
+clear all
+use data/treat_control_counties_outcomes_1870.dta, clear
+*this dataset was created for Figure B.4
+
+bysort county_fips: gen n = _n
+
+****************************************
+***PANEL A
+****************************************
+*log of population density
+tabstat lndensity, by(year) stat(mean sd) col(stat) format(%12.2f)
+tabstat lndensity if treated_b1950==1, by(year) stat(mean sd) col(stat) format(%12.2f)
+tabstat lndensity if treated_a1950==1, by(year) stat(mean sd) col(stat) format(%12.2f)
+tabstat lndensity if falsetreat==1, by(year) stat(mean sd) col(stat) format(%12.2f)
+
+*log of employment density
+tabstat lndens_emp, by(year) stat(mean sd) col(stat) format(%12.2f)
+tabstat lndens_emp if treated_b1950==1, by(year) stat(mean sd) col(stat) format(%12.2f)
+tabstat lndens_emp if treated_a1950==1, by(year) stat(mean sd) col(stat) format(%12.2f)
+tabstat lndens_emp if falsetreat==1, by(year) stat(mean sd) col(stat) format(%12.2f)
+
+*hydroelectric capacity at dam completion
+tabstat np_county_year if (np_county_year>0 & year_treat==year), by(year) stat(mean sd) col(stat) format(%12.2f)
+tabstat np_county_year if (np_county_year>0 & year_treat==year & treated_b1950==1), by(year) stat(mean sd) col(stat) format(%12.2f)
+tabstat np_county_year if (np_county_year>0 & year_treat==year & treated_a1950==1), by(year) stat(mean sd) col(stat) format(%12.2f)
+sum np_hpot if (falsetreat==1 & n==1)
+
+*average hydroelectric installed capacity over time
+tabstat np_county_year if (np_county_year>0), by(year) stat(mean sd) col(stat) format(%12.2f)
+tabstat np_county_year if (np_county_year>0 & treated_b1950==1), by(year) stat(mean sd) col(stat) format(%12.2f)
+tabstat np_county_year if (np_county_year>0 & treated_a1950==1), by(year) stat(mean sd) col(stat) format(%12.2f)
+
+*sample counties
+tab treated_b1950 if n==1
+tab treated_a1950 if n==1
+
+****************************************
+***PANEL B
+****************************************
+tab year_treat if (year_treat>0 & n==1)
+
+tab year_treat if (treated_b1950==1 & year_treat>0 & n==1)
+
+tab year_treat if (treated_a1950==1 & year_treat>0 & n==1)
+
+
+********************************************************************************
+********************************************************************************
+***TABLE 2
+********************************************************************************
+********************************************************************************
+clear all
+use data/sample_1870.dta, clear
+
+replace treated_b1950 = 0 if treated_b1950==.
+replace treated_a1950 = 0 if treated_a1950==.
+replace falsetreat = 0 if falsetreat==.
+
+capture drop n
+sort county_fips year
+bysort county_fips: gen n=_n
+keep if n==1
+
+sort county_fips
+merge 1:1 county_fips using data/hydro308reports_costdev1_1870.dta
+drop if _merge==2
+drop _merge
+ren costdev costdev1
+sort county_fips
+merge 1:1 county_fips using data/hydro308reports_costdev0_1870.dta
+drop if _merge==2
+drop _merge
+replace costdev1 = costdev if costdev1==.
+drop costdev
+ren costdev1 costdev
+
+replace lonc1 = lonc1*(-1)
+*longitude in the USA is negative
+replace railtrack = railtrack/1609.344
+*now measured in miles, not the original meters
+*a mile is 1609.344 meters
+replace waterway = waterway/1609.344
+*now measured in miles, not the original meters
+*a mile is 1609.344 meters
+
+*MENTION IN THE TABLE THAT THE CONSTANT IS THE MEAN DEPENDENTE VARIABLE FOR THE CONTROL GROUP
+*Population
+reg pop treated_b1950 treated_a1950, cluster(state_fips)
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T2_c1) se bdec(4) sdec(4) rdec(4) excel append
+
+*Pop Density
+reg density treated_b1950 treated_a1950, cluster(state_fips)
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T2_c2) se bdec(4) sdec(4) rdec(4) excel append
+
+*log(Pop Density)
+reg lndensity treated_b1950 treated_a1950, cluster(state_fips)
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T2_c3) se bdec(4) sdec(4) rdec(4) excel append
+
+*Employment
+reg emp treated_b1950 treated_a1950, cluster(state_fips)
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T2_c4) se bdec(4) sdec(4) rdec(4) excel append
+
+*Emp Density
+reg dens_emp treated_b1950 treated_a1950, cluster(state_fips)
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T2_c5) se bdec(4) sdec(4) rdec(4) excel append
+
+*log(Emp Density)
+reg lndens_emp treated_b1950 treated_a1950, cluster(state_fips)
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T2_c6) se bdec(4) sdec(4) rdec(4) excel append
+
+*Hydropower Potential (100W)
+reg np_pot treated_b1950 treated_a1950, cluster(state_fips)
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T2_c7) se bdec(4) sdec(4) rdec(4) excel append
+
+*Installed Hydroelectric Capacity (100W, 2000)
+reg np_county treated_b1950 treated_a1950, cluster(state_fips)
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T2_c8) se bdec(4) sdec(4) rdec(4) excel append
+
+*Average Summer Temperature (Degrees Celsius)
+reg mt_summer1 treated_b1950 treated_a1950, cluster(state_fips)
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T2_c9) se bdec(4) sdec(4) rdec(4) excel append
+
+*Average Fall Temperature (Degrees Celsius)
+reg mt_fall1 treated_b1950 treated_a1950, cluster(state_fips)
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T2_c10) se bdec(4) sdec(4) rdec(4) excel append
+
+*Average Winter Temperature (Degrees Celsius)
+reg mt_winter1 treated_b1950 treated_a1950, cluster(state_fips)
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T2_c11) se bdec(4) sdec(4) rdec(4) excel append
+
+*Average Spring Temperature (Degrees Celsius)
+reg mt_spring1 treated_b1950 treated_a1950, cluster(state_fips)
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T2_c12) se bdec(4) sdec(4) rdec(4) excel append
+
+*County-Centroid Latitude
+reg latc1 treated_b1950 treated_a1950, cluster(state_fips)
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T2_c13) se bdec(4) sdec(4) rdec(4) excel append
+
+*County-Centroid Longitude
+reg lonc1 treated_b1950 treated_a1950, cluster(state_fips)
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T2_c14) se bdec(4) sdec(4) rdec(4) excel append
+
+*Average Summer Precipitation (Centimeters)
+reg mp_summer1 treated_b1950 treated_a1950, cluster(state_fips)
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T2_c15) se bdec(4) sdec(4) rdec(4) excel append
+
+*Average Fall Precipitation (Centimeters)
+reg mp_fall1 treated_b1950 treated_a1950, cluster(state_fips)
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T2_c16) se bdec(4) sdec(4) rdec(4) excel append
+
+*Average Winter Precipitation (Centimeters)
+reg mp_winter1 treated_b1950 treated_a1950, cluster(state_fips)
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T2_c17) se bdec(4) sdec(4) rdec(4) excel append
+
+*Average Spring Precipitation (Centimeters)
+reg mp_spring1 treated_b1950 treated_a1950, cluster(state_fips)
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T2_c18) se bdec(4) sdec(4) rdec(4) excel append
+
+*Railroads Tracks Within County (Miles, 1890)
+reg railtrack treated_b1950 treated_a1950, cluster(state_fips)
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T2_c19) se bdec(4) sdec(4) rdec(4) excel append
+
+*Distance to Nearest Waterway (Miles, 1890)
+reg waterway treated_b1950 treated_a1950, cluster(state_fips)
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T2_c20) se bdec(4) sdec(4) rdec(4) excel append
+
+*Distance to Nearest MSA (Miles, 1930)
+reg distnearmsa_miles treated_b1950 treated_a1950, cluster(state_fips)
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T2_c21) se bdec(4) sdec(4) rdec(4) excel append
+
+*"Access" to Roads Predicted by 1944 Interstate Highway System Plan
+reg inst1944 treated_b1950 treated_a1950, cluster(state_fips)
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T2_c22) se bdec(4) sdec(4) rdec(4) excel append
+
+*Installed Steam-Electric Capacity (100W, 2000)
+reg npff_county treated_b1950 treated_a1950, cluster(state_fips)
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T2_c23) se bdec(4) sdec(4) rdec(4) excel append
+
+*Ex-Ante Cost of Hydroelectric Development (Mills per kWh)
+reg costdev treated_b1950 treated_a1950, cluster(state_fips)
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T2_c24) se bdec(4) sdec(4) rdec(4) excel append
+
+
+********************************************************************************
+********************************************************************************
+***TABLE 3
+********************************************************************************
+********************************************************************************
+
+*Pre-1950 dams
+clear all
+use data/sample_b1950_graphs_summary_statistics_1870.dta, clear
+*this dataset was created in the analysis for Figure 8
+
+gen lndensity_synth_aux = lndensity if idts>999
+bysort idcase year: egen lndensity_synth = max(lndensity_synth_aux)
+drop lndensity_synth_aux
+
+gen dyear = year - year_treat
+replace dyear = . if dyear<0
+
+gen dlndensity = lndensity - lndensity_synth
+replace dlndensity = . if idts>999
+replace dlndensity = . if dyear<0
+
+replace dyear = . if dlndensity==.
+
+gen dlndensity0_aux = dlndensity if dyear==0
+bysort idts: egen dlndensity0 = max(dlndensity0_aux )
+drop dlndensity0_aux
+
+sort idcase idts year
+
+gen dlndens_rt0 = dlndensity - dlndensity0
+
+
+*HETEROGENEITY IN COUNTY-SPECIFIC HYDRO DAM EFFECTS
+
+keep if idts<1000
+
+sort county_fips year
+merge 1:1 county_fips year using data/counties_largeplants100mw.dta
+drop _merge
+
+bysort county_fips: egen sample = max(sample_aux)
+keep if sample==1
+drop sample sample_aux
+
+sort county_fips year
+merge 1:1 county_fips year using data/counties_largeplants100mwff.dta
+drop if _merge==2
+drop _merge
+
+foreach var of varlist np_county np_u np_wo np_hpot np_pot year_treat npff_county {
+ replace `var' = 0 if `var'==.
+ bysort county_fips: egen `var'2 = max(`var')
+ drop `var'
+ ren `var'2 `var'
+}
+
+sort county_fips year
+bysort county_fips: gen np_county_year2 = sum(np_county_year_aux)
+drop np_county_year
+ren np_county_year2 np_county_year
+
+sort county_fips year
+bysort county_fips: gen npff_county_year2 = sum(npff_county_year_aux)
+drop npff_county_year
+ren npff_county_year2 npff_county_year
+
+foreach var of varlist np_county np_u np_wo np_hpot np_pot /*
+*/ np_county_year np_county_year_aux /*
+*/ npff_county npff_county_year npff_county_year_aux {
+ replace `var' = `var'/100
+}
+*np is now measure in 100MW.
+
+forvalues i=1(1)3 {
+ gen np_county_year`i' = np_county_year^`i'
+}
+
+forvalues i=1(1)3 {
+ gen npff_county_year`i' = npff_county_year^`i'
+}
+
+
+keep if idts~=.
+keep county_fips year cost_kw2000 lndensity lndensity_synth dlndens_rt0 year_treat /*
+*/ np_county_year1-np_county_year3 npff_county_year1-npff_county_year3
+
+gen np_county_damc_aux = np_county_year1 if dlndens_rt0==0
+bysort county_fips: egen np_county_damc = max(np_county_damc_aux)
+drop np_county_damc_aux
+*np_county at dam completion
+
+gen lndensinit_aux = lndensity[_n-1] if dlndens_rt0==0
+bysort county_fips: egen lndensinit = max(lndensinit_aux)
+drop lndensinit_aux
+*lndensity one decade before dam completion
+
+keep if year>=year_treat
+gen year_rt0 = year-year_treat
+
+
+gen state_fips = int(county_fips/1000)
+
+keep if ((state_fips>=1 & state_fips<=56) & state_fips~=2 & state_fips~=15)
+*Keeping only continental U.S.
+
+*Generating division_fips
+gen div_fips = 1 if state_fips==23 | state_fips==33 | state_fips==50 | state_fips==25 | /*
+*/ state_fips==44 | state_fips==9
+replace div_fips = 2 if state_fips==36 | state_fips==34 | state_fips==42
+replace div_fips = 3 if state_fips==39 | state_fips==18 | state_fips==17 | state_fips==26 | state_fips==55
+replace div_fips = 4 if state_fips==27 | state_fips==19 | state_fips==29 | state_fips==38 | state_fips==46 | /*
+*/ state_fips==31 | state_fips==20
+replace div_fips = 5 if state_fips==10 | state_fips==24 | state_fips==11 | state_fips==51 | /*
+*/ state_fips==54 | state_fips==37 | state_fips==45 | state_fips==13 | state_fips==12
+replace div_fips = 6 if state_fips==21 | state_fips==47 | state_fips==1 | state_fips==28
+replace div_fips = 7 if state_fips==5 | state_fips==22 | state_fips==40 | state_fips==48
+replace div_fips = 8 if state_fips==30 | state_fips==16 | state_fips==56 | state_fips==8 | /*
+*/ state_fips==35 | state_fips==4 | state_fips==49 | state_fips==32
+replace div_fips = 9 if state_fips==53 | state_fips==41 | state_fips==6 | state_fips==2 | state_fips==15
+
+*Generating region_fips
+gen reg_fips = 1 if (div_fips==1 | div_fips==2)
+replace reg_fips = 2 if (div_fips==3 | div_fips==4)
+replace reg_fips = 3 if (div_fips==5 | div_fips==6 | div_fips==7)
+replace reg_fips = 4 if (div_fips==8 | div_fips==9)
+
+merge m:1 county_fips using data/nearmsa_edson_1930.dta
+drop if _merge==2
+drop _merge
+*data source: Lewis and Severnini (2020) -- see References
+*data on distance from the county centroid to the nearest metropolitan area in 1930
+
+gen distnmsa30 = (distnearmsa_miles<=30)
+
+gen cost_kw2000aux = cost_kw2000 if dlndens_rt0==0
+drop cost_kw2000
+bysort county_fips: egen cost_kw2000 = mean(cost_kw2000aux)
+drop cost_kw2000aux
+order county_fips year cost_kw2000
+
+compress
+save data/oaxaca_b1950_1870.dta, replace
+
+
+
+*Post-1950 dams
+clear all
+use data/sample_a1950_graphs_summary_statistics_1870.dta, clear
+*this dataset was also created in the analysis for Figure 8
+
+gen lndensity_synth_aux = lndensity if idts>999
+bysort idcase year: egen lndensity_synth = max(lndensity_synth_aux)
+drop lndensity_synth_aux
+
+gen dyear = year - year_treat
+replace dyear = . if dyear<0
+
+gen dlndensity = lndensity - lndensity_synth
+replace dlndensity = . if idts>999
+replace dlndensity = . if dyear<0
+
+replace dyear = . if dlndensity==.
+
+gen dlndensity0_aux = dlndensity if dyear==0
+bysort idts: egen dlndensity0 = max(dlndensity0_aux )
+drop dlndensity0_aux
+
+sort idcase idts year
+
+gen dlndens_rt0 = dlndensity - dlndensity0
+
+
+*HETEROGENEITY IN COUNTY-SPECIFIC HYDRO DAM EFFECTS
+
+keep if idts<1000
+
+sort county_fips year
+merge 1:1 county_fips year using data/counties_largeplants100mw.dta
+drop _merge
+
+bysort county_fips: egen sample = max(sample_aux)
+keep if sample==1
+drop sample sample_aux
+
+sort county_fips year
+merge 1:1 county_fips year using data/counties_largeplants100mwff.dta
+drop if _merge==2
+drop _merge
+
+foreach var of varlist np_county np_u np_wo np_hpot np_pot year_treat npff_county {
+ replace `var' = 0 if `var'==.
+ bysort county_fips: egen `var'2 = max(`var')
+ drop `var'
+ ren `var'2 `var'
+}
+
+sort county_fips year
+bysort county_fips: gen np_county_year2 = sum(np_county_year_aux)
+drop np_county_year
+ren np_county_year2 np_county_year
+
+sort county_fips year
+bysort county_fips: gen npff_county_year2 = sum(npff_county_year_aux)
+drop npff_county_year
+ren npff_county_year2 npff_county_year
+
+foreach var of varlist np_county np_u np_wo np_hpot np_pot /*
+*/ np_county_year np_county_year_aux /*
+*/ npff_county npff_county_year npff_county_year_aux {
+ replace `var' = `var'/100
+}
+*np is now measure in 100MW.
+
+forvalues i=1(1)4 {
+ gen np_county_year`i' = np_county_year^`i'
+}
+
+forvalues i=1(1)4 {
+ gen npff_county_year`i' = npff_county_year^`i'
+}
+
+
+keep if idts~=.
+keep county_fips year cost_kw2000 lndensity lndensity_synth dlndens_rt0 year_treat /*
+*/ np_county_year1-np_county_year4 npff_county_year1-npff_county_year4
+
+gen np_county_damc_aux = np_county_year1 if dlndens_rt0==0
+bysort county_fips: egen np_county_damc = max(np_county_damc_aux)
+drop np_county_damc_aux
+*np_county at dam completion
+
+gen lndensinit_aux = lndensity[_n-1] if dlndens_rt0==0
+bysort county_fips: egen lndensinit = max(lndensinit_aux)
+drop lndensinit_aux
+*lndensity one decade before dam completion
+
+keep if year>=year_treat
+gen year_rt0 = year-year_treat
+
+
+gen state_fips = int(county_fips/1000)
+
+keep if ((state_fips>=1 & state_fips<=56) & state_fips~=2 & state_fips~=15)
+*Keeping only continental U.S.
+
+*Generating division_fips
+gen div_fips = 1 if state_fips==23 | state_fips==33 | state_fips==50 | state_fips==25 | /*
+*/ state_fips==44 | state_fips==9
+replace div_fips = 2 if state_fips==36 | state_fips==34 | state_fips==42
+replace div_fips = 3 if state_fips==39 | state_fips==18 | state_fips==17 | state_fips==26 | state_fips==55
+replace div_fips = 4 if state_fips==27 | state_fips==19 | state_fips==29 | state_fips==38 | state_fips==46 | /*
+*/ state_fips==31 | state_fips==20
+replace div_fips = 5 if state_fips==10 | state_fips==24 | state_fips==11 | state_fips==51 | /*
+*/ state_fips==54 | state_fips==37 | state_fips==45 | state_fips==13 | state_fips==12
+replace div_fips = 6 if state_fips==21 | state_fips==47 | state_fips==1 | state_fips==28
+replace div_fips = 7 if state_fips==5 | state_fips==22 | state_fips==40 | state_fips==48
+replace div_fips = 8 if state_fips==30 | state_fips==16 | state_fips==56 | state_fips==8 | /*
+*/ state_fips==35 | state_fips==4 | state_fips==49 | state_fips==32
+replace div_fips = 9 if state_fips==53 | state_fips==41 | state_fips==6 | state_fips==2 | state_fips==15
+
+*Generating region_fips
+gen reg_fips = 1 if (div_fips==1 | div_fips==2)
+replace reg_fips = 2 if (div_fips==3 | div_fips==4)
+replace reg_fips = 3 if (div_fips==5 | div_fips==6 | div_fips==7)
+replace reg_fips = 4 if (div_fips==8 | div_fips==9)
+
+merge m:1 county_fips using data/nearmsa_edson_1930.dta
+drop if _merge==2
+drop _merge
+*data source: Lewis and Severnini (2020) -- see References
+*data on distance from the county centroid to the nearest metropolitan area in 1930
+
+gen distnmsa30 = (distnearmsa_miles<=30)
+
+gen cost_kw2000aux = cost_kw2000 if dlndens_rt0==0
+drop cost_kw2000
+bysort county_fips: egen cost_kw2000 = mean(cost_kw2000aux)
+drop cost_kw2000aux
+order county_fips year cost_kw2000
+
+compress
+save data/oaxaca_a1950_1870.dta, replace
+
+
+*OAXACA DECOMPOSITION
+
+clear all
+use data/sample_1870.dta, clear
+
+capture drop n
+bysort county_fips: gen n=_n
+keep if n==1
+drop n
+
+save data/county_vars_final_sample_1870.dta, replace
+
+
+clear all
+use data/oaxaca_b1950_1870.dta, clear
+
+append using data/oaxaca_a1950_1870.dta
+
+merge m:1 county_fips using data/county_vars_final_sample_1870.dta
+keep if _merge==3
+drop _merge
+
+gen ytreat_a1950 = (year_treat>=1950 & year_treat<2000)
+
+oaxaca dlndens_rt0 distnmsa30, by(ytreat_a1950) cluster(county_fips) omega
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T3_c1) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+oaxaca dlndens_rt0 lndensinit, by(ytreat_a1950) cluster(county_fips) omega
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T3_c2) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+oaxaca dlndens_rt0 np_county_damc, by(ytreat_a1950) cluster(county_fips) omega
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T3_c3) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+oaxaca dlndens_rt0 cost_kw2000, by(ytreat_a1950) cluster(county_fips) omega
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T3_c4) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+oaxaca dlndens_rt0 (distnmsa30 lndensinit np_county_damc cost_kw2000), /*
+*/ by(ytreat_a1950) cluster(county_fips) omega
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ ctitle(T3_c5) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX TABLE B.1
+********************************************************************************
+********************************************************************************
+
+*1870: D.C. Electric Generator
+*__73: Motors Driven by a Generator
+*__81: Hydroelectric Dam Built Near Niagara Falls
+*__82: Modern Electric Utility Industry Launched
+*__83: Motors Used in Manufacturing
+*__88: A.C. Motor Developed
+*__91: A.C. Power Transmission for Industrial Use
+*__92: A.C. Polyphase Induction Motor Marketed
+*__95: A.C. Generation at Niagara Falls
+*1900: A.C. Generator
+*__01: Right-of-Way Act: Federal Govt. Entitled the Authority to Grant Permits for Hydro Projects
+*__02: Reclamation Act: Federal Water Development Projects Initiated
+*__06: General Dam Act: Private Owners Must Build and Operate Navigation Facilities W/O Compensation
+*__07: State Regulation of Electric Utilities Started (Georgia, New York, and Wisconsin)
+*__14-18: World War I
+*__17: Capacity and Generation of Utilities Exceeded That of Industrial Establishments
+*__20: Federal Water Power Act: Hydroelectric Licenses Revocable After Fifty Years
+*__27: Supreme Court Ruling: Only Federal Govt. Can Regulate Interstate Wholesale Power Transactions
+*__29: Wall Street Crash
+*__33: Tennessee Valley Authority (TVA) Act: Local Development Fostered by Hydroelectricity
+*__35: Federal Power Act: Interstate Wholesale Power Transactions Regulated
+*__39-45: World War II
+*__49: TVA authorized to construct thermal-electric power plants for commercial electricity sale
+*__50s: Construction of High-Voltage (230kV or more) Transmission Lines Began
+*__54: Atomic Energy Act: Private Development of Commercial Nuclear Power Allowed
+*__60: Current Level of Thermal Efficiency of Fossil-Steam Plants Reached
+*__63: Clean Air Act (Amendments in 1970, 1977, and 1990): Pollution Regulation Initiated
+*__64: Wilderness Act: Land Preservation Efforts Became Official
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX TABLE B.2
+********************************************************************************
+********************************************************************************
+
+*Year Total Capacity Industrial Establishments Electric Utilities
+*1889 100.0 55.6 44.4
+*1899 100.0 53.4 46.6
+*1902 100.0 59.6 40.6
+*1907 100.0 60.2 39.8
+*1912 100.0 53.0 47.0
+*1917 100.0 42.0 58.0
+*1920 100.0 34.6 65.4
+*1925 100.0 28.6 71.4
+*1929 100.0 22.9 77.1
+*1935 100.0 19.6 80.4
+*1939 100.0 21.4 78.6
+*1947 100.0 19.7 80.3
+*1954 100.0 13.7 86.3
+*1958 100.0 11.0 89.0
+*1961 100.0 9.0 91.0
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX TABLE B.3
+********************************************************************************
+********************************************************************************
+
+*this is a picture of a page of the volumes with information on hydro dams
+*I provide the .pdf file separately
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX TABLE C.1
+********************************************************************************
+********************************************************************************
+
+*column 1: estimates from first regression for Figure 4
+
+*column 2: estimates from second regression for Figure 4
+
+*column 3: these estimates are reported in the logfile "Dams_logfile.log"
+clear all
+use data/sample_1870.dta, clear
+
+xi: reg lndensity i.county_fips i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_b1950==1 | falsetreat==1), /*
+*/ level(95)
+
+est store b50TC
+
+xi: reg lndensity i.county_fips i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_a1950==1 | falsetreat==1), /*
+*/ level(95)
+
+est store a50TC
+
+suest b50TC a50TC, cluster(county_fips)
+*suest — seemingly unrelated estimation
+
+forvalues i=20(10)60 {
+ lincom [b50TC_mean]evtime`i'b - [a50TC_mean]evtime`i'b
+}
+
+lincom [b50TC_mean]evtime0 - [a50TC_mean]evtime0
+
+forvalues i=10(10)50 {
+ lincom [b50TC_mean]evtime`i'a - [a50TC_mean]evtime`i'a
+}
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX TABLE C.2
+********************************************************************************
+********************************************************************************
+
+*column 1: same as column 1 of APPENDIX TABLE C.1
+
+*column 2: same as column 2 of APPENDIX TABLE C.1
+
+*column 3: estimates from first regression for Figure 6, Panel A
+
+*column 4: estimates from second regression for Figure 6, Panel A
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX TABLE C.3
+********************************************************************************
+********************************************************************************
+
+*column 1: same as column 1 of APPENDIX TABLE C.1
+
+*column 2: same as column 2 of APPENDIX TABLE C.1
+
+*column 3: estimates from first regression for Figure 6, Panel B
+
+*column 4: estimates from second regression for Figure 6, Panel B
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX TABLE C.4
+********************************************************************************
+********************************************************************************
+
+*column 1 (total): estimates from first regression for Figure 7, Panel A
+
+*column 2 (manufacturing): estimates from second regression for Figure 7, Panel A
+
+*column 3 (agriculture): estimates from third regression for Figure 7, Panel A
+
+*column 4 (trade): estimates from fourth regression for Figure 7, Panel A
+
+*column 5 (construction): estimates from fifth regression for Figure 7, Panel A
+
+*column 6 (other sectors): estimates from sixth regression for Figure 7, Panel A
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX TABLE C.5
+********************************************************************************
+********************************************************************************
+
+*column 1 (total): estimates from first regression for Figure 7, Panel B
+
+*column 2 (manufacturing): estimates from second regression for Figure 7, Panel B
+
+*column 3 (agriculture): estimates from third regression for Figure 7, Panel B
+
+*column 4 (trade): estimates from fourth regression for Figure 7, Panel B
+
+*column 5 (construction): estimates from fifth regression for Figure 7, Panel B
+
+*column 6 (other sectors): estimates from sixth regression for Figure 7, Panel B
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX TABLE D.1
+********************************************************************************
+********************************************************************************
+
+*CONSTRUCTING TABLE WITH WEIGHTS FOR THE SYNTHETIC CONTROLS
+clear all
+use data/sample_b1950_1870.dta, clear
+*this dataset was created in the analysis for Figure 8
+
+bysort idcase county_fips: gen n = _n
+keep if n==1
+
+keep county_fips idcase idts id state_fips state_name county_name weight
+keep if weight>=0.15
+
+gen cname=substr(county_name, 1, 1)+ lower(substr(county_name, 2, .))
+replace county_name = cname
+drop cname
+
+sort idcase idts county_fips
+
+*for excel
+sort county_fips idcase idts
+replace weight = . if idts<1000
+sort idcase idts
+
+compress
+save data/synthweights_b1950_1870.dta, replace
+*copy and paste this dataset from Stata to Excel to create the table
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX TABLE D.2
+********************************************************************************
+********************************************************************************
+
+*CONSTRUCTING TABLE WITH WEIGHTS FOR THE SYNTHETIC CONTROLS
+clear all
+use data/sample_a1950_1870.dta, clear
+*this dataset was created in the analysis for Figure 8
+
+bysort idcase county_fips: gen n = _n
+keep if n==1
+
+keep county_fips idcase idts id state_fips state_name county_name weight
+keep if weight>=0.25
+
+gen cname=substr(county_name, 1, 1)+ lower(substr(county_name, 2, .))
+replace county_name = cname
+drop cname
+
+sort idcase idts county_fips
+
+*for excel
+sort county_fips idcase idts
+replace weight = . if idts<1000
+sort idcase idts
+
+compress
+save data/synthweights_a1950_1870.dta, replace
+*copy and paste this dataset from Stata to Excel to create the table
+
+
+********************************************************************************
+********************************************************************************
+***APPENDIX TABLE E.1
+********************************************************************************
+********************************************************************************
+
+*column 1: estimates from first regression for Figure C3, Panel A
+
+*column 2: estimates from second regression for Figure C3, Panel B
+
+*column 3
+clear all
+use data/sample_b1950_1870.dta, clear
+*this dataset was created in the analysis for Figure 8
+
+collapse weight idcase idts id reg_fips div_fips state_fips /*
+*/ latc1 latc2 latc3 lonc1 lonc2 lonc3 lndensity /*
+*/ mp_winter1 mp_spring1 mp_summer1 mp_fall1 /*
+*/ mt_winter1 mt_spring1 mt_summer1 mt_fall1 /*
+*/ railtrack waterway distnearmsa_miles inst1944 /*
+*/ npff_county_year1 npff_county_year2 npff_county_year3 /*
+*/ treated_b1950 treated_a1950 falsetreat treated_ba1950 /*
+*/ evtime100b-evtime80a, by(county_fips year)
+
+xi: areg lndensity i.county_fips i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ [w=weight] if (treated_b1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ keep(evtime100b-evtime20b evtime0-evtime80a) /*
+*/ ctitle(ATE1_c3) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+*column 4
+clear all
+use data/sample_a1950_1870.dta, clear
+*this dataset was also created in the analysis for Figure 8
+
+collapse weight idcase idts id reg_fips div_fips state_fips /*
+*/ latc1 latc2 latc3 lonc1 lonc2 lonc3 lndensity /*
+*/ mp_winter1 mp_spring1 mp_summer1 mp_fall1 /*
+*/ mt_winter1 mt_spring1 mt_summer1 mt_fall1 /*
+*/ railtrack waterway distnearmsa_miles inst1944 /*
+*/ npff_county_year1 npff_county_year2 npff_county_year3 /*
+*/ treated_b1950 treated_a1950 falsetreat treated_ba1950 /*
+*/ evtime100b-evtime80a, by(county_fips year)
+
+xi: areg lndensity i.county_fips i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ [w=weight] if (treated_a1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+outreg2 /*
+*/ using logfiles/Dams_output, /*
+*/ keep(evtime100b-evtime20b evtime0-evtime80a) /*
+*/ ctitle(ATE1_c4) nocons se bdec(4) sdec(4) rdec(4) excel append
+
+
+
+log close
+clear
+
+
+
diff --git a/83/replication_package/dofiles/Dams_Codes_Cleaning.do b/83/replication_package/dofiles/Dams_Codes_Cleaning.do
new file mode 100644
index 0000000000000000000000000000000000000000..788107a5dea889a06d30ec11a6abc74d8528000e
--- /dev/null
+++ b/83/replication_package/dofiles/Dams_Codes_Cleaning.do
@@ -0,0 +1,1689 @@
+clear all
+set more off
+set matsize 10000
+set maxvar 10000
+update all
+
+cd "/Users/edson/Dropbox/Job_Market_Paper/Dams_Codes_Data"
+*When running these codes, please change the directory to
+*whatever folder the data and codes have been saved.
+*Also, create four subfolders within the main folder:
+*"data," "dofiles," "logfiles," and "graphs" –
+*this is crucial to run the codes smoothly.
+*Make sure all the .dta datasets are saved in the
+*subfolder "data," and the dofile is saved in the
+*subfolder "dofiles." The output will be saved in
+*the subfolder "logfiles," and the figures in the
+*subfolder "graphs." Finally, create a subfolder
+*in the “data” subfolder named “parmest,” and a
+*subfolder in the “graphs” subfolder named “data.”
+
+capture log close
+log using logfiles/Dams_cleaning_logfile.log, replace
+
+***************************************************************************
+*DATA FOR MAIN ANALYSIS****************************************************
+***************************************************************************
+clear all
+
+*Deflator data
+import excel data/deflator.xls, sheet("FRED Graph") cellrange(A11:B103) /*
+*/ firstrow allstring clear
+*this dataset can be downloaded from https://fred.stlouisfed.org/series/GDPDEF
+
+gen year = substr(observation_date,-4,4)
+ren A191RD3A086NBEA priceindex
+destring year priceindex, replace
+
+gen double deflator2000aux1 = priceindex if year==2000
+egen double deflator2000aux2 = mean(deflator2000aux1)
+gen double deflator2000 = priceindex/deflator2000aux2
+
+keep year deflator2000
+order year deflator2000
+
+compress
+save data/deflator.dta, replace
+
+import excel data/deflator_historical.xls, sheet("Romer_Stata") firstrow clear
+keep if year<=1929
+*this dataset is from Romer (JPE 1989), who creates a historical deflator from 1869-1929
+save data/deflator_historical.dta, replace
+
+use data/deflator.dta, clear
+drop if year<=1929
+append using data/deflator_historical.dta
+sort year
+save data/deflator.dta, replace
+
+
+
+*Sample to enter data on cost of development from the FERC hydro volumes
+*(similar to the canary paper) and the hand-collected data
+clear all
+use data/egrid2007_generators.dta, clear
+*data source: Emissions & Generation Resource Integrated Database (eGRID)
+*available for download at: https://www.epa.gov/egrid/download-data
+*I've used the 2007 data on generators and plants from the eGRID 2010 dataset
+
+keep if fuelg1=="WAT"
+drop if prmvr=="PS"
+
+sort orispl
+merge m:1 orispl using data/egrid2007_plants_counties.dta
+keep if _merge==3
+drop _merge
+
+bysort county_fips orispl: egen np_plant = sum(namepcap)
+keep if np_plant>=100
+
+bysort county_fips: egen np_county = sum(namepcap)
+
+gen year = 1900 if (genyronl>=1900 & genyronl<1910)
+replace year = 1910 if (genyronl>=1910 & genyronl<1920)
+replace year = 1920 if (genyronl>=1920 & genyronl<1930)
+replace year = 1930 if (genyronl>=1930 & genyronl<1940)
+replace year = 1940 if (genyronl>=1940 & genyronl<1950)
+replace year = 1950 if (genyronl>=1950 & genyronl<1960)
+replace year = 1960 if (genyronl>=1960 & genyronl<1970)
+replace year = 1970 if (genyronl>=1970 & genyronl<1980)
+replace year = 1980 if (genyronl>=1980 & genyronl<1990)
+replace year = 1990 if (genyronl>=1990 & genyronl<2000)
+replace year = 2000 if (genyronl>=2000 & genyronl<2010)
+
+bysort county_fips year: egen np_county_year_aux = sum(namepcap)
+bysort county_fips orispl genyronl: egen np_plant_year = sum(namepcap)
+
+bysort county_fips orispl genyronl: gen n = _n
+keep if n==1
+keep pstatabb pname orispl genyronl county_fips np_plant_year
+
+merge m:1 county_fips using data/counties_tiger_2000.dta
+keep if _merge==3
+drop _merge
+*data source: TIGER/Line Shapefiles, U.S. Census Bureau, downloaded from
+*https://www.census.gov/geographies/mapping-files/time-series/geo/tiger-line-file.2010.html
+
+order pstatabb pname county_name genyronl np_plant_year
+
+compress
+sort pstatabb pname
+save data/egrid_dams_sample.dta, replace
+
+
+import excel data/egrid_dams_sample.xlsx, sheet("cost_develop") firstrow clear
+*the cost of development variable was hand-collected from the “Hydroelectric
+*Plant Construction Cost and Annual Production Expenses” reports, published
+*annually by the Federal Power Commission (FPC) from 1957 until the early 1990s
+*a page of the 1959 report is shown in the Appendix Table B.3 as an example
+drop source
+bysort county_fips orispl: gen n = _n
+keep if n==1
+drop genyronl np_plant_year n
+compress
+save data/egrid_dams_sample_cost_develop.dta, replace
+
+
+
+
+clear all
+use data/inl_all_states.dta, clear
+*this dataset refers to the 1998 U.S. Hydropower Resource Assessment was
+*prepared by the Idaho National Engineering and Environmental Laboratory (INL)
+*for the U.S. Department of Energy (DOE) -- see references in the paper
+*(Conner, Francfort, and Rinehart, 1998; INL, 1998)
+
+keep state county_fips fercnumber damstatus nameplate annenergy pesf pwsprotection pwstributary /*
+*/ pwslocation pfish pwild ptef ptew pflc104 pflc105 pflc106
+
+foreach var in pwsprotection pwstributary pwslocation /*
+*/ pfish pwild ptef ptew pflc104 pflc105 pflc106 {
+ replace `var' = 1 if `var'==0.9
+ replace `var' = 0 if `var'==0.1
+}
+
+egen rowmin = rowmin(pwsprotection pwstributary pwslocation pfish pwild ptef ptew pflc104 pflc105 pflc106)
+
+compress
+foreach var in pwsprotection pwstributary pwslocation /*
+*/ pfish pwild ptef ptew pflc104 pflc105 pflc106 {
+ gen d`var' = (`var'==rowmin)
+}
+
+egen rowtotal = rowtotal(dpwsprotection dpwstributary dpwslocation dpfish dpwild dptef dptew dpflc104 dpflc105 dpflc106)
+
+gen pdev = 1 if (rowmin==1)
+replace pdev = 0.75 if (rowmin==0.75 & rowtotal==1)
+replace pdev = 0.5 if (rowmin==0.75 & rowtotal>1)
+replace pdev = 0.5 if (rowmin==0.5 & rowtotal==1)
+replace pdev = 0.25 if (rowmin==0.5 & rowtotal>1)
+replace pdev = 0.25 if (rowmin==0.25 & rowtotal==1)
+replace pdev = 0 if (rowmin==0.25 & rowtotal>1)
+replace pdev = 0 if (rowmin==0)
+
+*No environmental attributes assigned: 0.90
+*Lowest individual factor(s) = 0.90: 0.90
+*Lowest individual factor = 0.75: 0.75
+*Two or more lowest individual factors = 0.75: 0.50
+*Lowest individual factor = 0.50: 0.50
+*Two or more lowest individual factors = 0.50: 0.25
+*Lowest individual factor = 0.25: 0.25
+*Two or more lowest individual factors = 0.25: 0.10
+*Lowest individual factor(s) = 0.10: 0.10
+
+foreach var in pwsprotection pwstributary pwslocation /*
+*/ pfish pwild ptef ptew pflc104 pflc105 pflc106 /*
+*/ pdev rowmin {
+ replace `var' = 0.9 if `var'==1
+ replace `var' = 0.1 if `var'==0
+}
+
+gen np_pdev = nameplate*pdev
+gen np_dif = nameplate - np_pdev
+
+
+tab damstatus, m
+
+
+keep if nameplate>=100000
+
+merge 1:1 state fercnumber nameplate using data/ihred-29apr03.dta
+drop if _merge==2
+drop _merge
+*this dataset also refers to the 1998 U.S. Hydropower Resource Assessment, which
+*was prepared by the Idaho National Engineering and Environmental Laboratory (INL)
+*for the U.S. Department of Energy (DOE) -- see references in the paper
+*(Conner, Francfort, and Rinehart, 1998; INL, 1998)
+
+collapse (sum) nameplate np_dif (mean) unittotaldevcost unitlicensingcost /*
+*/ unitconstructioncost unitovrnitedevcost unitmittotal, by(county_fips damstatus)
+
+gen np_u_aux = nameplate if damstatus=="U"
+bysort county_fips: egen np_u = max(np_u_aux)
+replace np_u = 0 if np_u==.
+replace np_u = np_u/1000
+drop np_u_aux
+
+gen npdif_u_aux = np_dif if damstatus=="U"
+bysort county_fips: egen npdif_u = max(npdif_u_aux)
+replace npdif_u = 0 if npdif_u==.
+replace npdif_u = npdif_u/1000
+drop npdif_u_aux
+
+gen np_w_aux = nameplate if damstatus=="W"
+bysort county_fips: egen np_w = max(np_w_aux)
+replace np_w = 0 if np_w==.
+replace np_w = np_w/1000
+drop np_w_aux
+
+gen npdif_w_aux = np_dif if damstatus=="W"
+bysort county_fips: egen npdif_w = max(npdif_w_aux)
+replace npdif_w = 0 if npdif_w==.
+replace npdif_w = npdif_w/1000
+drop npdif_w_aux
+
+gen np_wo_aux = nameplate if damstatus=="WO"
+bysort county_fips: egen np_wo = max(np_wo_aux)
+replace np_wo = 0 if np_wo==.
+replace np_wo = np_wo/1000
+drop np_wo_aux
+
+gen npdif_wo_aux = np_dif if damstatus=="WO"
+bysort county_fips: egen npdif_wo = max(npdif_wo_aux)
+replace npdif_wo = 0 if npdif_wo==.
+replace npdif_wo = npdif_wo/1000
+drop npdif_wo_aux
+
+bysort county_fips: gen n = _n
+keep if n==1
+
+sum np_u np_w np_wo npdif_u npdif_w npdif_wo
+
+keep county_fips np_u np_wo npdif_u npdif_wo unittotaldevcost /*
+*/ unitlicensingcost unitconstructioncost unitovrnitedevcost unitmittotal
+*np_w is dropped because it's zero for all observations
+
+gen np_hpot = np_u + np_wo
+gen npdif_hpot = npdif_u + npdif_wo
+
+keep if np_hpot>0
+
+gen pndev = npdif_hpot/np_hpot
+
+compress
+sort county_fips
+save data/hydropot_counties_largeplants100mw.dta, replace
+
+
+
+
+*County latitude and longitude (TIGER data)
+use data/tl_2010_us_county00.dta, clear
+*data source: TIGER/Line Shapefiles, U.S. Census Bureau, downloaded from
+*https://www.census.gov/geographies/mapping-files/time-series/geo/tiger-line-file.2010.html
+
+gen county_fips = CNTYIDFP00
+destring county_fips, replace
+
+gen state_fips = int(county_fips/1000)
+keep if state_fips>=1 & state_fips<=56
+drop if state_fips==2 |state_fips==15
+*Keeping only continental U.S.
+
+gen latc = substr(INTPTLAT00,-10,10)
+destring latc, replace
+
+gen lonc = substr(INTPTLON00,-11,11)
+destring lonc, replace
+replace lonc = lonc * (-1)
+
+gen landarea = (ALAND00*0.000000386)
+*from square meters to square miles
+
+gen county_name = NAME00
+
+keep county_fips county_name latc lonc landarea
+order county_fips county_name latc lonc landarea
+
+compress
+sort county_fips
+save data/county_latlon_landarea.dta, replace
+
+
+
+*County to county distances -- adding county1 among county2
+use data/NBER_gaz1990countydistance100miles.dta, clear
+*this dataset can be downloaded from
+*https://www.nber.org/research/data/county-distance-database
+
+ren mi_to_county dist
+
+expand 2
+
+sort county1 county2
+bysort county1: gen n1 = _n
+bysort county1 county2: gen n2 = _n
+
+replace county2 = county1 if (n1==1 & n2==1)
+replace dist = 0 if (n1==1 & n2==1)
+
+replace n2=1 if (n1==2 & n2==2)
+drop if n2==2
+drop n1 n2
+
+destring county1 county2, replace
+
+compress
+save data/NBER_county2county_distance.dta, replace
+
+
+
+
+*Generating the county-year hydro capacity from large dams (>100MW)
+*(it includes the hand-collected information on the cost of development)
+clear all
+use data/egrid2007_generators.dta, clear
+*data source: Emissions & Generation Resource Integrated Database (eGRID)
+*available for download at: https://www.epa.gov/egrid/download-data
+*I've used the 2007 data on generators and plants from the eGRID 2010 dataset
+
+keep if fuelg1=="WAT"
+drop if prmvr=="PS"
+
+sort orispl
+merge m:1 orispl using data/egrid2007_plants_counties.dta
+keep if _merge==3
+drop _merge
+
+merge m:1 orispl using data/egrid_dams_sample_cost_develop.dta
+drop _merge
+
+ren year_cost_kw_volume year
+merge m:1 year using data/deflator.dta
+drop if _merge==2
+drop _merge
+ren year year_cost_kw_volume
+
+gen cost_kw2000 = cost_kw/deflator2000
+
+bysort county_fips orispl: egen np_plant = sum(namepcap)
+keep if np_plant>=100
+
+bysort county_fips: egen np_county = sum(namepcap)
+
+gen year = 1900 if (genyronl>=1900 & genyronl<1910)
+replace year = 1910 if (genyronl>=1910 & genyronl<1920)
+replace year = 1920 if (genyronl>=1920 & genyronl<1930)
+replace year = 1930 if (genyronl>=1930 & genyronl<1940)
+replace year = 1940 if (genyronl>=1940 & genyronl<1950)
+replace year = 1950 if (genyronl>=1950 & genyronl<1960)
+replace year = 1960 if (genyronl>=1960 & genyronl<1970)
+replace year = 1970 if (genyronl>=1970 & genyronl<1980)
+replace year = 1980 if (genyronl>=1980 & genyronl<1990)
+replace year = 1990 if (genyronl>=1990 & genyronl<2000)
+replace year = 2000 if (genyronl>=2000 & genyronl<2010)
+
+bysort county_fips year: egen np_county_year_aux = sum(namepcap)
+
+bysort county_fips year: gen n = _n
+keep if n==1
+drop n
+
+sort county_fips year
+bysort county_fips: gen np_county_year = sum(np_county_year_aux)
+
+gen year_treat_aux = year if np_county_year>=100
+bysort county_fips: egen year_treat = min(year_treat_aux)
+drop year_treat_aux
+
+keep county_fips year year_treat cost_kw2000 np_county np_county_year_aux np_county_year
+order county_fips year year_treat cost_kw2000 np_county np_county_year_aux np_county_year
+
+sort county_fips
+merge m:1 county_fips using data/hydropot_counties_largeplants100mw.dta
+drop _merge
+
+egen np_pot = rowtotal(np_county np_hpot)
+
+gen sample_aux = 1
+
+compress
+sort county_fips year
+save data/counties_largeplants100mw.dta, replace
+
+
+
+*Generating the final sample for the analysis
+clear all
+use data/pop_c1990.dta, clear
+*data source: county population data downloaded from https://www.nhgis.org
+*harmonized to the county boundaries of 1990 using crosswalks from https://www.fpeckert.me/eglp/
+*harmonization procedure explained in Appendix A.3 "Data Description – County Boundary Adjustments"
+
+sort county_fips
+merge m:1 county_fips using data/county_latlon_landarea.dta
+keep if _merge==3
+drop _merge
+*data source: TIGER/Line Shapefiles, U.S. Census Bureau, downloaded from
+*https://www.census.gov/geographies/mapping-files/time-series/geo/tiger-line-file.2010.html
+
+sort county_fips year
+merge m:1 county_fips year using data/emp_c1990.dta
+drop if _merge==2
+drop _merge
+*data source: county employment data downloaded from https://www.nhgis.org
+*harmonized to the county boundaries of 1990 using crosswalks from https://www.fpeckert.me/eglp/
+*harmonization procedure explained in Appendix A.3 "Data Description – County Boundary Adjustments"
+
+gen density = pop/landarea
+gen lndensity = ln(density)
+
+foreach var in emp agr constr manuf trade otheram other {
+gen dens_`var' = `var'/landarea
+gen lndens_`var' = ln(dens_`var')
+gen lndens1_`var' = ln(dens_`var' + 1)
+}
+
+forvalues i=1(1)3 {
+ gen latc`i' = latc^`i'
+}
+
+replace lonc = lonc*(-1)
+forvalues i=1(1)3 {
+ gen lonc`i' = lonc^`i'
+}
+
+
+sort county_fips
+merge m:1 county_fips using data/climate1950_2000.dta
+drop if _merge==2
+drop _merge
+*data source: Schlenker and Roberts (2009) -- see References
+*data on climatic variables: 50-year average rainfall and 50-year
+*average temperature for each season of the year
+
+foreach var of varlist mp_winter-mt_fall {
+ forvalues i=1(1)4 {
+ gen `var'`i' = `var'^`i'
+ }
+}
+
+
+gen state_fips = int(county_fips/1000)
+
+keep if ((state_fips>=1 & state_fips<=56) & state_fips~=2 & state_fips~=15)
+*Keeping only continental U.S.
+
+
+*Generating division_fips
+gen div_fips = 1 if state_fips==23 | state_fips==33 | state_fips==50 | state_fips==25 | /*
+*/ state_fips==44 | state_fips==9
+replace div_fips = 2 if state_fips==36 | state_fips==34 | state_fips==42
+replace div_fips = 3 if state_fips==39 | state_fips==18 | state_fips==17 | state_fips==26 | state_fips==55
+replace div_fips = 4 if state_fips==27 | state_fips==19 | state_fips==29 | state_fips==38 | state_fips==46 | /*
+*/ state_fips==31 | state_fips==20
+replace div_fips = 5 if state_fips==10 | state_fips==24 | state_fips==11 | state_fips==51 | /*
+*/ state_fips==54 | state_fips==37 | state_fips==45 | state_fips==13 | state_fips==12
+replace div_fips = 6 if state_fips==21 | state_fips==47 | state_fips==1 | state_fips==28
+replace div_fips = 7 if state_fips==5 | state_fips==22 | state_fips==40 | state_fips==48
+replace div_fips = 8 if state_fips==30 | state_fips==16 | state_fips==56 | state_fips==8 | /*
+*/ state_fips==35 | state_fips==4 | state_fips==49 | state_fips==32
+replace div_fips = 9 if state_fips==53 | state_fips==41 | state_fips==6 | state_fips==2 | state_fips==15
+
+*Generating region_fips
+gen reg_fips = 1 if (div_fips==1 | div_fips==2)
+replace reg_fips = 2 if (div_fips==3 | div_fips==4)
+replace reg_fips = 3 if (div_fips==5 | div_fips==6 | div_fips==7)
+replace reg_fips = 4 if (div_fips==8 | div_fips==9)
+
+tab div_fips, gen(div)
+tab reg_fips, gen(reg)
+
+*Northeast Region(1)
+**New England Division(1):
+***Maine(23), New Hampshire(33), Vermont(50), Massachusetts(25), Rhode Island(44), Connecticut(9)
+**Middle Atlantic Division(2):
+***New York(36), New Jersey(34), Pennsylvania(42)
+
+*Midwest Region(2)
+**East North Central Division(3):
+***Ohio(39), Indiana(18), Illinois(17), Michigan(26), Wisconsin(55)
+**West North Central Division(4):
+***Minnesota(27), Iowa(19), Missouri(29), North Dakota(38), South Dakota(46), Nebraska(31), Kansas(20)
+
+*South Region(3)
+**South Atlantic Division(5):
+***Delaware(10), Maryland(24), District of Columbia(11), Virginia(51), West Virginia(54), North Carolina(37),
+***South Carolina(45), Georgia(13), Florida(12)
+**East South Central Division(6):
+***Kentucky(21), Tennessee(47), Alabama(1), Mississippi(28)
+**West South Central Division(7):
+***Arkansas(5), Louisiana(22), Oklahoma(40), Texas(48)
+
+*West Region(4)
+**Mountain Division(8):
+***Montana(30), Idaho(16), Wyoming(56), Colorado(8), New Mexico(35), Arizona(4), Utah(49), Nevada(32)
+**Pacific Division(9):
+***Washington(53), Oregon(41), California(6), Alaska(2), Hawaii(15)
+
+
+order reg_fips div_fips state_fips state_name county_fips county_name year density lndensity latc1-lonc3
+
+
+sort county_fips year
+merge 1:1 county_fips year using data/counties_largeplants100mw.dta
+drop _merge
+
+bysort county_fips: egen sample = max(sample_aux)
+keep if sample==1
+drop sample sample_aux
+
+sort county_fips year
+merge 1:1 county_fips year using data/counties_largeplants100mwff.dta
+drop if _merge==2
+drop _merge
+*data source: Emissions & Generation Resource Integrated Database (eGRID)
+*available for download at: https://www.epa.gov/egrid/download-data
+*I've used the 2007 data on generators and plants from the eGRID 2010 dataset
+*this dataset contain fossil fuel electricity generating capacity from plants larger than 100MW
+*the procedure to obtain this dataset is similar to the one described above for hydroelectric dams
+
+foreach var of varlist np_county np_u np_wo np_hpot np_pot year_treat npff_county {
+ replace `var' = 0 if `var'==.
+ bysort county_fips: egen `var'2 = max(`var')
+ drop `var'
+ ren `var'2 `var'
+}
+
+sort county_fips year
+bysort county_fips: gen np_county_year2 = sum(np_county_year_aux)
+drop np_county_year
+ren np_county_year2 np_county_year
+
+sort county_fips year
+bysort county_fips: gen npff_county_year2 = sum(npff_county_year_aux)
+drop npff_county_year
+ren npff_county_year2 npff_county_year
+
+foreach var of varlist np_county np_u np_wo np_hpot np_pot /*
+*/ np_county_year np_county_year_aux /*
+*/ npff_county npff_county_year npff_county_year_aux {
+ replace `var' = `var'/100
+}
+*np is now measure in 100MW.
+
+forvalues i=1(1)3 {
+ gen np_county_year`i' = np_county_year^`i'
+}
+
+forvalues i=1(1)3 {
+ gen npff_county_year`i' = npff_county_year^`i'
+}
+
+keep if (year>=1870 & year<=2010)
+drop if year_treat==2000
+
+gen treated_b1950 = (year_treat>=1900 & year_treat<1950)
+gen treated_a1950 = (year_treat>=1950 & year_treat<2010)
+gen falsetreat = (year_treat==0)
+
+replace treated_b1950 = . if treated_a1950==1
+replace treated_a1950 = . if treated_b1950==1
+
+gen treated_ba1950 = 1 if treated_b1950==1
+replace treated_ba1950 = 0 if treated_a1950==1
+
+
+
+gen evtime = year - year_treat
+
+replace evtime = . if evtime>100
+replace evtime = -100 if (evtime==-110 |evtime==-120)
+replace evtime = 80 if (evtime==90 |evtime==100)
+*I'm grouping 80 and 90 because there were few 1's for 90. Same for -110 and -120.
+
+tab evtime, gen(evtime)
+
+forvalues i=1(1)19 {
+ replace evtime`i' = 0 if evtime`i'==.
+}
+
+
+sort county_fips
+merge m:1 county_fips using data/market_access.dta
+drop if _merge==2
+drop _merge
+*data source: Donaldson and Hornbeck (2016) -- see References
+*data on mileage of railroad tracks in 1890 and distance to the closest waterway in 1890
+
+merge m:1 county_fips using data/highways_data_Michaels_REStat_2008.dta
+drop if _merge==2
+drop _merge
+*data source: Michaels (2008) -- see References
+*data on access to highways as predicted by the 1944 interstate highway system plan
+
+merge m:1 county_fips using data/nearmsa_edson_1930.dta
+drop if _merge==2
+drop _merge
+*data source: Lewis and Severnini (2020) -- see References
+*data on distance from the county centroid to the nearest metropolitan area in 1930
+
+sort county_fips
+merge 1:1 county_fips year using data/county_distance_trlinesHv.dta
+drop if _merge==2
+drop _merge
+*data source: Joshua Lewis from the University of Montreal (joshua.lewis@umontreal.ca)
+*data on change in access to high-tension transmission lines from the 1930s to 1960s
+*Lewis digitized maps of transmission lines for 1935 and 1962, and calculated distance
+*to high-tension lines from each county centroid using the software ArcGIS
+
+
+gen density1870_aux = density if year==1870
+bysort county_fips: egen density1870 = mean(density1870_aux)
+drop density1870_aux
+gen densityr1870 = (density/density1870)
+
+ren evtime1 evtime100b
+ren evtime2 evtime90b
+ren evtime3 evtime80b
+ren evtime4 evtime70b
+ren evtime5 evtime60b
+ren evtime6 evtime50b
+ren evtime7 evtime40b
+ren evtime8 evtime30b
+ren evtime9 evtime20b
+ren evtime10 evtime10b
+ren evtime11 evtime0
+ren evtime12 evtime10a
+ren evtime13 evtime20a
+ren evtime14 evtime30a
+ren evtime15 evtime40a
+ren evtime16 evtime50a
+ren evtime17 evtime60a
+ren evtime18 evtime70a
+ren evtime19 evtime80a
+
+foreach var of varlist evtime100b-evtime80a {
+ label var `var' ""
+}
+
+capture drop n
+bysort county_fips: gen n=_n
+
+capture drop n _I*
+
+
+
+gen lnpop = ln(pop)
+
+
+tab year_treat, gen(ytreat)
+
+
+*generating changing in access to high-tension transmission lines (1935-1962)
+gen disttrHv1930aux = disttrHv if year==1930
+bysort county_fips: egen disttrHv1930 = max(disttrHv1930aux)
+drop disttrHv1930aux
+
+gen disttrHv1960aux = disttrHv if year==1960
+bysort county_fips: egen disttrHv1960 = max(disttrHv1960aux)
+drop disttrHv1960aux
+
+gen ddisttrHv1930_60 = disttrHv1930 - disttrHv1960
+
+
+*tva counties
+sort county_fips
+merge m:1 county_fips using data/tva.dta
+*this dataset is from Kline and Moretti (2014)
+*see complete reference in the paper
+drop if _merge==2
+drop _merge
+replace tva = 0 if tva==.
+
+
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_b1950==1 | treated_a1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+gen sample = e(sample)
+keep if sample==1
+drop sample
+
+bysort county_fips: gen N=_N
+drop if N<15 & falsetreat==1
+*dropping potential control counties with unbalanced data
+*(but keeping counties with dams with unbalanced data --
+*this includes huge dams such as Hoover, Grand Coulee, etc.
+*which are excluded from the balanced data due to missing
+*information on population density before 1890 or 1900)
+
+compress
+sort county_fips year
+save data/sample_unbalanced_1870.dta, replace
+
+keep if N==15
+*keeping a balanced panel of counties over 1870-2010
+
+compress
+sort county_fips year
+save data/sample_1870.dta, replace
+
+
+
+*Checking whether counties in the donor pool are close to treated counties
+
+clear
+use data/sample_1870.dta, clear
+
+bysort county_fips: gen n1 = _n
+
+keep if falsetreat==1 & n1==1
+keep county_fips county_name falsetreat
+
+compress
+save data/falsetreat_c1990.dta, replace
+
+
+clear
+use data/sample_1870.dta, clear
+
+bysort county_fips: gen n1 = _n
+
+keep if treated_b1950==1 & n1==1
+keep county_fips county_name treated_b1950
+
+compress
+save data/treated_b1950_c1990.dta, replace
+
+
+clear
+use data/sample_1870.dta, clear
+
+bysort county_fips: gen n1 = _n
+
+keep if treated_a1950==1 & n1==1
+keep county_fips county_name treated_a1950
+
+compress
+save data/treated_a1950_c1990.dta, replace
+
+
+
+clear
+use data/NBER_county2county_distance.dta, clear
+
+ren county1 county_fips
+merge m:1 county_fips using data/falsetreat_c1990.dta
+keep if _merge==3
+drop _merge
+ren county_fips county1
+
+ren county2 county_fips
+merge m:1 county_fips using data/treated_b1950_c1990.dta
+drop _merge
+ren county_fips county2
+
+bysort county1: egen max_treatb1950 = max(treated_b1950)
+
+gen dist20aux = dist if (dist<20 & treated_b1950==1)
+bysort county1: egen dist20 = max(dist20aux)
+
+keep if max_treatb1950==1 & dist20<20
+
+bysort county1: gen n = _n
+*keep if n==1
+*no control counties are within 25 miles of the counties treated before 1950
+
+*keep county1 dist20
+
+*replace dist20=1
+
+*ren county1 county_fips
+*ren dist20 dist20_tb1950
+
+*compress
+*save data/control_within20mi_treatb1950_counties.dta, replace
+
+
+
+clear
+use data/NBER_county2county_distance.dta, clear
+
+ren county1 county_fips
+merge m:1 county_fips using data/falsetreat_c1990.dta
+keep if _merge==3
+drop _merge
+ren county_fips county1
+
+ren county2 county_fips
+merge m:1 county_fips using data/treated_a1950_c1990.dta
+drop _merge
+ren county_fips county2
+
+bysort county1: egen max_treata1950 = max(treated_a1950)
+
+gen dist40aux = dist if (dist<40 & treated_a1950==1)
+bysort county1: egen dist40 = max(dist40aux)
+*no control counties are within 20 miles of the counties treated after 1950
+
+keep if max_treata1950==1 & dist40<40
+
+bysort county1: gen n = _n
+keep if n==1
+
+keep county1 dist40
+
+replace dist40=1
+
+ren county1 county_fips
+ren dist40 dist40_ta1940
+*there are 3 potential control counties that are
+*within 40 miles from any treated county after 1950
+
+compress
+save data/control_within40mi_treata1950_counties.dta, replace
+
+
+*Dropping the counties the potential control counties that
+*are within 40 miles from any treated county after 1950
+***************(no potential control county was within
+***************20 miles from any treated county after 1950)
+clear
+use data/sample_1870.dta, clear
+
+merge m:1 county_fips using data/control_within40mi_treata1950_counties.dta
+drop if _merge==3
+drop _merge
+
+compress
+sort county_fips year
+save data/sample_1870.dta, replace
+
+*Keeping only variables used in the analysis
+keep reg_fips div_fips state_fips state_name county_fips county_name year /*
+*/ treated_b1950 treated_a1950 treated_ba1950 falsetreat year_treat /*
+*/ np_u np_wo np_hpot np_pot np_county np_county_year cost_kw2000 /*
+*/ npff_county npff_county_year pop density lndensity densityr1870 emp dens_emp /*
+*/ lndens_emp manuf lndens1_manuf agr lndens1_agr trade lndens1_trade constr /*
+*/ lndens1_constr other lndens1_other latc1 latc2 latc3 lonc1 lonc2 lonc3 /*
+*/ mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1 /*
+*/ railtrack waterway distnearmsa_miles inst1944 np_county_year1-np_county_year3 /*
+*/ npff_county_year1-npff_county_year3 disttrHv1930 disttrHv1960 ddisttrHv1930_60 /*
+*/ tva reg1-reg4 evtime evtime100b-evtime80a
+
+order reg_fips div_fips state_fips state_name county_fips county_name year /*
+*/ treated_b1950 treated_a1950 treated_ba1950 falsetreat year_treat /*
+*/ np_u np_wo np_hpot np_pot np_county np_county_year cost_kw2000 /*
+*/ npff_county npff_county_year pop density lndensity densityr1870 emp dens_emp /*
+*/ lndens_emp manuf lndens1_manuf agr lndens1_agr trade lndens1_trade constr /*
+*/ lndens1_constr other lndens1_other latc1 latc2 latc3 lonc1 lonc2 lonc3 /*
+*/ mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1 /*
+*/ railtrack waterway distnearmsa_miles inst1944 np_county_year1-np_county_year3 /*
+*/ npff_county_year1-npff_county_year3 disttrHv1930 disttrHv1960 ddisttrHv1930_60 /*
+*/ tva reg1-reg4 evtime evtime100b-evtime80a
+
+label var reg_fips "Census Region FIPS"
+label var div_fips "Census Divisions FIPS"
+label var state_fips "State FIPS"
+label var state_name "State name"
+label var county_fips "County FIPS"
+label var county_name "County name"
+label var year "Year (decade)"
+label var treated_b1950 "Dummy for county treated with a hydro dam before 1950"
+label var treated_a1950 "Dummy for county treated with a hydro dam after 1950"
+label var treated_ba1950 "Dummy for county treated with a hydro dam"
+label var falsetreat "Dummy for county never treated with a hydro dam"
+label var year_treat "Year (decade) when county is treated with a hydro dam"
+label var np_u "Undeveloped hydropower potential (100W)"
+label var np_wo "Undeveloped hydro potential but w/ developed impoundment (100W)"
+label var np_hpot "Undeveloped hydropower potential (100W) [np_hpot = np_u + np_wo]"
+label var np_pot "Hydropower potential (100W) [np_pot = np_county + np_hpot]"
+label var np_county "Installed hydro capacity in 2000 (100W)"
+label var np_county_year "Cumulative installed hydro capacity (100W)"
+label var cost_kw2000 "Cost of developing hydro dam per kW of capacity (2000 USD)"
+label var npff_county "Installed steam-electric capacity in 2000 (100W)"
+label var npff_county_year "Cumulative installed steam-electric capacity (100W)"
+label var pop "Population"
+label var density "Population density"
+label var lndensity "ln(population density)"
+label var densityr1870 "Pop density relative to density in 1870"
+label var emp "Employment"
+label var dens_emp "Employment density"
+label var lndens_emp "ln(employment density)"
+label var manuf "Employment in manufacturing"
+label var lndens1_manuf "ln(emmployment in manufacturing)"
+label var agr "Employment in agriculture"
+label var lndens1_agr "ln(employment in agriculture)"
+label var trade "Employment in retail and wholesale trade"
+label var lndens1_trade "ln(employment in retail and wholesale trade)"
+label var constr "Employment in construction"
+label var lndens1_constr "ln(employment in construction)"
+label var other "Employment in other sectors"
+label var lndens1_other "ln(employment in other sectors)"
+label var latc1 "County-centroid catitude"
+label var latc2 "squared latc1"
+label var latc3 "cubic latc1"
+label var lonc1 "County-centroid longitude"
+label var lonc2 "squared lonc1"
+label var lonc3 "cubic lonc1"
+label var mt_summer1 "Average summer temperature (degrees Celsius)"
+label var mt_fall1 "Average fall temperature (degrees Celsius)"
+label var mt_winter1 "Average winter temperature (degrees Celsius)"
+label var mt_spring1 "Average spring temperature (degrees Celsius)"
+label var mp_summer1 "Average summer precipitation (centimeters)"
+label var mp_fall1 "Average fall precipitation (centimeters)"
+label var mp_winter1 "Average winter precipitation (centimeters)"
+label var mp_spring1 "Average spring precipitation (centimeters)"
+label var railtrack "Railroads tracks within county (meters, 1890)"
+label var waterway "Distance to nearest waterway (meters, 1890)"
+label var distnearmsa_miles "Distance to nearest MSA (miles, 1930)"
+label var inst1944 "Dummy for roads predicted to cut through county by 1944 Highway Plan"
+label var np_county_year1 "np_county_year"
+label var np_county_year2 "squared np_county_year"
+label var np_county_year3 "cubic np_county_year"
+label var npff_county_year1 "npff_county_year"
+label var npff_county_year2 "squared npff_county_year"
+label var npff_county_year3 "cubic npff_county_year"
+label var disttrHv1930 "Distance to high-tension transmission lines in 1935"
+label var disttrHv1960 "Distance to high-tension transmission lines in 1962"
+label var ddisttrHv1930_60 "ddisttrHv1930_60 = disttrHv1930 - disttrHv1960"
+label var tva "Dummy for counties within TVA"
+label var reg1 "Census Region 1: Northeast"
+label var reg2 "Census Region 2: Midwest"
+label var reg3 "Census Region 3: South"
+label var reg4 "Census Region 4: West"
+label var evtime "evtime = year - year_treat"
+label var evtime100b "Dummy for 100 years before hydro dam opening"
+label var evtime90b "Dummy for 90 years before hydro dam opening"
+label var evtime80b "Dummy for 80 years before hydro dam opening"
+label var evtime70b "Dummy for 70 years before hydro dam opening"
+label var evtime60b "Dummy for 60 years before hydro dam opening"
+label var evtime50b "Dummy for 50 years before hydro dam opening"
+label var evtime40b "Dummy for 40 years before hydro dam opening"
+label var evtime30b "Dummy for 30 years before hydro dam opening"
+label var evtime20b "Dummy for 20 years before hydro dam opening"
+label var evtime10b "Dummy for 10 years before hydro dam opening"
+label var evtime0 "Dummy for year (decade) of hydro dam opening"
+label var evtime10a "Dummy for 10 years after hydro dam opening"
+label var evtime20a "Dummy for 20 years after hydro dam opening"
+label var evtime30a "Dummy for 30 years after hydro dam opening"
+label var evtime40a "Dummy for 40 years after hydro dam opening"
+label var evtime50a "Dummy for 50 years after hydro dam opening"
+label var evtime60a "Dummy for 60 years after hydro dam opening"
+label var evtime70a "Dummy for 70 years after hydro dam opening"
+label var evtime80a "Dummy for 80 years after hydro dam opening"
+
+compress
+sort county_fips year
+save data/sample_1870.dta, replace
+
+
+
+
+*Dropping the counties the potential control counties that
+*are within 40 miles from any treated county after 1950
+***************(no potential control county was within
+***************20 miles from any treated county after 1950)
+clear
+use data/sample_unbalanced_1870.dta, clear
+
+merge m:1 county_fips using data/control_within40mi_treata1950_counties.dta
+drop if _merge==3
+drop _merge
+
+compress
+sort county_fips year
+save data/sample_unbalanced_1870.dta, replace
+
+*Keeping only variables used in the analysis
+keep reg_fips div_fips state_fips state_name county_fips county_name year /*
+*/ treated_b1950 treated_a1950 treated_ba1950 falsetreat year_treat /*
+*/ np_u np_wo np_hpot np_pot np_county np_county_year cost_kw2000 /*
+*/ npff_county npff_county_year pop density lndensity densityr1870 emp dens_emp /*
+*/ lndens_emp manuf lndens1_manuf agr lndens1_agr trade lndens1_trade constr /*
+*/ lndens1_constr other lndens1_other latc1 latc2 latc3 lonc1 lonc2 lonc3 /*
+*/ mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1 /*
+*/ railtrack waterway distnearmsa_miles inst1944 np_county_year1-np_county_year3 /*
+*/ npff_county_year1-npff_county_year3 disttrHv1930 disttrHv1960 ddisttrHv1930_60 /*
+*/ tva reg1-reg4 evtime evtime100b-evtime80a
+
+order reg_fips div_fips state_fips state_name county_fips county_name year /*
+*/ treated_b1950 treated_a1950 treated_ba1950 falsetreat year_treat /*
+*/ np_u np_wo np_hpot np_pot np_county np_county_year cost_kw2000 /*
+*/ npff_county npff_county_year pop density lndensity densityr1870 emp dens_emp /*
+*/ lndens_emp manuf lndens1_manuf agr lndens1_agr trade lndens1_trade constr /*
+*/ lndens1_constr other lndens1_other latc1 latc2 latc3 lonc1 lonc2 lonc3 /*
+*/ mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1 /*
+*/ railtrack waterway distnearmsa_miles inst1944 np_county_year1-np_county_year3 /*
+*/ npff_county_year1-npff_county_year3 disttrHv1930 disttrHv1960 ddisttrHv1930_60 /*
+*/ tva reg1-reg4 evtime evtime100b-evtime80a
+
+label var reg_fips "Census Region FIPS"
+label var div_fips "Census Divisions FIPS"
+label var state_fips "State FIPS"
+label var state_name "State name"
+label var county_fips "County FIPS"
+label var county_name "County name"
+label var year "Year (decade)"
+label var treated_b1950 "Dummy for county treated with a hydro dam before 1950"
+label var treated_a1950 "Dummy for county treated with a hydro dam after 1950"
+label var treated_ba1950 "Dummy for county treated with a hydro dam"
+label var falsetreat "Dummy for county never treated with a hydro dam"
+label var year_treat "Year (decade) when county is treated with a hydro dam"
+label var np_u "Undeveloped hydropower potential (100W)"
+label var np_wo "Undeveloped hydro potential but w/ developed impoundment (100W)"
+label var np_hpot "Undeveloped hydropower potential (100W) [np_hpot = np_u + np_wo]"
+label var np_pot "Hydropower potential (100W) [np_pot = np_county + np_hpot]"
+label var np_county "Installed hydro capacity in 2000 (100W)"
+label var np_county_year "Cumulative installed hydro capacity (100W)"
+label var cost_kw2000 "Cost of developing hydro dam per kW of capacity (2000 USD)"
+label var npff_county "Installed steam-electric capacity in 2000 (100W)"
+label var npff_county_year "Cumulative installed steam-electric capacity (100W)"
+label var pop "Population"
+label var density "Population density"
+label var lndensity "ln(population density)"
+label var densityr1870 "Pop density relative to density in 1870"
+label var emp "Employment"
+label var dens_emp "Employment density"
+label var lndens_emp "ln(employment density)"
+label var manuf "Employment in manufacturing"
+label var lndens1_manuf "ln(emmployment in manufacturing)"
+label var agr "Employment in agriculture"
+label var lndens1_agr "ln(employment in agriculture)"
+label var trade "Employment in retail and wholesale trade"
+label var lndens1_trade "ln(employment in retail and wholesale trade)"
+label var constr "Employment in construction"
+label var lndens1_constr "ln(employment in construction)"
+label var other "Employment in other sectors"
+label var lndens1_other "ln(employment in other sectors)"
+label var latc1 "County-centroid catitude"
+label var latc2 "squared latc1"
+label var latc3 "cubic latc1"
+label var lonc1 "County-centroid longitude"
+label var lonc2 "squared lonc1"
+label var lonc3 "cubic lonc1"
+label var mt_summer1 "Average summer temperature (degrees Celsius)"
+label var mt_fall1 "Average fall temperature (degrees Celsius)"
+label var mt_winter1 "Average winter temperature (degrees Celsius)"
+label var mt_spring1 "Average spring temperature (degrees Celsius)"
+label var mp_summer1 "Average summer precipitation (centimeters)"
+label var mp_fall1 "Average fall precipitation (centimeters)"
+label var mp_winter1 "Average winter precipitation (centimeters)"
+label var mp_spring1 "Average spring precipitation (centimeters)"
+label var railtrack "Railroads tracks within county (meters, 1890)"
+label var waterway "Distance to nearest waterway (meters, 1890)"
+label var distnearmsa_miles "Distance to nearest MSA (miles, 1930)"
+label var inst1944 "Dummy for roads predicted to cut through county by 1944 Highway Plan"
+label var np_county_year1 "np_county_year"
+label var np_county_year2 "squared np_county_year"
+label var np_county_year3 "cubic np_county_year"
+label var npff_county_year1 "npff_county_year"
+label var npff_county_year2 "squared npff_county_year"
+label var npff_county_year3 "cubic npff_county_year"
+label var disttrHv1930 "Distance to high-tension transmission lines in 1935"
+label var disttrHv1960 "Distance to high-tension transmission lines in 1962"
+label var ddisttrHv1930_60 "ddisttrHv1930_60 = disttrHv1930 - disttrHv1960"
+label var tva "Dummy for counties within TVA"
+label var reg1 "Census Region 1: Northeast"
+label var reg2 "Census Region 2: Midwest"
+label var reg3 "Census Region 3: South"
+label var reg4 "Census Region 4: West"
+label var evtime "evtime = year - year_treat"
+label var evtime100b "Dummy for 100 years before hydro dam opening"
+label var evtime90b "Dummy for 90 years before hydro dam opening"
+label var evtime80b "Dummy for 80 years before hydro dam opening"
+label var evtime70b "Dummy for 70 years before hydro dam opening"
+label var evtime60b "Dummy for 60 years before hydro dam opening"
+label var evtime50b "Dummy for 50 years before hydro dam opening"
+label var evtime40b "Dummy for 40 years before hydro dam opening"
+label var evtime30b "Dummy for 30 years before hydro dam opening"
+label var evtime20b "Dummy for 20 years before hydro dam opening"
+label var evtime10b "Dummy for 10 years before hydro dam opening"
+label var evtime0 "Dummy for year (decade) of hydro dam opening"
+label var evtime10a "Dummy for 10 years after hydro dam opening"
+label var evtime20a "Dummy for 20 years after hydro dam opening"
+label var evtime30a "Dummy for 30 years after hydro dam opening"
+label var evtime40a "Dummy for 40 years after hydro dam opening"
+label var evtime50a "Dummy for 50 years after hydro dam opening"
+label var evtime60a "Dummy for 60 years after hydro dam opening"
+label var evtime70a "Dummy for 70 years after hydro dam opening"
+label var evtime80a "Dummy for 80 years after hydro dam opening"
+
+compress
+sort county_fips year
+save data/sample_unbalanced_1870.dta, replace
+
+
+
+
+
+
+
+
+
+
+*********************************************************************************************************
+*DATA FOR 308 REPORT SERIES ANALYSIS*********************************************************************
+*********************************************************************************************************
+clear all
+use data/Hydropower_USA_Developed_1953.dta, clear
+gen develop = 1
+append using data/Hydropower_USA_Undeveloped_1953.dta
+replace develop = 0 if develop==.
+*data source: 308 reports series available at
+*https://www.iwr.usace.army.mil/Library/IWR-Library/308-Reports-Program-Series/
+
+gen county_fips = (statefips*1000) + countyfips
+egen costdev = rowmin(c_power-c_balanced)
+*mills per kilowatthour (kWh) equals dollars per megawatthour (mWh)
+*a mill is equal to 1/1,000 of a U.S. dollar, or 1/10 of one cent
+
+ren installed_capacity_kw np_hpot
+replace np_hpot = np_hpot/1000
+*now measure in MW
+
+keep if np_hpot>=60
+
+collapse (sum) np_hpot (mean) costdev, by(statefips county_fips develop)
+drop if county_fips==.
+ren statefips state_fips
+
+compress
+save data/hydro308reports_1870.dta, replace
+
+use data/hydro308reports_1870.dta, clear
+keep if develop==1 & costdev~=.
+ren np_hpot hydrocap
+save data/hydro308reports_costdev1_1870.dta, replace
+
+use data/hydro308reports_1870.dta, clear
+keep if develop==0 & costdev~=.
+save data/hydro308reports_costdev0_1870.dta, replace
+
+
+
+
+
+clear
+use data/egrid2007_generators.dta, clear
+*data source: Emissions & Generation Resource Integrated Database (eGRID)
+*available for download at: https://www.epa.gov/egrid/download-data
+*I've used the 2007 data on generators and plants from the eGRID 2010 dataset
+
+keep if fuelg1=="WAT"
+drop if prmvr=="PS"
+
+sort orispl
+merge m:1 orispl using data/egrid2007_plants_counties.dta
+keep if _merge==3
+drop _merge
+
+bysort county_fips orispl: egen np_plant = sum(namepcap)
+keep if np_plant>=100
+
+bysort county_fips: egen np_county = sum(namepcap)
+
+gen year = 1900 if (genyronl>=1900 & genyronl<1910)
+replace year = 1910 if (genyronl>=1910 & genyronl<1920)
+replace year = 1920 if (genyronl>=1920 & genyronl<1930)
+replace year = 1930 if (genyronl>=1930 & genyronl<1940)
+replace year = 1940 if (genyronl>=1940 & genyronl<1950)
+replace year = 1950 if (genyronl>=1950 & genyronl<1960)
+replace year = 1960 if (genyronl>=1960 & genyronl<1970)
+replace year = 1970 if (genyronl>=1970 & genyronl<1980)
+replace year = 1980 if (genyronl>=1980 & genyronl<1990)
+replace year = 1990 if (genyronl>=1990 & genyronl<2000)
+replace year = 2000 if (genyronl>=2000 & genyronl<2010)
+
+bysort county_fips year: egen np_county_year_aux = sum(namepcap)
+
+bysort county_fips year: gen n = _n
+keep if n==1
+drop n
+
+sort county_fips year
+bysort county_fips: gen np_county_year = sum(np_county_year_aux)
+
+gen year_treat_aux = year if np_county_year>=100
+bysort county_fips: egen year_treat = min(year_treat_aux)
+drop year_treat_aux
+
+keep county_fips year year_treat np_county np_county_year_aux np_county_year
+order county_fips year year_treat np_county np_county_year_aux np_county_year
+
+sort county_fips
+merge m:1 county_fips using data/hydro308reports_costdev1_1870.dta
+drop _merge
+sort county_fips
+merge m:1 county_fips using data/hydro308reports_costdev0_1870.dta
+drop _merge
+
+drop if develop==.
+
+egen np_pot = rowtotal(np_county np_hpot)
+
+gen sample_aux = 1
+
+compress
+sort county_fips year
+save data/counties_largeplants100mw_308series_costdev_1870.dta, replace
+
+
+
+
+
+
+
+clear all
+use data/pop_c1990.dta, clear
+*data source: county population data downloaded from https://www.nhgis.org
+*harmonized to the county boundaries of 1990 using crosswalks from https://www.fpeckert.me/eglp/
+*harmonization procedure explained in Appendix A.3 "Data Description – County Boundary Adjustments"
+
+sort county_fips
+merge m:1 county_fips using data/county_latlon_landarea.dta
+keep if _merge==3
+drop _merge
+*data source: TIGER/Line Shapefiles, U.S. Census Bureau, downloaded from
+*https://www.census.gov/geographies/mapping-files/time-series/geo/tiger-line-file.2010.html
+
+sort county_fips year
+merge m:1 county_fips year using data/emp_c1990.dta
+drop if _merge==2
+drop _merge
+*data source: county employment data downloaded from https://www.nhgis.org
+*harmonized to the county boundaries of 1990 using crosswalks from https://www.fpeckert.me/eglp/
+*harmonization procedure explained in Appendix A.3 "Data Description – County Boundary Adjustments"
+
+gen density = pop/landarea
+gen lndensity = ln(density)
+
+foreach var in emp agr constr manuf trade otheram other {
+gen dens_`var' = `var'/landarea
+gen lndens_`var' = ln(dens_`var')
+gen lndens1_`var' = ln(dens_`var' + 1)
+}
+
+forvalues i=1(1)3 {
+ gen latc`i' = latc^`i'
+}
+
+replace lonc = lonc*(-1)
+forvalues i=1(1)3 {
+ gen lonc`i' = lonc^`i'
+}
+
+
+sort county_fips
+merge m:1 county_fips using data/climate1950_2000.dta
+drop if _merge==2
+drop _merge
+*data source: Schlenker and Roberts (2009) -- see References
+*data on climatic variables: 50-year average rainfall and 50-year
+*average temperature for each season of the year
+
+foreach var of varlist mp_winter-mt_fall {
+ forvalues i=1(1)3 {
+ gen `var'`i' = `var'^`i'
+ }
+}
+
+
+gen state_fips = int(county_fips/1000)
+
+keep if ((state_fips>=1 & state_fips<=56) & state_fips~=2 & state_fips~=15)
+*Keeping only continental U.S.
+
+
+*Generating division_fips
+gen div_fips = 1 if state_fips==23 | state_fips==33 | state_fips==50 | state_fips==25 | /*
+*/ state_fips==44 | state_fips==9
+replace div_fips = 2 if state_fips==36 | state_fips==34 | state_fips==42
+replace div_fips = 3 if state_fips==39 | state_fips==18 | state_fips==17 | state_fips==26 | state_fips==55
+replace div_fips = 4 if state_fips==27 | state_fips==19 | state_fips==29 | state_fips==38 | state_fips==46 | /*
+*/ state_fips==31 | state_fips==20
+replace div_fips = 5 if state_fips==10 | state_fips==24 | state_fips==11 | state_fips==51 | /*
+*/ state_fips==54 | state_fips==37 | state_fips==45 | state_fips==13 | state_fips==12
+replace div_fips = 6 if state_fips==21 | state_fips==47 | state_fips==1 | state_fips==28
+replace div_fips = 7 if state_fips==5 | state_fips==22 | state_fips==40 | state_fips==48
+replace div_fips = 8 if state_fips==30 | state_fips==16 | state_fips==56 | state_fips==8 | /*
+*/ state_fips==35 | state_fips==4 | state_fips==49 | state_fips==32
+replace div_fips = 9 if state_fips==53 | state_fips==41 | state_fips==6 | state_fips==2 | state_fips==15
+
+*Generating region_fips
+gen reg_fips = 1 if (div_fips==1 | div_fips==2)
+replace reg_fips = 2 if (div_fips==3 | div_fips==4)
+replace reg_fips = 3 if (div_fips==5 | div_fips==6 | div_fips==7)
+replace reg_fips = 4 if (div_fips==8 | div_fips==9)
+
+tab div_fips, gen(div)
+tab reg_fips, gen(reg)
+
+*Northeast Region(1)
+**New England Division(1):
+***Maine(23), New Hampshire(33), Vermont(50), Massachusetts(25), Rhode Island(44), Connecticut(9)
+**Middle Atlantic Division(2):
+***New York(36), New Jersey(34), Pennsylvania(42)
+
+*Midwest Region(2)
+**East North Central Division(3):
+***Ohio(39), Indiana(18), Illinois(17), Michigan(26), Wisconsin(55)
+**West North Central Division(4):
+***Minnesota(27), Iowa(19), Missouri(29), North Dakota(38), South Dakota(46), Nebraska(31), Kansas(20)
+
+*South Region(3)
+**South Atlantic Division(5):
+***Delaware(10), Maryland(24), District of Columbia(11), Virginia(51), West Virginia(54), North Carolina(37),
+***South Carolina(45), Georgia(13), Florida(12)
+**East South Central Division(6):
+***Kentucky(21), Tennessee(47), Alabama(1), Mississippi(28)
+**West South Central Division(7):
+***Arkansas(5), Louisiana(22), Oklahoma(40), Texas(48)
+
+*West Region(4)
+**Mountain Division(8):
+***Montana(30), Idaho(16), Wyoming(56), Colorado(8), New Mexico(35), Arizona(4), Utah(49), Nevada(32)
+**Pacific Division(9):
+***Washington(53), Oregon(41), California(6), Alaska(2), Hawaii(15)
+
+
+order reg_fips div_fips state_fips state_name county_fips county_name year density lndensity latc1-lonc3
+
+sort county_fips year
+merge 1:1 county_fips year using data/counties_largeplants100mw_308series_costdev_1870.dta
+drop _merge
+
+ren costdev costdev_aux
+bysort county_fips: egen costdev = mean(costdev_aux)
+
+bysort county_fips: egen sample = max(sample_aux)
+keep if sample==1
+drop sample sample_aux
+
+sort county_fips year
+merge 1:1 county_fips year using data/counties_largeplants100mwff.dta
+drop if _merge==2
+drop _merge
+*data source: Emissions & Generation Resource Integrated Database (eGRID)
+*available for download at: https://www.epa.gov/egrid/download-data
+*I've used the 2007 data on generators and plants from the eGRID 2010 dataset
+*this dataset contain fossil fuel electricity generating capacity from plants larger than 100MW
+*the procedure to obtain this dataset is similar to the one described above for hydroelectric dams
+
+foreach var of varlist np_county np_hpot np_pot year_treat npff_county {
+ replace `var' = 0 if `var'==.
+ bysort county_fips: egen `var'2 = max(`var')
+ drop `var'
+ ren `var'2 `var'
+}
+
+sort county_fips year
+bysort county_fips: gen np_county_year2 = sum(np_county_year_aux)
+drop np_county_year
+ren np_county_year2 np_county_year
+
+sort county_fips year
+bysort county_fips: gen npff_county_year2 = sum(npff_county_year_aux)
+drop npff_county_year
+ren npff_county_year2 npff_county_year
+
+foreach var of varlist np_county np_hpot np_pot /*
+*/ np_county_year np_county_year_aux /*
+*/ npff_county npff_county_year npff_county_year_aux {
+ replace `var' = `var'/100
+}
+*np is now measure in 100MW.
+
+forvalues i=1(1)3 {
+ gen np_county_year`i' = np_county_year^`i'
+}
+
+forvalues i=1(1)3 {
+ gen npff_county_year`i' = npff_county_year^`i'
+}
+
+keep if (year>=1870 & year<=2010)
+drop if year_treat==2000
+
+gen treated_b1950 = (year_treat>=1900 & year_treat<1950)
+gen treated_a1950 = (year_treat>=1950 & year_treat<2000)
+gen falsetreat = (year_treat==0)
+
+replace treated_b1950 = . if treated_a1950==1
+replace treated_a1950 = . if treated_b1950==1
+
+gen treated_ba1950 = 1 if treated_b1950==1
+replace treated_ba1950 = 0 if treated_a1950==1
+
+
+gen evtime = year - year_treat
+
+replace evtime = . if evtime>100
+replace evtime = -100 if (evtime==-110 |evtime==-120)
+replace evtime = 80 if (evtime==90 |evtime==100)
+*I'm grouping 80 and 90 because there were few 1's for 90. Same for -110 and -120.
+
+tab evtime, gen(evtime)
+
+forvalues i=1(1)19 {
+ replace evtime`i' = 0 if evtime`i'==.
+ *replace evtime`i' = evtime`i'*np_county_year if np_county_year>0
+ *replace evtime`i' = evtime`i'+np_county_year if np_county_year>0
+}
+
+
+sort county_fips
+merge m:1 county_fips using data/market_access.dta
+drop if _merge==2
+drop _merge
+*data source: Donaldson and Hornbeck (2016) -- see References
+*data on mileage of railroad tracks in 1890 and distance to the closest waterway in 1890
+
+merge m:1 county_fips using data/highways_data_Michaels_REStat_2008.dta
+drop if _merge==2
+drop _merge
+*data source: Michaels (2008) -- see References
+*data on access to highways as predicted by the 1944 interstate highway system plan
+
+merge m:1 county_fips using data/nearmsa_edson_1930.dta
+drop if _merge==2
+drop _merge
+*data source: Lewis and Severnini (2020) -- see References
+*data on distance from the county centroid to the nearest metropolitan area in 1930
+
+sort county_fips
+merge 1:1 county_fips year using data/county_distance_trlinesHv.dta
+drop if _merge==2
+drop _merge
+*data source: Joshua Lewis from the University of Montreal (joshua.lewis@umontreal.ca)
+*data on change in access to high-tension transmission lines from the 1930s to 1960s
+*Lewis digitized maps of transmission lines for 1935 and 1962, and calculated distance
+*to high-tension lines from each county centroid using the software ArcGIS
+
+
+gen dens1870_aux = density if year==1870
+bysort county_fips: egen dens1870 = max(dens1870_aux)
+drop dens1870_aux
+
+gen lndensity1870_aux = lndensity if year==1870
+bysort county_fips: egen lndensity1870 = max(lndensity1870_aux)
+drop lndensity1870_aux
+
+gen lndensity1870_2 = lndensity1870^2
+gen lndensity1870_3 = lndensity1870^3
+
+foreach v of varlist dens1870 {
+ egen med`v' = median(`v') if treated_b1950==1
+ gen lc`v' = (`v' < med`v')
+ gen hc`v' = (`v' >= med`v')
+}
+
+ren evtime1 evtime100b
+ren evtime2 evtime90b
+ren evtime3 evtime80b
+ren evtime4 evtime70b
+ren evtime5 evtime60b
+ren evtime6 evtime50b
+ren evtime7 evtime40b
+ren evtime8 evtime30b
+ren evtime9 evtime20b
+ren evtime10 evtime10b
+ren evtime11 evtime0
+ren evtime12 evtime10a
+ren evtime13 evtime20a
+ren evtime14 evtime30a
+ren evtime15 evtime40a
+ren evtime16 evtime50a
+ren evtime17 evtime60a
+ren evtime18 evtime70a
+ren evtime19 evtime80a
+
+foreach var of varlist evtime100b-evtime80a {
+ label var `var' ""
+}
+
+capture drop n
+bysort county_fips: gen n=_n
+
+capture drop n _I*
+
+
+tab year_treat, gen(ytreat)
+
+
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 i.year*costdev /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_b1950==1 | treated_a1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+gen sample = e(sample)
+keep if sample==1
+drop sample
+
+capture drop n
+bysort county_fips: gen N=_N
+keep if N==15
+*to keep a balanced panel of counties over 1870-2010
+
+
+compress
+sort county_fips year
+save data/sample_308series_costdev_1870.dta, replace
+
+
+*Keeping only variables used in the analysis
+keep reg_fips div_fips state_fips state_name county_fips county_name year /*
+*/ treated_b1950 treated_a1950 treated_ba1950 falsetreat year_treat /*
+*/ np_hpot np_pot np_county np_county_year costdev /*
+*/ npff_county npff_county_year pop density lndensity emp dens_emp /*
+*/ lndens_emp manuf lndens1_manuf agr lndens1_agr trade lndens1_trade constr /*
+*/ lndens1_constr other lndens1_other latc1 latc2 latc3 lonc1 lonc2 lonc3 /*
+*/ mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1 /*
+*/ railtrack waterway distnearmsa_miles inst1944 np_county_year1-np_county_year3 /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ reg1-reg4 evtime evtime100b-evtime80a
+
+order reg_fips div_fips state_fips state_name county_fips county_name year /*
+*/ treated_b1950 treated_a1950 treated_ba1950 falsetreat year_treat /*
+*/ np_hpot np_pot np_county np_county_year costdev /*
+*/ npff_county npff_county_year pop density lndensity emp dens_emp /*
+*/ lndens_emp manuf lndens1_manuf agr lndens1_agr trade lndens1_trade constr /*
+*/ lndens1_constr other lndens1_other latc1 latc2 latc3 lonc1 lonc2 lonc3 /*
+*/ mt_summer1 mt_fall1 mt_winter1 mt_spring1 mp_summer1 mp_fall1 mp_winter1 mp_spring1 /*
+*/ railtrack waterway distnearmsa_miles inst1944 np_county_year1-np_county_year3 /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ reg1-reg4 evtime evtime100b-evtime80a
+
+label var reg_fips "Census Region FIPS"
+label var div_fips "Census Divisions FIPS"
+label var state_fips "State FIPS"
+label var state_name "State name"
+label var county_fips "County FIPS"
+label var county_name "County name"
+label var year "Year (decade)"
+label var treated_b1950 "Dummy for county treated with a hydro dam before 1950"
+label var treated_a1950 "Dummy for county treated with a hydro dam after 1950"
+label var treated_ba1950 "Dummy for county treated with a hydro dam"
+label var falsetreat "Dummy for county never treated with a hydro dam"
+label var year_treat "Year (decade) when county is treated with a hydro dam"
+label var np_hpot "Undeveloped hydropower potential (100W)"
+label var np_pot "Hydropower potential (100W) [np_pot = np_county + np_hpot]"
+label var np_county "Installed hydro capacity in 2000 (100W)"
+label var np_county_year "Cumulative installed hydro capacity (100W)"
+label var npff_county "Installed steam-electric capacity in 2000 (100W)"
+label var npff_county_year "Cumulative installed steam-electric capacity (100W)"
+label var costdev "Ex-ante cost of hydro development (mills per kWh)"
+label var pop "Population"
+label var density "Population density"
+label var lndensity "ln(population density)"
+label var emp "Employment"
+label var dens_emp "Employment density"
+label var lndens_emp "ln(employment density)"
+label var manuf "Employment in manufacturing"
+label var lndens1_manuf "ln(emmployment in manufacturing)"
+label var agr "Employment in agriculture"
+label var lndens1_agr "ln(employment in agriculture)"
+label var trade "Employment in retail and wholesale trade"
+label var lndens1_trade "ln(employment in retail and wholesale trade)"
+label var constr "Employment in construction"
+label var lndens1_constr "ln(employment in construction)"
+label var other "Employment in other sectors"
+label var lndens1_other "ln(employment in other sectors)"
+label var latc1 "County-centroid catitude"
+label var latc2 "squared latc1"
+label var latc3 "cubic latc1"
+label var lonc1 "County-centroid longitude"
+label var lonc2 "squared lonc1"
+label var lonc3 "cubic lonc1"
+label var mt_summer1 "Average summer temperature (degrees Celsius)"
+label var mt_fall1 "Average fall temperature (degrees Celsius)"
+label var mt_winter1 "Average winter temperature (degrees Celsius)"
+label var mt_spring1 "Average spring temperature (degrees Celsius)"
+label var mp_summer1 "Average summer precipitation (centimeters)"
+label var mp_fall1 "Average fall precipitation (centimeters)"
+label var mp_winter1 "Average winter precipitation (centimeters)"
+label var mp_spring1 "Average spring precipitation (centimeters)"
+label var railtrack "Railroads tracks within county (meters, 1890)"
+label var waterway "Distance to nearest waterway (meters, 1890)"
+label var distnearmsa_miles "Distance to nearest MSA (miles, 1930)"
+label var inst1944 "Dummy for roads predicted to cut through county by 1944 Highway Plan"
+label var np_county_year1 "np_county_year"
+label var np_county_year2 "squared np_county_year"
+label var np_county_year3 "cubic np_county_year"
+label var npff_county_year1 "npff_county_year"
+label var npff_county_year2 "squared npff_county_year"
+label var npff_county_year3 "cubic npff_county_year"
+label var reg1 "Census Region 1: Northeast"
+label var reg2 "Census Region 2: Midwest"
+label var reg3 "Census Region 3: South"
+label var reg4 "Census Region 4: West"
+label var evtime "evtime = year - year_treat"
+label var evtime100b "Dummy for 100 years before hydro dam opening"
+label var evtime90b "Dummy for 90 years before hydro dam opening"
+label var evtime80b "Dummy for 80 years before hydro dam opening"
+label var evtime70b "Dummy for 70 years before hydro dam opening"
+label var evtime60b "Dummy for 60 years before hydro dam opening"
+label var evtime50b "Dummy for 50 years before hydro dam opening"
+label var evtime40b "Dummy for 40 years before hydro dam opening"
+label var evtime30b "Dummy for 30 years before hydro dam opening"
+label var evtime20b "Dummy for 20 years before hydro dam opening"
+label var evtime10b "Dummy for 10 years before hydro dam opening"
+label var evtime0 "Dummy for year (decade) of hydro dam opening"
+label var evtime10a "Dummy for 10 years after hydro dam opening"
+label var evtime20a "Dummy for 20 years after hydro dam opening"
+label var evtime30a "Dummy for 30 years after hydro dam opening"
+label var evtime40a "Dummy for 40 years after hydro dam opening"
+label var evtime50a "Dummy for 50 years after hydro dam opening"
+label var evtime60a "Dummy for 60 years after hydro dam opening"
+label var evtime70a "Dummy for 70 years after hydro dam opening"
+label var evtime80a "Dummy for 80 years after hydro dam opening"
+
+compress
+sort county_fips year
+save data/sample_308series_costdev_1870.dta, replace
+
+
+
+*A simple way to look at the counties that make up the final sample
+clear all
+use data/sample_308series_costdev_1870.dta, clear
+
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 i.year*costdev /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_b1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+gen sampleb = e(sample)
+
+xi: areg lndensity i.year*i.reg_fips /*
+*/ i.year*latc1 i.year*latc2 i.year*latc3 /*
+*/ i.year*lonc1 i.year*lonc2 i.year*lonc3 /*
+*/ i.year*mt_summer1 i.year*mt_fall1 i.year*mt_winter1 i.year*mt_spring1 /*
+*/ i.year*mp_summer1 i.year*mp_fall1 i.year*mp_winter1 i.year*mp_spring1 /*
+*/ i.year*railtrack i.year*waterway i.year*distnearmsa_miles i.year*inst1944 i.year*costdev /*
+*/ evtime100b-evtime20b evtime0-evtime80a /*
+*/ npff_county_year1-npff_county_year3 /*
+*/ if (treated_a1950==1 | falsetreat==1), /*
+*/ absorb(county_fips) cluster(county_fips) level(95)
+
+gen samplea = e(sample)
+
+egen sample = rowmax(sampleb samplea)
+
+replace treated_b1950 = 0 if treated_b1950==.
+replace treated_a1950 = 0 if treated_a1950==.
+replace falsetreat = 0 if falsetreat==.
+
+capture drop n
+bysort county_fips: gen n=_n
+
+keep if n==1
+keep state_fips state_name county_fips county_name year_treat np_county np_hpot treated_b1950 treated_a1950 falsetreat
+
+
+
+log close
+clear
+
+
+
diff --git a/83/replication_package/graphs/AFig_B1.gph b/83/replication_package/graphs/AFig_B1.gph
new file mode 100644
index 0000000000000000000000000000000000000000..d675fe1dcecd6adf48a850bccdcf140e118d53a7
--- /dev/null
+++ b/83/replication_package/graphs/AFig_B1.gph
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:7b23ba614c1b06ba894c21110a4e82c7d7ac28a6f1ac595bc7db16ece97d200f
+size 9389
diff --git a/83/replication_package/graphs/AFig_B1.pdf b/83/replication_package/graphs/AFig_B1.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..28cc146ffce921bc425752b8ceb342b34706e4e0
--- /dev/null
+++ b/83/replication_package/graphs/AFig_B1.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0d3192810d2578dff9754e9841bbbbf6f47b0a0a8b23cff944fd7d8549a3cb89
+size 19926
diff --git a/83/replication_package/graphs/AFig_B4.gph b/83/replication_package/graphs/AFig_B4.gph
new file mode 100644
index 0000000000000000000000000000000000000000..48e0e5ab798e059ee3e60094bed3325685793b75
--- /dev/null
+++ b/83/replication_package/graphs/AFig_B4.gph
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:681a273cb4f7460f84cc3f87c085965d1816253e31a5eea8ea2cb80b02b3aad0
+size 23914
diff --git a/83/replication_package/graphs/AFig_B4.pdf b/83/replication_package/graphs/AFig_B4.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..8ac2b83812813499bf2e7a17f2ecfb174d3b41f3
--- /dev/null
+++ b/83/replication_package/graphs/AFig_B4.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f6f2e2f63aeba5f33a3b9184709634aa0a999549df531a70e3177f6395c97243
+size 29164
diff --git a/83/replication_package/graphs/AFig_B5.gph b/83/replication_package/graphs/AFig_B5.gph
new file mode 100644
index 0000000000000000000000000000000000000000..e447c0f7a7ffc3b638a227f1807f050b190216a6
--- /dev/null
+++ b/83/replication_package/graphs/AFig_B5.gph
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c1bf905ab255700ea447fba8dd17d927a450e256208462e904d34ebe55d548c1
+size 42223
diff --git a/83/replication_package/graphs/AFig_B5.pdf b/83/replication_package/graphs/AFig_B5.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..49a7b1129af8c13b41b8c0771729e0d28512fd59
--- /dev/null
+++ b/83/replication_package/graphs/AFig_B5.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:569510a190e0922924c4115b6224c6838a5e3273ddbd48933526bcb08b5da665
+size 48638
diff --git a/83/replication_package/graphs/AFig_C1.gph b/83/replication_package/graphs/AFig_C1.gph
new file mode 100644
index 0000000000000000000000000000000000000000..9387e70530d434255300f5ab5bf6444675c0c8fd
--- /dev/null
+++ b/83/replication_package/graphs/AFig_C1.gph
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ae56d0cec36bf491edef7b68c13f0c3693fbe673bc6e170e9400ccfbdcb8eac9
+size 29816
diff --git a/83/replication_package/graphs/AFig_C1.pdf b/83/replication_package/graphs/AFig_C1.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..58eef1420fdf10674f1c27ac6a14e67b1f907ab1
--- /dev/null
+++ b/83/replication_package/graphs/AFig_C1.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4d84abde1ea9b4ee4cf8366afaf4456408ad0b80177353f1c278ec77cee277ae
+size 34567
diff --git a/83/replication_package/graphs/AFig_C2.gph b/83/replication_package/graphs/AFig_C2.gph
new file mode 100644
index 0000000000000000000000000000000000000000..8a01937d9627f806fbb11cb4436ce8c057b567a9
--- /dev/null
+++ b/83/replication_package/graphs/AFig_C2.gph
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:55739ea960a4959a9cbba87ce075d7af19873ff2dc01330866286b8243e5b3c0
+size 21678
diff --git a/83/replication_package/graphs/AFig_C2.pdf b/83/replication_package/graphs/AFig_C2.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..44d04c1c3c64a8aafe314292592fe65445617a6f
--- /dev/null
+++ b/83/replication_package/graphs/AFig_C2.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:be1338d2ff67e22b039971d6179e059736d771d43eee61a8937778f2d17f3fd7
+size 22423
diff --git a/83/replication_package/graphs/AFig_C3.gph b/83/replication_package/graphs/AFig_C3.gph
new file mode 100644
index 0000000000000000000000000000000000000000..233b88817708cb07a9cdaf7b6129bdaaf6407c4f
--- /dev/null
+++ b/83/replication_package/graphs/AFig_C3.gph
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c5d50db429611ad67a17dee16496f7c87143e65bb72d4839e091a4736e647c9b
+size 21716
diff --git a/83/replication_package/graphs/AFig_C3.pdf b/83/replication_package/graphs/AFig_C3.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..bff0c7ec4a12a1967650d00b70ea5ced865f1b60
--- /dev/null
+++ b/83/replication_package/graphs/AFig_C3.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f7bb14e3f418f311317a67e26ec957098645d8686d8047a988e3535ea0d08eb2
+size 22361
diff --git a/83/replication_package/graphs/AFig_C4.gph b/83/replication_package/graphs/AFig_C4.gph
new file mode 100644
index 0000000000000000000000000000000000000000..58ab22791674127328c8ba155ff45aa7a8bc2a43
--- /dev/null
+++ b/83/replication_package/graphs/AFig_C4.gph
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:af7d3c218048462d54c72a0a75fcacdedca53f01010ea91843be18c3c53bd974
+size 368052
diff --git a/83/replication_package/graphs/AFig_C4.pdf b/83/replication_package/graphs/AFig_C4.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..5a95268c43fae89d2437828664e11ec1d3c19fc8
--- /dev/null
+++ b/83/replication_package/graphs/AFig_C4.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f3281b0ee11e8e12447a3c7a8a3af0e2b6293626781b9b5e8017312a025bfb4e
+size 39245
diff --git a/83/replication_package/graphs/AFig_C5.gph b/83/replication_package/graphs/AFig_C5.gph
new file mode 100644
index 0000000000000000000000000000000000000000..ecc8018097c2f31274afac3f8922699c58d725c0
--- /dev/null
+++ b/83/replication_package/graphs/AFig_C5.gph
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a32f20565ec0931a0fe392b231118b44a0208f555c3f21724a6626ce79e9c7c9
+size 27961
diff --git a/83/replication_package/graphs/AFig_C5.pdf b/83/replication_package/graphs/AFig_C5.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..d2d52e6e330ee1225cd68364e3db468db93c57ae
--- /dev/null
+++ b/83/replication_package/graphs/AFig_C5.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0db1f328ed98096b23b8f2c1bcd97ac60c893a7fb5d29ba2a88362aad76abfe0
+size 33013
diff --git a/83/replication_package/graphs/AFig_C6.gph b/83/replication_package/graphs/AFig_C6.gph
new file mode 100644
index 0000000000000000000000000000000000000000..5a1f170c3ee8ddaadab65323a0cbcaf05edb5dbf
--- /dev/null
+++ b/83/replication_package/graphs/AFig_C6.gph
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:7ef794bf1e486da700f11f117923ac04ac9f091e802b9117ce1f90c8207dd0d9
+size 22057
diff --git a/83/replication_package/graphs/AFig_C6.pdf b/83/replication_package/graphs/AFig_C6.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..68ca657c4ef4991bccf0945619e9a8fe10199f02
--- /dev/null
+++ b/83/replication_package/graphs/AFig_C6.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:3575202b298ae274732d8b0d007698a261690229f9a040cfc7f98a3ba444faef
+size 29251
diff --git a/83/replication_package/graphs/AFig_C7.gph b/83/replication_package/graphs/AFig_C7.gph
new file mode 100644
index 0000000000000000000000000000000000000000..fe3a4d06485874b460a5698a5f1811b674a7126c
--- /dev/null
+++ b/83/replication_package/graphs/AFig_C7.gph
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:787ab203d690ecb8e6c02d7de9e581f9cdc3dafacfbbae76908fc2981a77d6e0
+size 25979
diff --git a/83/replication_package/graphs/AFig_C7.pdf b/83/replication_package/graphs/AFig_C7.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..2c0339be88a4afb6f71c40b96cf621b59e93ee8c
--- /dev/null
+++ b/83/replication_package/graphs/AFig_C7.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:9b82f99884b7e5beec168f06d3d2781fdc7bb44b16e9a2e23ce899df8e58ae6d
+size 29659
diff --git a/83/replication_package/graphs/AFig_C8.gph b/83/replication_package/graphs/AFig_C8.gph
new file mode 100644
index 0000000000000000000000000000000000000000..6a13d82799ac163360f0949079c0bad1d994504a
--- /dev/null
+++ b/83/replication_package/graphs/AFig_C8.gph
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b76403c0c494eb36abd683383b2877e6c784373da4479e9741120f2089a7ce2b
+size 22891
diff --git a/83/replication_package/graphs/AFig_C8.pdf b/83/replication_package/graphs/AFig_C8.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..cf050d18576bf6c895cdfe653ce942dc174abc42
--- /dev/null
+++ b/83/replication_package/graphs/AFig_C8.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:19cfc1c21a65aa135712392463477e49ec6ce114ee6580f9e24bdd39da1c50aa
+size 33920
diff --git a/83/replication_package/graphs/AFig_C9.gph b/83/replication_package/graphs/AFig_C9.gph
new file mode 100644
index 0000000000000000000000000000000000000000..8ecc954f0c27a7a41563bd627bab8b70b43a6c73
--- /dev/null
+++ b/83/replication_package/graphs/AFig_C9.gph
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b340b9514d68eab958c27f430d5004f89cf8b814f36943c4a709b192d5af6e6c
+size 40754
diff --git a/83/replication_package/graphs/AFig_C9.pdf b/83/replication_package/graphs/AFig_C9.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..8b68ef4b766892f834f05fcd5b9347c97d3cf322
--- /dev/null
+++ b/83/replication_package/graphs/AFig_C9.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:efebbf2f0e92501d1acb2721ea1679c206013f226417548f6cd2d3c348b7f2e8
+size 43396
diff --git a/83/replication_package/graphs/Fig_1.gph b/83/replication_package/graphs/Fig_1.gph
new file mode 100644
index 0000000000000000000000000000000000000000..fd9a3e59d903344365cf2e3f6459c0cf84a3dbec
--- /dev/null
+++ b/83/replication_package/graphs/Fig_1.gph
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:6c4f2fef232730893ce2d5a2a9f218bfeb6013f0513cbb9220157bd2a6bfffdb
+size 45477
diff --git a/83/replication_package/graphs/Fig_1.pdf b/83/replication_package/graphs/Fig_1.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..243b54b8790245fedec9d31c157d0386fe97f737
--- /dev/null
+++ b/83/replication_package/graphs/Fig_1.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:8be129f59af87c8838e3f42f490ac181fafd2388177c36c0155cf2b6f1544480
+size 33160
diff --git a/83/replication_package/graphs/Fig_3.gph b/83/replication_package/graphs/Fig_3.gph
new file mode 100644
index 0000000000000000000000000000000000000000..c4506a02ba64203a621646adc44562cdc86d5c35
--- /dev/null
+++ b/83/replication_package/graphs/Fig_3.gph
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:175cce0c3627e4060e4fc739d02c517685a33f053181197f485e467c9ba9f03b
+size 74239675
diff --git a/83/replication_package/graphs/Fig_3.pdf b/83/replication_package/graphs/Fig_3.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..8e16ff421237ede5ae8522dbbaa88686cf3b6486
--- /dev/null
+++ b/83/replication_package/graphs/Fig_3.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:900ccad7700c31600c6771ef375bb5ec48fcecebc0539c7fe78803909217c3fd
+size 37973547
diff --git a/83/replication_package/graphs/Fig_3.png b/83/replication_package/graphs/Fig_3.png
new file mode 100644
index 0000000000000000000000000000000000000000..7a0d2ea6ae1bd4c48a531efe6d886ea3a8367bfc
--- /dev/null
+++ b/83/replication_package/graphs/Fig_3.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:dfff3853137570e22f3563026fb7c7034b61c123bad937e325ff6cd0554e12ce
+size 958325
diff --git a/83/replication_package/graphs/Fig_4.gph b/83/replication_package/graphs/Fig_4.gph
new file mode 100644
index 0000000000000000000000000000000000000000..545f5599160fb74fdd5397133ef75cd3790b329f
--- /dev/null
+++ b/83/replication_package/graphs/Fig_4.gph
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:840c34f75f778955b2c63c349fb8657e628e7476c9f2bf8ec53161e4bbf67383
+size 21572
diff --git a/83/replication_package/graphs/Fig_4.pdf b/83/replication_package/graphs/Fig_4.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..c10de83e2e5b6da91b890a5fb70ff504f699c122
--- /dev/null
+++ b/83/replication_package/graphs/Fig_4.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:68677e91fbf27bcb76b0835993301036bfe585ea60a8d3422c2daa8c6a118d9c
+size 22261
diff --git a/83/replication_package/graphs/Fig_5.gph b/83/replication_package/graphs/Fig_5.gph
new file mode 100644
index 0000000000000000000000000000000000000000..c8dfd0d852d9409629241c0a2575d2c3731dc543
--- /dev/null
+++ b/83/replication_package/graphs/Fig_5.gph
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:918957fb425c3c1827d97889d87a1a4b1e6096d0c6f05f6733e0a90fa6a7dd57
+size 18931
diff --git a/83/replication_package/graphs/Fig_5.pdf b/83/replication_package/graphs/Fig_5.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..913ef15465e284f94f1bd6602f3ff845a70da2b5
--- /dev/null
+++ b/83/replication_package/graphs/Fig_5.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:8406ee9dfdec76c7efffdb050740c26b29cd146657512bdb93dd1ca7e79066d9
+size 22980
diff --git a/83/replication_package/graphs/Fig_6.gph b/83/replication_package/graphs/Fig_6.gph
new file mode 100644
index 0000000000000000000000000000000000000000..5fa86079444fdf8e04ee4e57701b4974e3f0e96e
--- /dev/null
+++ b/83/replication_package/graphs/Fig_6.gph
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d479c1f5d015d69dbc599b621ee140aa51474439f0781b2991befce678c9df8b
+size 28461
diff --git a/83/replication_package/graphs/Fig_6.pdf b/83/replication_package/graphs/Fig_6.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..ae184edeb6a29c673c8b206a65dc33d13b257f5e
--- /dev/null
+++ b/83/replication_package/graphs/Fig_6.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:cf43dfc92869c706023a3e6472093134aaee1f0419a9932372dc5ba49e5bb4e6
+size 36960
diff --git a/83/replication_package/graphs/Fig_7.gph b/83/replication_package/graphs/Fig_7.gph
new file mode 100644
index 0000000000000000000000000000000000000000..c38a0ef4d64127eb783a64939b6da07f1db585f5
--- /dev/null
+++ b/83/replication_package/graphs/Fig_7.gph
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c3702f941a2be07fb1c6d3f1b523f6f642d529809749e871ca781727173ad074
+size 39693
diff --git a/83/replication_package/graphs/Fig_7.pdf b/83/replication_package/graphs/Fig_7.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..60ce971f5db22272b8f538ffd13dde11c847b6dd
--- /dev/null
+++ b/83/replication_package/graphs/Fig_7.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c04e560b20f7f34e45b96aa0221e487f4a1509dea8a2d0aa87786aa189413eda
+size 44450
diff --git a/83/replication_package/graphs/Fig_8.gph b/83/replication_package/graphs/Fig_8.gph
new file mode 100644
index 0000000000000000000000000000000000000000..32da589269f1c0d95a9192ae8346671a23c34ff8
--- /dev/null
+++ b/83/replication_package/graphs/Fig_8.gph
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:fd94a4bbe84ec167056714c5ea69f5ab33434f94c76c1f84c728b645dac22080
+size 175466
diff --git a/83/replication_package/graphs/Fig_8.pdf b/83/replication_package/graphs/Fig_8.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..820afea045d8e90679fa19e89e14a40605cad5a4
--- /dev/null
+++ b/83/replication_package/graphs/Fig_8.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b5f99c2679faece00bfc429d1ff30be8c30da4e955335d7ba0cc065e298f1118
+size 48984
diff --git a/83/replication_package/graphs/Fig_9.gph b/83/replication_package/graphs/Fig_9.gph
new file mode 100644
index 0000000000000000000000000000000000000000..0dd025fd1e972ac52ddbd9fa336e806c857371f4
--- /dev/null
+++ b/83/replication_package/graphs/Fig_9.gph
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:8d21a951beeb0b776a56c711fe37216708bca44338660a231b4a4f5ec76782fc
+size 40746
diff --git a/83/replication_package/graphs/Fig_9.pdf b/83/replication_package/graphs/Fig_9.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..e528fec0d50de75b2aeca954c32e885c17ce32b6
--- /dev/null
+++ b/83/replication_package/graphs/Fig_9.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a4cb9cd19f7261217dcc36ebb843a5e9fea0cf1afd99e2dd386acb713d964c5b
+size 42890
diff --git a/83/replication_package/graphs/data/evtime_1870.csv b/83/replication_package/graphs/data/evtime_1870.csv
new file mode 100644
index 0000000000000000000000000000000000000000..fba5b292a90200c83567dd7f2d96d8da218a08c1
--- /dev/null
+++ b/83/replication_package/graphs/data/evtime_1870.csv
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:6d485d30640878b8ce5a364bfc4aa2663400f332086a3b5bf88dbd24cd4f1c90
+size 66
diff --git a/83/replication_package/graphs/data/evtime_1870.dta b/83/replication_package/graphs/data/evtime_1870.dta
new file mode 100644
index 0000000000000000000000000000000000000000..ddcb5acbe994e75fbc0efca6f287d5769da1f38d
--- /dev/null
+++ b/83/replication_package/graphs/data/evtime_1870.dta
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:422ac98bca4f4b6016ecdeb006633be24330be1b1fe5d1f65d0b01dc8b2f72f0
+size 1212
diff --git a/83/replication_package/logfiles/For_comparison_Dams_analysis_logfile.log b/83/replication_package/logfiles/For_comparison_Dams_analysis_logfile.log
new file mode 100644
index 0000000000000000000000000000000000000000..443e913e904145a70b7b9e82c2ee8e66f75e4299
--- /dev/null
+++ b/83/replication_package/logfiles/For_comparison_Dams_analysis_logfile.log
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5d3fdd73596daa4e1c96c43f456a320dc97334d4a5f37c29f97b01df3fe2bb1a
+size 89869877
diff --git a/83/replication_package/logfiles/For_comparison_Dams_cleaning_logfile.log b/83/replication_package/logfiles/For_comparison_Dams_cleaning_logfile.log
new file mode 100644
index 0000000000000000000000000000000000000000..e355b5067e903d022d28fb5a3a3710b69e0bcf5e
--- /dev/null
+++ b/83/replication_package/logfiles/For_comparison_Dams_cleaning_logfile.log
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:377a4ee170d6b83936494912652d2a4a32cff5a9410d174558dbae1f6992ac1c
+size 329840
diff --git a/83/replication_package/logfiles/For_comparison_Dams_output.txt b/83/replication_package/logfiles/For_comparison_Dams_output.txt
new file mode 100644
index 0000000000000000000000000000000000000000..d1c4ec6efe7f130840993ce44b337b3e60215681
--- /dev/null
+++ b/83/replication_package/logfiles/For_comparison_Dams_output.txt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:3f27625e9a2775e23cd2da19693fe3ae697c71df7a72e3de276bb100e1b1f3b2
+size 12569
diff --git a/83/replication_package/logfiles/For_comparison_Dams_output.xlsx b/83/replication_package/logfiles/For_comparison_Dams_output.xlsx
new file mode 100644
index 0000000000000000000000000000000000000000..687541a1df97c83e707a45c5edd8b35093664194
--- /dev/null
+++ b/83/replication_package/logfiles/For_comparison_Dams_output.xlsx
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5c93a34a980eb4760f45903532833553f92c89017382e5e1f516c929fa9cf6dd
+size 29476
diff --git a/83/replication_package/logfiles/For_comparison_Dams_output.xml b/83/replication_package/logfiles/For_comparison_Dams_output.xml
new file mode 100644
index 0000000000000000000000000000000000000000..f7747dd458ed9e492e1eb228cad0ffb1be25b525
--- /dev/null
+++ b/83/replication_package/logfiles/For_comparison_Dams_output.xml
@@ -0,0 +1 @@
+FalseFalse|
| (1) | (2) | (3) | (4) | (5) | (6) | (7) | (8) | (9) | (10) | (11) | (12) | (13) | (14) | (15) | (16) | (17) | (18) | (19) | (20) | (21) | (22) | (23) | (24) | (25) | (26) | (27) | (28) | (29) | (30) | (31) | (32) | (33) | (34) | (35) | (36) | (37) | (38) | (39) | (40) | (41) | (42) | (43) | (44) | (45) | (46) | (47) | (48) | (49) | (50) | (51) | (52) | (53) | (54) | (55) | (56) | (57) | (58) | (59) | (60) | (61) |
| VARIABLES | ATC1_c1 | ATC1_c2 | ATC2_c3 | ATC2_c4 | ATC3_c3 | ATC3_c4 | ATC4_c1 | ATC4_c2 | ATC4_c3 | ATC4_c4 | ATC4_c5 | ATC4_c6 | ATC5_c1 | ATC5_c2 | ATC5_c3 | ATC5_c4 | ATC5_c5 | ATC5_c6 | ATE1_c1 | ATE1_c2 | T2_c1 | T2_c2 | T2_c3 | T2_c4 | T2_c5 | T2_c6 | T2_c7 | T2_c8 | T2_c9 | T2_c10 | T2_c11 | T2_c12 | T2_c13 | T2_c14 | T2_c15 | T2_c16 | T2_c17 | T2_c18 | T2_c19 | T2_c20 | T2_c21 | T2_c22 | T2_c23 | T2_c24 | T3_c1 | T3_c1 | T3_c1 | T3_c2 | T3_c2 | T3_c2 | T3_c3 | T3_c3 | T3_c3 | T3_c4 | T3_c4 | T3_c4 | T3_c5 | T3_c5 | T3_c5 | ATE1_c3 | ATE1_c4 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| evtime100b | | 0.2437 | | 0.1827 | | 0.2690 | | | | | | | 0.4381 | 0.0424 | 0.2569 | 0.0820 | 0.1459 | 0.2333 | | 0.1096 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0.3720 |
| | (0.3538) | | (0.3515) | | (0.3767) | | | | | | | (0.3985) | (0.2456) | (0.2083) | (0.2677) | (0.1609) | (0.3296) | | (0.2518) | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.3852) |
| evtime90b | | 0.1088 | | 0.0549 | | 0.1304 | | | | | | | 0.0984 | 0.1197 | 0.1652 | 0.1544 | 0.1711 | 0.1816 | | -0.0341 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0.1578 |
| | (0.2256) | | (0.2201) | | (0.2402) | | | | | | | (0.2506) | (0.1716) | (0.1387) | (0.1747) | (0.1152) | (0.2143) | | (0.1819) | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.2739) |
| evtime80b | | 0.1298 | | 0.0765 | | 0.1909 | | | | | | | 0.1999 | 0.1071 | 0.0546 | 0.0776 | 0.1170 | 0.2126 | | -0.0288 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0.1271 |
| | (0.1714) | | (0.1697) | | (0.1734) | | | | | | | (0.1924) | (0.1473) | (0.1084) | (0.1411) | (0.0997) | (0.1828) | | (0.1547) | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.2158) |
| evtime70b | 0.3323 | 0.1096 | 0.5560 | 0.0818 | 0.3712 | 0.1435 | 0.3572 | 0.5571* | 0.1216 | 0.2460 | -0.0561 | 0.6236 | 0.0743 | -0.0388 | -0.0733 | 0.0241 | 0.0696 | 0.1887 | 0.5276* | -0.0471 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0.6501* | 0.0747 |
| (0.4210) | (0.1511) | (0.8821) | (0.1518) | (0.4287) | (0.1499) | (0.4527) | (0.2987) | (0.2545) | (0.3253) | (0.1960) | (0.4067) | (0.1909) | (0.1498) | (0.1147) | (0.1311) | (0.0869) | (0.1620) | (0.3041) | (0.1372) | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.3524) | (0.1819) |
| evtime60b | 0.0862 | 0.0686 | 0.0388 | 0.0541 | 0.0979 | 0.1105 | 0.0460 | 0.3480* | -0.0270 | 0.2403 | 0.0224 | 0.1389 | 0.1810 | 0.0461 | 0.0805 | 0.1145 | 0.0243 | 0.2152 | 0.1060 | -0.0629 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0.1880 | 0.0230 |
| (0.2445) | (0.1301) | (0.3434) | (0.1322) | (0.2530) | (0.1285) | (0.2625) | (0.1972) | (0.1619) | (0.1753) | (0.1225) | (0.2753) | (0.1443) | (0.1293) | (0.0869) | (0.1182) | (0.0766) | (0.1319) | (0.2346) | (0.1183) | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.2711) | (0.1515) |
| evtime50b | 0.0239 | 0.0288 | 0.0027 | 0.0211 | 0.0785 | 0.0571 | -0.1583 | 0.2257 | -0.1513 | 0.1615 | -0.1024 | -0.0492 | 0.0560 | -0.0384 | 0.0128 | 0.0626 | 0.0140 | 0.0616 | 0.0134 | -0.0789 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0.0879 | -0.0257 |
| (0.1578) | (0.1071) | (0.1934) | (0.1089) | (0.1610) | (0.1060) | (0.2166) | (0.1732) | (0.1219) | (0.1499) | (0.1150) | (0.1956) | (0.1090) | (0.1052) | (0.0714) | (0.0830) | (0.0566) | (0.1017) | (0.1761) | (0.0991) | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.1982) | (0.1240) |
| evtime40b | -0.0057 | -0.0061 | -0.0253 | 0.0014 | 0.0412 | -0.0054 | -0.0784 | 0.0259 | -0.0604 | 0.0067 | -0.1503 | -0.0699 | 0.0326 | -0.0501 | -0.0226 | 0.0246 | 0.0551 | 0.0643 | -0.0485 | -0.0899 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -0.0132 | -0.0568 |
| (0.1129) | (0.0789) | (0.1449) | (0.0804) | (0.1149) | (0.0811) | (0.1928) | (0.2112) | (0.1281) | (0.1065) | (0.1097) | (0.1969) | (0.0816) | (0.0822) | (0.0645) | (0.0704) | (0.0581) | (0.0753) | (0.1359) | (0.0721) | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.1423) | (0.0929) |
| evtime30b | -0.0027 | -0.0001 | 0.0116 | 0.0049 | 0.0142 | -0.0137 | 0.0292 | 0.0392 | -0.0483 | 0.0867 | -0.0293 | 0.0472 | -0.0116 | 0.0082 | -0.0137 | -0.0427 | -0.0053 | -0.0455 | -0.0282 | -0.0549 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -0.0301 | -0.0367 |
| (0.0777) | (0.0518) | (0.1008) | (0.0543) | (0.0772) | (0.0534) | (0.1171) | (0.1775) | (0.0813) | (0.1238) | (0.1024) | (0.1402) | (0.0581) | (0.0767) | (0.0494) | (0.0596) | (0.0411) | (0.0686) | (0.0911) | (0.0437) | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.0929) | (0.0600) |
| evtime20b | -0.0014 | 0.0016 | 0.0253 | 0.0019 | 0.0203 | -0.0056 | -0.0497 | -0.0077 | -0.0555 | -0.0903 | -0.1294 | -0.0102 | -0.0055 | -0.0246 | -0.0273 | -0.0423 | 0.0055 | 0.0072 | 0.0028 | -0.0238 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -0.0090 | -0.0158 |
| (0.0459) | (0.0262) | (0.0576) | (0.0277) | (0.0424) | (0.0273) | (0.0822) | (0.1392) | (0.0660) | (0.1029) | (0.1065) | (0.0901) | (0.0334) | (0.0487) | (0.0300) | (0.0349) | (0.0336) | (0.0345) | (0.0464) | (0.0188) | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.0460) | (0.0299) |
| evtime0 | 0.0857* | 0.0361 | 0.0664 | 0.0438 | 0.0703* | 0.0223 | 0.0792 | 0.0405 | -0.0589 | 0.0729 | 0.1692 | 0.1015 | 0.0373 | 0.0023 | -0.0051 | 0.0343 | 0.1636*** | 0.0652* | 0.0704 | 0.0581*** | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0.1168** | 0.0458 |
| (0.0463) | (0.0298) | (0.0617) | (0.0302) | (0.0374) | (0.0326) | (0.0596) | (0.1048) | (0.0569) | (0.1214) | (0.1184) | (0.0784) | (0.0360) | (0.0397) | (0.0361) | (0.0290) | (0.0355) | (0.0357) | (0.0460) | (0.0210) | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.0505) | (0.0337) |
| evtime10a | 0.1151 | 0.0529 | 0.1183 | 0.0492 | 0.1024 | 0.0348 | 0.1365 | 0.0264 | 0.0785 | 0.1041 | 0.0172 | 0.1913* | 0.0796 | 0.0876 | 0.0186 | 0.0848* | 0.1178*** | 0.1457*** | 0.0743 | 0.0982** | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0.1514* | 0.0784 |
| (0.0822) | (0.0487) | (0.1090) | (0.0486) | (0.0750) | (0.0546) | (0.0901) | (0.0986) | (0.0676) | (0.1250) | (0.1121) | (0.1043) | (0.0586) | (0.0672) | (0.0597) | (0.0456) | (0.0392) | (0.0528) | (0.0814) | (0.0372) | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.0895) | (0.0642) |
| evtime20a | 0.2991*** | 0.1099 | 0.1901 | 0.0869 | 0.2854*** | 0.1065 | 0.3455** | 0.2911** | 0.0595 | 0.2571** | 0.1883 | 0.3669*** | 0.1297 | 0.1073 | -0.0035 | 0.1478** | 0.1537*** | 0.2700*** | 0.2560*** | 0.1670*** | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0.3765*** | 0.1488 |
| (0.1071) | (0.0690) | (0.1493) | (0.0698) | (0.0977) | (0.0773) | (0.1353) | (0.1451) | (0.0931) | (0.1160) | (0.1172) | (0.1331) | (0.0851) | (0.0895) | (0.0765) | (0.0641) | (0.0477) | (0.0771) | (0.0860) | (0.0590) | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.1024) | (0.0960) |
| evtime30a | 0.4298*** | 0.1566* | 0.3387** | 0.1254 | 0.4121*** | 0.1327 | 0.5300*** | 0.4158** | 0.1423 | 0.4227*** | 0.2741** | 0.5348*** | 0.2015* | 0.1855* | -0.0559 | 0.2440*** | 0.2219*** | 0.3625*** | 0.3768*** | 0.2434*** | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0.5068*** | 0.2249* |
| (0.1287) | (0.0904) | (0.1675) | (0.0918) | (0.1189) | (0.0927) | (0.1553) | (0.1636) | (0.0962) | (0.1342) | (0.1093) | (0.1601) | (0.1112) | (0.1081) | (0.0854) | (0.0835) | (0.0619) | (0.0988) | (0.0831) | (0.0823) | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.1136) | (0.1308) |
| evtime40a | 0.6594*** | 0.1967 | 0.5769*** | 0.1310 | 0.6311*** | 0.1683 | 0.7765*** | 0.5578*** | 0.1232 | 0.6625*** | 0.4465*** | 0.7917*** | 0.2399 | 0.2516* | -0.0237 | 0.3001*** | 0.2379*** | 0.4051*** | 0.5960*** | 0.3193*** | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0.7371*** | 0.3033* |
| (0.1496) | (0.1225) | (0.1774) | (0.1254) | (0.1439) | (0.1232) | (0.1879) | (0.1935) | (0.1107) | (0.1529) | (0.1279) | (0.2025) | (0.1507) | (0.1354) | (0.0973) | (0.1085) | (0.0901) | (0.1293) | (0.0914) | (0.1095) | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.1284) | (0.1691) |
| evtime50a | 0.7896*** | 0.3156** | 0.7340*** | 0.2336 | 0.7583*** | 0.2845* | 0.9403*** | 0.6056*** | 0.3042** | 0.8147*** | 0.5115*** | 0.9616*** | 0.3627* | 0.3168* | -0.1104 | 0.3841*** | 0.3336*** | 0.5570*** | 0.7262*** | 0.4462*** | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0.8651*** | 0.4479** |
| (0.1682) | (0.1534) | (0.2032) | (0.1526) | (0.1632) | (0.1543) | (0.2104) | (0.1943) | (0.1247) | (0.1807) | (0.1425) | (0.2347) | (0.1842) | (0.1647) | (0.1081) | (0.1341) | (0.1134) | (0.1699) | (0.1039) | (0.1451) | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.1454) | (0.2143) |
| evtime60a | 0.8538*** | 0.4838** | 0.7307*** | 0.3066 | 0.8388*** | 0.4506** | 1.0301*** | 0.6763*** | 0.2589** | 0.8872*** | 0.6198*** | 1.0560*** | 0.5185** | 0.4390* | -0.1689 | 0.5006** | 0.4481** | 0.7964*** | 0.8262*** | 0.6414*** | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0.9421*** | 0.6689** |
| (0.1842) | (0.2335) | (0.2128) | (0.2375) | (0.1772) | (0.2144) | (0.2268) | (0.2064) | (0.1271) | (0.1906) | (0.1550) | (0.2582) | (0.2593) | (0.2337) | (0.1454) | (0.2023) | (0.1764) | (0.2459) | (0.1399) | (0.2111) | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.1738) | (0.2942) |
| evtime70a | 0.9190*** | | 0.7677*** | | 0.8940*** | | 1.0992*** | 0.6917*** | 0.2479* | 0.9468*** | 0.7036*** | 1.1206*** | | | | | | | 0.9135*** | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1.0075*** | |
| (0.1968) | | (0.2257) | | (0.1871) | | (0.2398) | (0.1884) | (0.1405) | (0.2030) | (0.1644) | (0.2668) | | | | | | | (0.1661) | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.1991) | |
| evtime80a | 0.9548*** | | 0.7406** | | 0.8737*** | | 1.1190*** | 0.7220*** | 0.1920 | 0.9966*** | 0.7552*** | 1.1304*** | | | | | | | 1.0025*** | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1.0664*** | |
| (0.2561) | | (0.3150) | | (0.2376) | | (0.2972) | (0.2145) | (0.1579) | (0.2567) | (0.1858) | (0.3205) | | | | | | | (0.2576) | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.2811) | |
| treated_b1950 | | | | | | | | | | | | | | | | | | | | | -2,448.3963 | -1.2166 | 0.1315 | -699.6567 | -0.4944 | 0.0613 | 2.3145 | 3.4086*** | 1.7655** | 1.8856* | 2.4742* | 2.2067* | -1.5982 | -3.5545 | -0.4122 | -0.1925 | 4.4418 | 2.5462 | 3.8981 | -8.3513 | -28.1054* | 0.0806 | -0.1820 | -1.4667 | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | (3,433.8948) | (4.8033) | (0.3192) | (1,086.3427) | (1.3371) | (0.3317) | (1.4665) | (0.8700) | (0.7960) | (0.9309) | (1.3561) | (1.0769) | (1.0162) | (2.7705) | (2.2178) | (1.9021) | (3.1907) | (2.5796) | (20.4101) | (8.5592) | (15.7699) | (0.1101) | (2.6740) | (1.7609) | | | | | | | | | | | | | | | | | |
| treated_a1950 | | | | | | | | | | | | | | | | | | | | | -6,547.6932 | -8.4174 | -0.3361 | -1,396.7533 | -1.9040 | -0.3789 | 1.8941 | 3.6116*** | 1.3275 | 1.6182 | 2.6402* | 1.9378 | -0.6101 | -9.3741** | -4.7104 | -1.3594 | 5.2111** | 1.1236 | -12.5622 | -8.2465 | -9.7789 | -0.0272 | -2.3926 | -1.1600 | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | (6,722.1588) | (8.6441) | (0.4993) | (1,908.9933) | (2.4107) | (0.6021) | (1.1219) | (0.9384) | (1.0183) | (1.1098) | (1.4218) | (1.2590) | (1.5872) | (4.2331) | (2.9731) | (1.5497) | (2.0151) | (2.5471) | (18.1342) | (6.6390) | (18.0503) | (0.1376) | (1.6535) | (1.4705) | | | | | | | | | | | | | | | | | |
| group_1 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0.4192*** | | | 0.4192*** | | | 0.4192*** | | | 0.4192*** | | | 0.4192*** | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.0751) | | | (0.0765) | | | (0.0760) | | | (0.0765) | | | (0.0756) | | | | |
| group_2 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0.1379*** | | | 0.1379*** | | | 0.1379*** | | | 0.1379*** | | | 0.1379*** | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.0430) | | | (0.0430) | | | (0.0430) | | | (0.0430) | | | (0.0427) | | | | |
| difference | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0.2813*** | | | 0.2813*** | | | 0.2813*** | | | 0.2813*** | | | 0.2813*** | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.0866) | | | (0.0878) | | | (0.0874) | | | (0.0878) | | | (0.0869) | | | | |
| explained | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0.0953** | | | 0.0102 | | | 0.0208 | | | 0.0450 | | | 0.1284** | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.0441) | | | (0.0220) | | | (0.0167) | | | (0.0450) | | | (0.0555) | | | | |
| unexplained | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0.1860** | | | 0.2711*** | | | 0.2606*** | | | 0.2363*** | | | 0.1530** | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.0824) | | | (0.0886) | | | (0.0854) | | | (0.0812) | | | (0.0732) | | | | |
| distnmsa30 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0.0953** | 0.0361 | | | | | | | | | | | 0.1284** | 0.2701 | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.0441) | (0.0565) | | | | | | | | | | | (0.0555) | (0.4546) | | |
| lndensinit | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0.0102 | -0.4447 | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.0220) | (0.3141) | | | | | | | | | | | |
| np_county_damc | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0.0208 | 0.1130** | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.0167) | (0.0550) | | | | | | | | |
| cost_kw2000 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0.0450 | 0.3736*** | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (0.0450) | (0.1220) | | | | | |
| Constant | | | | | | | | | | | | | | | | | | | | | 19,853.9677*** | 26.8537*** | 2.6000*** | 5,755.8710*** | 7.5309*** | 1.3559*** | 2.1525*** | 0.0000 | 21.9081*** | 12.9991*** | 1.7481 | 11.4694*** | 38.3403*** | -87.1477*** | 26.6699*** | 24.6904*** | 26.1558*** | 27.4842*** | 55.5462*** | 31.7742*** | 75.7290*** | 0.4194*** | 5.4139*** | 4.6667** | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | (6,468.3544) | (8.2672) | (0.4079) | (1,721.2784) | (2.1925) | (0.3662) | (0.2282) | (0.0000) | (0.8391) | (0.9835) | (1.4917) | (1.1601) | (1.1209) | (4.4837) | (2.8647) | (1.1415) | (1.4495) | (1.4412) | (16.0049) | (7.0868) | (17.9435) | (0.0893) | (1.7241) | (1.5498) | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| Observations | 885 | 1,230 | 735 | 1,125 | 810 | 990 | 826 | 826 | 826 | 826 | 826 | 826 | 1,148 | 1,148 | 1,148 | 1,148 | 1,148 | 1,148 | 840 | 1,530 | 110 | 110 | 110 | 110 | 110 | 110 | 110 | 110 | 110 | 110 | 110 | 110 | 110 | 110 | 110 | 110 | 110 | 110 | 110 | 110 | 110 | 110 | 110 | 32 | 549 | 549 | 549 | 549 | 549 | 549 | 549 | 549 | 549 | 549 | 549 | 549 | 549 | 549 | 549 | 885 | 1,230 |
| R-squared | 0.9566 | 0.9545 | 0.9629 | 0.9584 | 0.9560 | 0.9463 | 0.9494 | 0.9521 | 0.9390 | 0.9502 | 0.9444 | 0.9444 | 0.9422 | 0.9301 | 0.9420 | 0.9337 | 0.9214 | 0.9319 | 0.9766 | 0.9699 | 0.0199 | 0.0303 | 0.0197 | 0.0093 | 0.0166 | 0.0162 | 0.0341 | 0.1518 | 0.0479 | 0.0525 | 0.0611 | 0.0565 | 0.0205 | 0.0608 | 0.0359 | 0.0087 | 0.0495 | 0.0107 | 0.0162 | 0.0177 | 0.0451 | 0.0079 | 0.0203 | 0.0457 | | | | | | | | | | | | | | | | 0.9748 | 0.9616 |
| Robust standard errors in parentheses |
| *** p<0.01, ** p<0.05, * p<0.1 |
FalseFalse
\ No newline at end of file
diff --git a/83/should_reproduce.txt b/83/should_reproduce.txt
new file mode 100644
index 0000000000000000000000000000000000000000..aa2cbd073cf826a3820f5a17949f4486d161ed07
--- /dev/null
+++ b/83/should_reproduce.txt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:58224463fbf6907ec451ee70aa53ea1dfe8b5d8a1e11cd7de0a4f429690d1063
+size 97