问题
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
来源:https://stackoverflow.com/questions/22364679/plm-error-variable-lengths-differ