R 中带有二进制因变量的面板数据

发布于 2024-08-31 19:29:46 字数 273 浏览 2 评论 0原文

是否可以使用带有二元因变量的面板数据集在 R 中进行回归?我熟悉使用 glm 表示 logit 和 probit 以及使用 plm 表示面板数据,但不知道如何将两者结合起来。有现成的代码示例吗?

编辑

如果我能弄清楚如何提取 plm() 在进行回归时使用的矩阵,也会很有帮助。例如,您可以使用 plm 来实现固定效果,或者可以使用适当的虚拟变量创建一个矩阵,然后通过 glm() 运行该矩阵。然而,在这种情况下,自己生成虚拟模型会很烦人,让 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?

EDIT

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

叹倦 2024-09-07 19:29:47

“pglm”包可能就是您所需要的。

http://cran.r-project.org/web/packages/pglm /pglm.pdf

该包为面板数据提供了一些类似 glm 模型的功能。

The package "pglm" might be what you need.

http://cran.r-project.org/web/packages/pglm/pglm.pdf

This package offers some functions of glm-like models for panel data.

情深如许 2024-09-07 19:29:47

也许 lme4 包就是您正在寻找的。
似乎可以使用命令 glme 来运行具有固定效应的广义回归。
但您应该意识到,具有二元因变量的面板数据与通常的线性模型不同。

此网站可能会有所帮助。

此致,
马诺埃尔

Maybe the package lme4 is what you are looking for.
It seems to be possible to run generalized regressions with fixed effects using the comand glme.
But you should be aware that panel data with binary dependent variable is different than the usual linear models.

This site may be helpful.

Best regards,
Manoel

娇纵 2024-09-07 19:29:47
model.frame(plmmodel) 

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

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

如果我是对的,这表明如果不做大量工作来扩展 plm 提供的功能,就无法“将两者结合起来”。

model.frame(plmmodel) 

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.)

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

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

向地狱狂奔 2024-09-07 19:29:47

Bartolucci, F. & 的 R 包“cquad” Nigro, V.(2010,Econometrica)执行静态和动态面板 Logit 估计。但该包不提供预测值,因此如果面板预测是主要目标,则没有用处。

The R package 'cquad by Bartolucci, F. & Nigro, V. (2010, Econometrica) performs both static and dynamic panel logit estimation. But this package does not provide predicted values so not useful if forecasting from panel is the main objective.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文