How to fix "Error: Can't join on '.rows' x '.rows' because of incompatible types (list / list)" using censReg

Michael

I'm trying to run a tobit regression in r using the censReg package. I have panel data with a number of firms over several years. I set the data up using pdata.frame but when I try to run the regression this error message pops up:

Error: Can't join on '.rows' x '.rows' because of incompatible types (list / list)

What do I need to do to solve this issue?

testPanelData <- pdata.frame(testSample, index = c("gvkey", "fyear"))
estResult <- censReg(REP ~ Cash + Size + Leverage, data = testPanelData)
#Error: Can't join on '.rows' x '.rows' because of incompatible types (list / list)
potterzot

Is your data grouped using dplyr's group_by()? If yes you will get this error when running a plm::plm() model. To fix it, append ungroup() to your dplyr command, e.g.:

library(plm)
library(dplyr)

data(mtcars)

d_grp <- mtcars %>% group_by(cyl)

pd <- pdata.frame(d_grp, index = c("cyl"))
plm(mpg ~ hp, data = pd) # Generates the error:
# Error: Can't join on '.rows' x '.rows' because of incompatible types (list / list)

# To fix:
d_grp2 <- d_grp %>% ungroup()
pd2 <- pdata.frame(d_grp2, index = c("cyl"))
plm(mpg ~ hp, data = pd2) # No error


Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related