File size: 5,455 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 |
***************************************************************
******* ESLR: RD Plot - Plot-Level Outcomes - Modern **********
***************************************************************
capture log close
clear
set matsize 3000
set more off
set scheme s2color // Default Scheme
***************************************************************
** Load the Data on Prop. in 1980 and whether they appear in the 2007 Census:
use "./Data/LR_reform_existence.dta", clear
gen norm_dist = Total_Propretario2 - 500.00
gen own_amt = Total_Propretario2
label var norm_dist "Normalized Distance to Reform Threshold (has)"
label var own_amt "Cumulative Landholdings of Former Owner (has)"
label var Exists "Exists in 2007"
***************************************************************
** Using lpoly from Dell 2015: Distance to 500
keep Exists own_amt norm_dist
keep if norm_dist<300.00 & norm_dist> -300.00
sort norm_dist
tempfile tempdata
save `tempdata', replace
** Dep Var: Exists; Bandwidth=300; Degree=1
use `tempdata', clear
keep if (own_amt>500.00 & own_amt<800.00)
lpoly Exists own_amt if (own_amt>500.00 & own_amt<800.00), kernel(rectangle) bwidth(300) degree(1) generate(x s) se(se) nograph pwidth(150)
keep x s se
drop if x==.
save "Output/Temp/RD", replace
use `tempdata', clear
keep if (own_amt<500.00 & own_amt>200.00)
lpoly Exists own_amt if (own_amt<500.00 & own_amt>200.00), kernel(rectangle) bwidth(300) degree(1) generate(x s) se(se) nograph pwidth(150)
keep x s se
drop if x==.
append using "Output/Temp/RD"
g ciplus=s+1.96*se
g ciminus=s-1.96*se
keep if x>200.00 & x<800.00
save "Output/Temp/RD", replace
*---generate bins for taking averages---*
use `tempdata', replace
keep if abs(norm_dist)<300.00
gen bin5=.
foreach X of num 0(25.00)300.00 {
di "`X'"
replace bin=-`X' if (own_amt - 500.00 >=-`X' & own_amt-500.00<(-`X'+25.00) & own_amt-500.00<0)
replace bin=`X' if (own_amt -500.00>`X' & own_amt-500.00<=(`X'+25.00))
}
tab bin5
drop if bin5==.
collapse Exists own_amt, by(bin5)
append using "Output/Temp/RD"
twoway (connected s x if x>500.00, sort msymbol(none) clcolor(black) clpat(solid) clwidth(medthick)) /*
*/(connected ciplus x if x>500.00, sort msymbol(none) clcolor(black) clpat(shortdash) clwidth(thin)) /*
*/(connected ciminus x if x>500.00, sort msymbol(none) clcolor(black) clpat(shortdash) clwidth(thin)) /*
*/(connected s x if x<500.00, sort msymbol(none) clcolor(black) clpat(solid) clwidth(medthick)) /*
*/(connected ciplus x if x<500.00, sort msymbol(none) clcolor(black) clpat(shortdash) clwidth(thin)) /*
*/(connected ciminus x if x<500.00, sort msymbol(none) clcolor(black) clpat(shortdash) clwidth(thin)) /*
*/ (scatter Exists own_amt, sort msize(med)xline(500) mcolor(black)), /*
*/ legend(off) graphregion(color(white)) /*
*/ ytitle("Exists in 2007") xtitle("Distance to Reform Threshold (ha)") xlabel(200(100)800) xsc(r(200.00 800.00)) ylabel(0(.2)1) ysc(r(0 1)) /*
*/xline(500.00, lpattern(shortdash) lc(black)) ylab(,nogrid) /*
*/ saving("Output/RDPlot_exists_300.pdf",replace)
graph export "Output/RDPlot_exists_300.pdf", replace
***************************************************************
** Using lpoly from Dell 2015: Distance to 500
** Dep Var: Exists; Bandwidth=150; Degree=1
use `tempdata', clear
keep if (own_amt>500.00 & own_amt<650.00)
lpoly Exists own_amt if (own_amt>500.00 & own_amt<650.00), kernel(rectangle) bwidth(150) degree(1) generate(x s) se(se) nograph pwidth(150)
keep x s se
drop if x==.
save "Output/Temp/RD", replace
use `tempdata', clear
keep if (own_amt<500.00 & own_amt>350.00)
lpoly Exists own_amt if (own_amt<500.00 & own_amt>350.00), kernel(rectangle) bwidth(150) degree(1) generate(x s) se(se) nograph pwidth(150)
keep x s se
drop if x==.
append using "Output/Temp/RD"
g ciplus=s+1.96*se
g ciminus=s-1.96*se
keep if x>350.00 & x<650.00
save "Output/Temp/RD", replace
*---generate bins for taking averages---*
use `tempdata', replace
keep if abs(norm_dist)<150.00
gen bin5=.
foreach X of num 0(25.00)150.00 {
di "`X'"
replace bin=-`X' if (own_amt - 500.00 >=-`X' & own_amt-500.00<(-`X'+25.00) & own_amt-500.00<0)
replace bin=`X' if (own_amt -500.00>`X' & own_amt-500.00<=(`X'+25.00))
}
tab bin5
drop if bin5==.
collapse Exists own_amt, by(bin5)
append using "Output/Temp/RD"
twoway (connected s x if x>500.00, sort msymbol(none) clcolor(black) clpat(solid) clwidth(medthick)) /*
*/(connected ciplus x if x>500.00, sort msymbol(none) clcolor(black) clpat(shortdash) clwidth(thin)) /*
*/(connected ciminus x if x>500.00, sort msymbol(none) clcolor(black) clpat(shortdash) clwidth(thin)) /*
*/(connected s x if x<500.00, sort msymbol(none) clcolor(black) clpat(solid) clwidth(medthick)) /*
*/(connected ciplus x if x<500.00, sort msymbol(none) clcolor(black) clpat(shortdash) clwidth(thin)) /*
*/(connected ciminus x if x<500.00, sort msymbol(none) clcolor(black) clpat(shortdash) clwidth(thin)) /*
*/ (scatter Exists own_amt, sort msize(med)xline(500) mcolor(black)), /*
*/ legend(off) graphregion(color(white)) /*
*/ ytitle("Exists in 2007") xtitle("Distance to Reform Threshold (ha)") xlabel(350(100)650) xsc(r(350.00 650.00)) ylabel(0(.2)1) ysc(r(0 1)) /*
*/xline(500.00, lpattern(shortdash) lc(black)) ylab(,nogrid) /*
*/ saving("Output/RDPlot_exists_150.pdf",replace)
graph export "Output/RDPlot_exists_150.pdf", replace
|