Skip to content
Linear RD with high-dimensional fixed effects in Stata
Stata TeX
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
example.do
rdhdfe.ado
rdhdfe.pkg
rdhdfe.sthlp
stata.toc

README.md

RDHDFE: Linear RD with high-dimensional fixed effects in Stata


Main Updates

  • 0.2.0 10feb2019:
    • allows for sharp rd
    • syntax similar to rdrobust
    • bug fixes
  • 0.1.0 07feb2019:
    • first version of the command

Description

This command makes it easier and quicker to estimate linear (fuzzy and sharp) regression discontinuity models with a large number of fixed effects. It is a wrapper for ivreghdfe and reghdfe that easily allows for the estimation of a linear regression discontinuity model with high-dimensional fixed effects. Commands like rdrobust are excellent but can be slow when estimating models with a high-dimensional fixed effects. rdhdfe takes advantage of the speed of reghdfe to obtain faster results.

The command will help you obtain estimates quickly, but it is not appropriate to do valid inference on regression discontinuity models. See the excelent rdrobust packages for that.

Install

cap ado uninstall rdhdfe
net install rdhdfe, from("https://raw.githubusercontent.com/luispfonseca/stata-rdhdfe/master/")

Alternatively, if you have installed haghish's github package for stata, just execute:

github install luispfonseca/stata-rdhdfe

Usage

See example.do for examples. Here are a few. Start by generating data for estimation:

clear all

* generate data
set obs 10000
gen y = uniform()
gen x = uniform() - 0.5
gen id = 1 + int((_n-1)/100)

local cut 0.2
local low_prob 0.2
local high_prob 0.7
local effect_size 0.75

* generate fuzzy treatment
gen treatrandom = runiform()
gen treated = 0
replace treated = 1 if x <  `cut' & treatrandom < `low_prob'
replace treated = 1 if x >= `cut' & treatrandom < `high_prob'

* create an effect for the treatment
replace y = y + treated * `effect_size'

Now, use the command to estimate. The syntax is similar to that of rdrobust. You can also compare the outputs:

* fuzzy rd
rdhdfe   y x, c(0.2) h(0.2) fuzzy(treated) kernel(triangular) first
rdrobust y x, c(0.2) h(0.2) fuzzy(treated) kernel(triangular)

* with id fixed effects
rdhdfe       y x, c(0.2) h(0.2) fuzzy(treated) kernel(triangular) absorb(id) first
xi: rdrobust y x, c(0.2) h(0.2) fuzzy(treated) kernel(triangular) covs(i.id)

* sharp rd
rdhdfe       y x, c(0.2) h(0.2) absorb(id)
xi: rdrobust y x, c(0.2) h(0.2) covs(i.id)

We can also call for robust or two-way clustering from ivreghdfe.

* can call robust or two-way clustering from (iv)reghdfe
rdhdfe y x, c(0.2) h(0.2) fuzzy(treated) first kernel(triangular) robust
rdhdfe y x, c(0.2) h(0.2) fuzzy(treated) first kernel(triangular) cluster(id)

See the help file installed for all the options and defaults by calling help robust in Stata.

To do:

  • Feel free to tell and help

Author

Luís Fonseca
London Business School
lfonseca london edu
https://luispfonseca.com

You can’t perform that action at this time.