Conrolling for Fixed Effects in Regression Discontinuity in R

1.9k views Asked by At

I am using the Rdrobust package to estimate the effect of a national policy on county level outcomes. In my covariates I have included dummies indicating states to control for state level fixed effect. However, when we run the code, I get following error message:

Error in chol.default(ZWZ) :

the leading minor of order 33 is not positive definite.

Where Z is the matrix containing my covaraites and the 33-th variable is the dummy for state 1.

my code is:

out = rdrobust(y, x, covs=z, kernel = "triangular", p=2, bwselect="mserd",
                 cluster= cluster)

I am not sure how to get rid of this error message. More importantly, I am wondering if there is any other way to control for fixed effects (e.g. state-level) in Rdrobust package.

Thanks in advance for your help

1

There are 1 answers

0
Sebastian Calonico On BEST ANSWER

The recent rdrobust version 1.0.1 should take care of this error. To generate fixed effects from a categorical variable "state" you can do something like:

state.f = factor(state)

state.d = model.matrix(~state.f+0)

out = rdrobust(y, x, covs = state.d)