0

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

landroni
  • 2,902
  • 1
  • 32
  • 39
  • 1
    There are a few possible problems. You may need to use the `na.action` argument. Can you post a few lines of the data? – Rich Scriven Mar 12 '14 at 23:06
  • Sorry for the delay. It took a few independent eyes, but the error was in the data. I was pulling data from multiple different sources with different protocols for missingness. Thanks though! – user3412714 Mar 20 '14 at 22:47

0 Answers0