plm error variable lengths differ

匿名 (未验证) 提交于 2019-12-03 01:41:02

问题:

I'm completely new to R, and I'm trying to run an unbalanced fixed effects model using plm. I'm not sure if this question has been answered as most of the answers on this web site are beyond my technological grasp.

My data is set up in five columns, Year, Country, Var1, Var2, and Var3. The Var3 column is missing data sporadically. My goal is to regress Var1 for a country-year observation on the Var2, Var3, and an interaction; with country fixed effects. The missing Var 3 data is blank, no n/a's. Here's my code:

>model<-plm(Var1~Var2+Var3+Var2*Var3, data=data, index=c("Year","Country"), model="within")  >Error in model.frame.default(formula = y ~ X - 1, drop.unused.levels = TRUE) :    variable lengths differ (found for 'X') 

Without trying to stuff my data set here, does anybody have an idea what I should do? I really appreciate your patience

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!