I am using the formula below to estimate the fixed effect panel model in R:

model_fe <- plm(formula = y~ x, data, 
                index = c("firm ID", "year"), 
                model = "within", effect = "individual")

However, I need to include 3 fixed effects simultaneously in the model (firm, industry, and year), but not sure how to do that in R. Can I include the 'industry' term in the 'index' function? If yes, what will be the effect? two ways? Please suggest if there is also some other way to simultaneously accommodate all the three.

I think I can also use dummy variables by using the function factors(), but that will add additional variables to the model which will in turn decrease the degree of freedom and inflate the r-squared.

  • $\begingroup$ Welcome. What do you hope to gain by adjusting for firm and industry fixed effects simultaneously? $\endgroup$ Commented May 10, 2022 at 19:17

1 Answer 1


It seems you're dealing with multidimensional panel data. Maybe this link that can help you.

However, if the time variable is $year$, the group variable should be $firm$ and the extra-dimension will be $industry$. How many industries/year/industries do you have? The size of each dimension is critical.

The problem with multiple effects models (or more) is that practically you're doing a model for each exact dimension (industry-firm-year) with few degrees of freedom each. Wooldridge has some literature about that.

Perhaps, you need to review why is that you need the multiple effects. To view results on that level or for statistical treatment purposes. Too many factors could create an overfitted model.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.