-
Notifications
You must be signed in to change notification settings - Fork 0
/
PlaceboPooled.do
139 lines (100 loc) · 3.11 KB
/
PlaceboPooled.do
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
* Aquí creo un programa pequeño para la extracción.
capture program drop extraccion
program define extraccion
matrix define B=e(tau_cl)
scalar beta=B[1,1]
matrix define SE=e(se_tau_cl)
scalar se=SE[1,1]
matrix define H=e(h_l)
scalar bh=H[1,1]
matrix define PV=e(pv_cl)
scalar pvalor=PV[1,1]
matrix define Nleft=e(N_h_l)
matrix define Nright=e(N_h_r)
scalar Num=Nleft[1,1]+Nright[1,1]
end
use "$out/Aumento_1996", clear
append using "$out/Aumento_1997"
append using "$out/Aumento_1998"
append using "$out/Aumento_1999"
append using "$out/Aumento_2000"
* Acá guardamos el estilo Currie & Fallick:
cap drop pointestCF
gen pointestCF=.
cap drop stderrCF
gen stderrCF=.
cap drop pvalCF
gen pvalCF=.
cap drop NobsCF
gen NobsCF=.
* Acá el estilo Abbate y Jiménez:
cap drop pointestAJ
gen pointestAJ=.
cap drop stderrAJ
gen stderrAJ=.
cap drop pvalAJ
gen pvalAJ=.
cap drop NobsAJ
gen NobsAJ=.
cap drop powerAJ
gen powerAJ=.
cls
forvalues j=1/6 {
reg e`j' c.z##i.treated
matrix define RES=r(table)
scalar beta=RES[1,3]
scalar se=RES[2,3]
scalar pvalor=RES[4,3]
matrix define N=e(N)
scalar Num=N[1,1]
replace pointestCF=beta in `j'
replace stderrCF=se in `j'
replace pvalCF=pvalor in `j'
replace NobsCF=Num in `j'
rdrobust e`j' z, p(1) kernel(uni) h(`h1')
extraccion
local h=bh
* El cambio de signo es porque el paquete asume que los de la derecha son los tratados. En nuestro caso es al revés.
replace pointestAJ=-beta in `j'
replace stderrAJ=se in `j'
replace pvalAJ=pvalor in `j'
replace NobsAJ=Num in `j'
rdpow e`j' z, tau(0.09) h(`h')
scalar powpowpow=r(power_rbc)
replace powerAJ=powpowpow in `j'
}
* Power is the probability that a test of significance will pick up on an effect that is present
/*
Ex-post (or observational) RD analysis. The researcher already has the final
data for analysis, and the goal is to assess the statistical power underlying the
testing procedures implemented in rdrobust. Specifically, rdpow will estimate the
statistical power of the robust bias-corrected inference methods implemented using
rdrobust for a given hypothesized RD treatment effect (denoted τA below). In this
case, the sample size is fixed, and the goal is to understand the statistical power
that different inference procedures have. For example, the researcher can compare
the statistical power between using local linear and local quadratic methods.
*/
keep pointestCF-powerAJ
drop if pointestCF==.
tostring pointestCF stderrCF pointestAJ stderrAJ powerAJ, replace format(%12.3f) force
tostring NobsCF NobsAJ, replace format(%12.0fc) force
foreach x in stderrCF stderrAJ {
replace `x'="("+`x'+")"
}
foreach v in CF AJ {
replace pointest`v'=pointest`v'+"*" if pval`v'>=0.05 & pval`v'<0.1
replace pointest`v'=pointest`v'+"**" if pval`v'>=0.01 & pval`v'<0.05
replace pointest`v'=pointest`v'+"***" if pval`v'<0.01
drop pval`v'
}
sxpose, clear
gen desc=""
order desc _v*
replace desc="ET: OLS à la CF (1996)" in 1
replace desc="" in 2
replace desc="N.Obs" in 3
replace desc="ET: DRD" in 4
replace desc="" in 5
replace desc="N.Obs" in 6
replace desc="Poder(0.09)" in 7
export excel "$out/PlaceboCFvsAJPool", sheetmodify