I am trying to run a 2-way fixed effect model in R, using plm. I am trying to get the treatment effect of an event on municipalities votes on referenda.
I would like to run the model with municipality and referenda fixed effects. Each row or unit is a pair of municipality*referendum.
I am trying to fit the model using the following:
model_2fe <- plm(vote.ant.immig ~ pre.post, data = clean.df, effect = "twoways", index = c("municipality.code", "ref.code"))
And I keep on getting the following:
Error in plm.fit(data, model, effect, random.method, random.models, random.dfcor, : empty model
If it helps: pre.post is a factor indicating treatment condition (1,0), vote.ant.immig is a numeric object, municipality.code is a factor, as is ref.code.
Could anyone help me? Thanks!