控制 R 中回归不连续性的固定效应 [英] Conrolling for Fixed Effects in Regression Discontinuity in R

查看:126
本文介绍了控制 R 中回归不连续性的固定效应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Rdrobust 软件包来估计国家政策对县级结果的影响.在我的协变量中,我包含了指示状态的虚拟变量,以控制状态级别的固定效应.但是,当我们运行代码时,我收到以下错误消息:

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:

chol.default(ZWZ) 中的错误:

Error in chol.default(ZWZ) :

33 阶的前导辅音不是正定的.

the leading minor of order 33 is not positive definite.

其中 Z 是包含我的协变量的矩阵,第 33 个变量是状态 1 的虚拟变量.

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

我的代码是:

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

我不知道如何消除这个错误信息.更重要的是,我想知道是否还有其他方法可以控制 Rdrobust 包中的固定效果(例如州级).

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.

预先感谢您的帮助

推荐答案

最近的 rdrobust 版本 1.0.1 应该处理这个错误.从分类变量状态"产生固定效应您可以执行以下操作:

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)

这篇关于控制 R 中回归不连续性的固定效应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆