File size: 8,041 Bytes
caa8075
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
********************************************************************************
******************************** HETEROGENEITY *********************************
********************************************************************************
	
use "/Users/eduardomontero/Dropbox/Research_ElSalvador_LandReform/R/Output/ag_census_wSegmCens_all.dta", clear
destring  Expropretario_ISTA, replace
replace Expropretario_ISTA = agg_id if Expropretario_ISTA==.

gen mean_med = age_mean- age_median
keep age_iqr mean_med Above500 ln_agprod ln_agprod_pricew_crops CashCrop_Share StapleCrop_Share norm_dist own_amt Expropretario_ISTA reform

**********************
*** Label the Data ***
**********************

** Label Variables for the output:
label variable ln_agprod_pricew_crops "Agricultural Revenues (ln($/ha))"
label variable ln_agprod "Agriculural Profits (ln($/ha))"
label variable CashCrop_Share "Share of Property for Cash Crops"
label variable StapleCrop_Share "Share of Property for Staple Crops"
label variable norm_dist "Distance to Reform Threshold (ha)"
label variable own_amt "Former Owner's Cumulative Landholdings (ha)"

*********************
*** Set RD Params ***
*********************

** Baseline: Will use local linear rd with MSE optimal bandwidth
** with ses clustered at propietor level. 
** Will also use two-sided MSE optimal bandwidth since big diff in density on
** both sides.
** Will use rdrobust package

local polynomial_level 1
local bandwidth_choice "mserd" // "mserd", "msecomb2" "msetwo"
local kernel_choice "tri" // "tri"
local cluster_level "Expropretario_ISTA"
local bw 100

*********************************************
*** OUTCOME - SEGM CENSALES HETEROGENEITY ***
*********************************************

** AGE Heterogeneity:
local het_var age_iqr

sum `het_var', d
local mean_agesd = `r(p50)'
dis "`mean_agesd'"
replace mean_med =`het_var'

count if mean_med <`mean_agesd' | reform==0
count  if mean_med >=`mean_agesd' | reform==0

gen abovemed_het = 0
replace abovemed_het=1 if (mean_med >=`mean_agesd' & mean_med!= .)

local bw 150
gen dis_meas = age_iqr //age_sd age_iqr
replace dis_meas=0 if dis_meas==.
reg ln_agprod Above500 c.Above500#c.dis_meas norm_dist c.Above500#c.norm_dist if abs(norm_dist) < 150, cluster(Expropretario_ISTA)


rdrobust ln_agprod_pricew_crops norm_dist if (mean_med >=`mean_agesd' & mean_med!= .) | reform==0, c(0) p(`polynomial_level')  h(`bw' `bw') kernel(`kernel_choice')  vce(cluster `cluster_level')
	* outreg results
	distinct `cluster_level' if norm_dist < `e(h_l)' & norm_dist > -1*`e(h_r)' & `e(outcomevar)'!=. & `e(runningvar)'!=.
	local n_clust = `r(ndistinct)'
	su `e(outcomevar)'  if norm_dist < `e(h_l)' & norm_dist > -1*`e(h_r)'
	outreg2 using "Output/Table_SegmCens_AgeHet.tex", replace se tex noobs addstat(Observations, `e(N_h_l)' + `e(N_h_r)', Clusters, `n_clust', Mean Dep. Var., `r(mean)', Bandwidth, `e(h_l)')

rdrobust ln_agprod_pricew_crops norm_dist if mean_med <`mean_agesd' | reform==0, c(0) p(`polynomial_level') h(`bw' `bw') kernel(`kernel_choice') vce(cluster `cluster_level')
	* outreg results
	distinct `cluster_level' if norm_dist < `e(h_l)' & norm_dist > -1*`e(h_r)' & `e(outcomevar)'!=. & `e(runningvar)'!=.
	local n_clust = `r(ndistinct)'
	su `e(outcomevar)'  if norm_dist < `e(h_l)' & norm_dist > -1*`e(h_r)'
	outreg2 using "Output/Table_SegmCens_AgeHet.tex", append se tex noobs addstat(Observations, `e(N_h_l)' + `e(N_h_r)', Clusters, `n_clust', Mean Dep. Var., `r(mean)', Bandwidth, `e(h_l)')
*/

rdrobust ln_agprod norm_dist if (mean_med >=`mean_agesd' & mean_med!= .) | reform==0, c(0) p(`polynomial_level')  h(`bw' `bw') kernel(`kernel_choice') vce(cluster `cluster_level')
	* outreg results
	distinct `cluster_level' if norm_dist < `e(h_l)' & norm_dist > -1*`e(h_r)' & `e(outcomevar)'!=. & `e(runningvar)'!=.
	local n_clust = `r(ndistinct)'
	su `e(outcomevar)'  if norm_dist < `e(h_l)' & norm_dist > -1*`e(h_r)'
	outreg2 using "Output/Table_SegmCens_AgeHet.tex", append se tex noobs addstat(Observations, `e(N_h_l)' + `e(N_h_r)', Clusters, `n_clust', Mean Dep. Var., `r(mean)', Bandwidth, `e(h_l)')

rdrobust ln_agprod norm_dist if mean_med <`mean_agesd' | reform==0 , c(0) p(`polynomial_level') h(`bw' `bw') kernel(`kernel_choice') vce(cluster `cluster_level')
	* outreg results
	distinct `cluster_level' if norm_dist < `e(h_l)' & norm_dist > -1*`e(h_r)' & `e(outcomevar)'!=. & `e(runningvar)'!=.
	local n_clust = `r(ndistinct)'
	su `e(outcomevar)'  if norm_dist < `e(h_l)' & norm_dist > -1*`e(h_r)'
	outreg2 using "Output/Table_SegmCens_AgeHet.tex", append se tex noobs addstat(Observations, `e(N_h_l)' + `e(N_h_r)', Clusters, `n_clust', Mean Dep. Var., `r(mean)', Bandwidth, `e(h_l)')


	
	*** TESTING COEFFICIENTS:
	* 1 vs. 2:
	local z = (-.430 - (-0.192))/sqrt(0.326^2 + 0.376^2)
	dis 2*(1-normal(abs(`z'))) 
	
		local z = (-.696 - (-0.255))/sqrt(0.411^2 + 0.504^2)
	dis 2*(1-normal(abs(`z'))) 
	
	

	
	
	/*gen group1 = abovemed_het ==1 // | reform==0
	gen group1_Above500 = group1*Above50
	
	reg ln_agprod_pricew_crops Above500 group1_Above500 norm_dist c.norm_dist#Above500 i.group1#c.norm_dist i.group1#c.norm_dist#Above500   if  abs(norm_dist) < 150, vce(cluster Expropretario_ISTA)  
	lincom _b[Above500] - _b[group1_Above500]

	
	reg ln_agprod Above500 group1_Above500 norm_dist c.norm_dist#Above500  if  abs(norm_dist) < 150 , vce(cluster Expropretario_ISTA)  
	lincom _b[Above500] - _b[group1_Above500]*/

local bw 300
rdrobust CashCrop_Share norm_dist if mean_med >=`mean_agesd' | reform==0, c(0) p(`polynomial_level')  h(`bw' `bw') kernel(`kernel_choice') vce(cluster `cluster_level')
	* outreg results
	distinct `cluster_level' if norm_dist < `e(h_l)' & norm_dist > -1*`e(h_r)' & `e(outcomevar)'!=. & `e(runningvar)'!=.
	local n_clust = `r(ndistinct)'
	su `e(outcomevar)'  if norm_dist < `e(h_l)' & norm_dist > -1*`e(h_r)'
	outreg2 using "Output/Table_SegmCens_AgeHet2.tex", replace se tex noobs addstat(Observations, `e(N_h_l)' + `e(N_h_r)', Clusters, `n_clust', Mean Dep. Var., `r(mean)', Bandwidth, `e(h_l)')

rdrobust CashCrop_Share norm_dist if mean_med <`mean_agesd' | reform==0 , c(0) p(`polynomial_level') h(`bw' `bw') kernel(`kernel_choice') vce(cluster `cluster_level')
	* outreg results
	distinct `cluster_level' if norm_dist < `e(h_l)' & norm_dist > -1*`e(h_r)' & `e(outcomevar)'!=. & `e(runningvar)'!=.
	local n_clust = `r(ndistinct)'
	su `e(outcomevar)'  if norm_dist < `e(h_l)' & norm_dist > -1*`e(h_r)'
	outreg2 using "Output/Table_SegmCens_AgeHet2.tex", append se tex noobs addstat(Observations, `e(N_h_l)' + `e(N_h_r)', Clusters, `n_clust', Mean Dep. Var., `r(mean)', Bandwidth, `e(h_l)')


rdrobust StapleCrop_Share norm_dist if mean_med >=`mean_agesd' | reform==0, c(0) p(`polynomial_level')  h(`bw' `bw') kernel(`kernel_choice') vce(cluster `cluster_level')
	* outreg results
	distinct `cluster_level' if norm_dist < `e(h_l)' & norm_dist > -1*`e(h_r)' & `e(outcomevar)'!=. & `e(runningvar)'!=.
	local n_clust = `r(ndistinct)'
	su `e(outcomevar)'  if norm_dist < `e(h_l)' & norm_dist > -1*`e(h_r)'
	outreg2 using "Output/Table_SegmCens_AgeHet2.tex", append se tex noobs addstat(Observations, `e(N_h_l)' + `e(N_h_r)', Clusters, `n_clust', Mean Dep. Var., `r(mean)', Bandwidth, `e(h_l)')

rdrobust StapleCrop_Share norm_dist if mean_med <`mean_agesd' | reform==0 , c(0) p(`polynomial_level') h(`bw' `bw') kernel(`kernel_choice') vce(cluster `cluster_level')
	* outreg results
	distinct `cluster_level' if norm_dist < `e(h_l)' & norm_dist > -1*`e(h_r)' & `e(outcomevar)'!=. & `e(runningvar)'!=.
	local n_clust = `r(ndistinct)'
	su `e(outcomevar)'  if norm_dist < `e(h_l)' & norm_dist > -1*`e(h_r)'
	outreg2 using "Output/Table_SegmCens_AgeHet2.tex", append se tex noobs addstat(Observations, `e(N_h_l)' + `e(N_h_r)', Clusters, `n_clust', Mean Dep. Var., `r(mean)', Bandwidth, `e(h_l)')
*/


	** Crop ones
	* 1 vs. 2:
	local z = (-0.493 - (-0.571))/sqrt(0.139^2 + 0.132^2)
	dis 2*(1-normal(abs(`z'))) 
	
		local z = (0.150 - (0.344))/sqrt(0.168^2 + 0.190^2)
	dis 2*(1-normal(abs(`z')))