26 Nov 2024
The basic idea is this:
We call these continuous variables “Running variables” because we run along them until we hit the cutoff
TRUE
when treatment is applied - above or below the cutoff\[Y = \beta_0 + \beta_1Treated + \beta_2XCentered + \beta_3Treated\times XCentered + \varepsilon\]
(as an aside, sometimes the effect of interest is the interaction term - the change in slope! This answers the question “does the effect of \(X\) on \(Y\) change at the cutoff? This is called a”regression kink” design. We won’t go more into it here, but it is out there!)
How do we do this? Interactions again. Take any regression equation… \[Y = \beta_0 + \beta_1X + \beta_2X^2 + \varepsilon\]
And just center the \(X\) (let’s call it \(XC\), add on a set of the same terms multiplied by \(Treated\) (don’t forget \(Treated\) by itself - that’s \(Treated\) times the interaction!)
\[Y = \beta_0 + \beta_1XC + \beta_2XC^2 + \beta_3Treated + \beta_4Treated\times XC + \beta_5Treated\times XC^2 + \varepsilon\]
feols(Y ~ X_cent..
Dependent Var.: Y
Constant -0.0340 (0.0385)
X_centered 0.6990. (0.3641)
treatedTRUE 0.7677*** (0.0577)
X_centered square -0.5722 (0.7117)
X_centered x treatedTRUE 0.7509 (0.5359)
treatedTRUE x I(X_centered^2) 0.5319 (1.034)
_____________________________ __________________
S.E. type IID
Observations 1,000
R2 0.84779
Adj. R2 0.84702
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
More assumptions, limitations, and diagnostics!
m1 <- feols(Y~treated*X_centered, data = df)
m2 <- feols(Y~treated*X_centered, data = df %>% filter(abs(X_centered) < .25))
m3 <- feols(Y~treated*X_centered, data = df %>% filter(abs(X_centered) < .1))
m4 <- feols(Y~treated*X_centered, data = df %>% filter(abs(X_centered) < .05))
m5 <- feols(Y~treated*X_centered, data = df %>% filter(abs(X_centered) < .01))
etable(m1,m2,m3,m4,m5, keep = 'treatedTRUE')
m1 m2
Dependent Var.: Y Y
treatedTRUE 0.7467*** (0.0376) 0.7723*** (0.0566)
treatedTRUE x X_centered 0.4470*** (0.1296) 0.6671. (0.4022)
________________________ __________________ __________________
S.E. type IID IID
Observations 1,000 492
R2 0.84769 0.74687
Adj. R2 0.84723 0.74531
m3 m4 m5
Dependent Var.: Y Y Y
treatedTRUE 0.7086*** (0.0900) 0.6104*** (0.1467) 0.5585 (0.4269)
treatedTRUE x X_centered -1.307 (1.482) 6.280 (4.789) 41.21 (72.21)
________________________ __________________ __________________ _______________
S.E. type IID IID IID
Observations 206 93 15
R2 0.69322 0.59825 0.48853
Adj. R2 0.68867 0.58470 0.34904
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Sharp RD estimates using local polynomial regression.
Number of Obs. 1000
BW type mserd
Kernel Triangular
VCE method NN
Number of Obs. 501 499
Eff. Number of Obs. 185 170
Order est. (p) 1 1
Order bias (q) 2 2
BW est. (h) 0.174 0.174
BW bias (b) 0.293 0.293
rho (h/b) 0.594 0.594
Unique Obs. 501 499
=============================================================================
Method Coef. Std. Err. z P>|z| [ 95% C.I. ]
=============================================================================
Conventional 0.707 0.085 8.311 0.000 [0.540 , 0.874]
Robust - - 6.762 0.000 [0.484 , 0.878]
=============================================================================
Sharp RD estimates using local polynomial regression.
Number of Obs. 1000
BW type mserd
Kernel Triangular
VCE method NN
Number of Obs. 501 499
Eff. Number of Obs. 185 170
Order est. (p) 1 1
Order bias (q) 2 2
BW est. (h) 0.174 0.174
BW bias (b) 0.293 0.293
rho (h/b) 0.594 0.594
Unique Obs. 501 499
=============================================================================
Method Coef. Std. Err. z P>|z| [ 95% C.I. ]
=============================================================================
Conventional 0.707 0.085 8.311 0.000 [0.540 , 0.874]
Robust - - 6.762 0.000 [0.484 , 0.878]
=============================================================================
PB4A7- Quantitative Applications for Behavioural Science