Panel data with binary dependent variable in R
Asked Answered
C

4

5

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.

Condescending answered 10/5, 2010 at 15:36 Comment(1)
Is this programming question? Take a look on #102556Practical
C
1
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.

Catt answered 16/5, 2010 at 12:5 Comment(0)
T
9

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.

Transmogrify answered 21/1, 2014 at 4:37 Comment(0)
R
2

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

Recommit answered 10/5, 2010 at 18:44 Comment(0)
C
1
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.

Catt answered 16/5, 2010 at 12:5 Comment(0)
P
0

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.

Passport answered 20/5 at 14:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.