R中具有二元因变量的面板数据 [英] Panel data with binary dependent variable in R

查看:52
本文介绍了R中具有二元因变量的面板数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用具有二元因变量的面板数据集在 R 中进行回归?我熟悉将 glm 用于 logit 和 probit,将 plm 用于面板数据,但不确定如何将两者结合起来.是否有任何现有的代码示例?

Is it possible to do regressions in R using a panel data set with a binary dependent variable? I am familiar with using glm for logit and probit and plm for panel data, but am not sure how to combine the two. Are there any existing code examples?

编辑

如果我能弄清楚如何提取 plm() 在进行回归时使用的矩阵,也会很有帮助.例如,您可以使用 plm 来处理固定效应,或者您可以使用适当的虚拟变量创建一个矩阵,然后通过 glm() 运行它.但是,在这种情况下,自己生成假人很烦人,让 plm 为您做会更容易.

It would also be helpful if I could figure out how to extract the matrix that plm() is using when it does a regression. For instance, you could use plm to do fixed effects, or you could create a matrix with the appropriate dummy variables and then run that through glm(). In a case like this, however, it is annoying to generate the dummies yourself and it would be easier to have plm do it for you.

推荐答案

model.frame(plmmodel) 

将为您提供plm实际用于拟合模型的数据框(即,如果您有NA等,则在按列表删除之后)

will give you the data frame that is actually used by plm for fitting the model (i.e. after list-wise deletion if you have NAs, etc.)

我不认为 plm 已实现函数来估计具有二元结果的模型,但我可能错了.查看参考手册:http://cran.r-project.org/web/packages/plm/index.html

I don't think that plm has implemented functions to estimate models with binary outcomes, but I may be wrong. Check out the reference manual at: http://cran.r-project.org/web/packages/plm/index.html

如果我是对的,这表明如果没有大量工作来扩展 plm 提供的功能,您就不能将两者结合起来".

If I'm right, this would suggest that you can't "combine the two" without considerable work in extending the functions provided by plm.

这篇关于R中具有二元因变量的面板数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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