# Adding year dummy to a fixed-effect model for <monthly> panel-data

Working with a panel dataset (n=50 units, t=20 years at the monthly level = 240), I am fitting a fixed-effects model while controlling for the seasonality by monthly dummy variables. I defined the panel data by unit (1:50) and the time as a year-month (1:240). Here is how I did that in r's plm package.

paneldata <- pdata.frame(data, c("unit", "year_month_serial"))
fe_model <- plm(y ~ x1+x2+x3+factor(month)
, data= paneldata
, model="within"
, effect="individual")


My understanding is this model controls for the unit level as a fixed-effect and seasonality (by monthly dummies) without explicitly taking into account the year (time) effects. My question: is it appropriate to add a year variable factor(year) to the model to capture the time effects? What statistical tests that can be run to verify?

Similarly (or maybe not), if the units are companies, for instances, and they are categorized in 4 industries (which are believed to have an effect on the dependent variable due to different policies or characteristics), What is an appropriate to control for the industry level (given that the industry level is time-invariant and cannot be used as a dummy indicator in the model)?

• This is fine, indeed it's a very standard thing to do. Regarding question 2, you can't do that, that is the very essence of a fixed effects analysis. By definition you cannot isolate effects that are constant over time, it doesn't matter though, the individual (firm) effects takes care of sector effects for you, without you lifting a finger. – Repmat May 20 '17 at 19:09
• Thanks! Is it fair to say that including the year dummies captures the effect of aggregate time-series trends? How does adding year dummies compare to not adding them while estimating the model as model="twoway"? I see your point re question 2 but I didn't get the part after "it doesn't matter ..." - I guess my question is more like: is there a way to control for the fact that different firms are clustered within specific industry levels (not necessarily via a fixed-effects model)? – M_M May 20 '17 at 20:00
• Using the twoways argument in plm, is a convenient way to add time effects. Specifically it adds the time variable "year_month_serial" via dummies (although they are surpressed in the output). Also note that when using two ways, the models is estimated much more slowly that by simply adding appropriate time factors. I see your comment, you might want to look into hierarchical models. These model are more complicated than your standard fixed effects, but they are build for what you mention in your comment. Although they come with the price, of much much stronger assumptions. – Repmat May 20 '17 at 20:10
• Thanks, that is useful! I had to create the variable "year_month_serial" to ensure having a consecutive panel data (for lag definitions) but what I am interested in controlling for are two things: seasonality (monthly dummies) and trend (year dummies) - I don't see adding (240-1) year_month_serial dummies make sense in this case. So it seems that FE model="individual" and adding two sets of dummies; months and years is the way to go, agree? Thanks for the suggestion. Can you point out what are the assumptions in the case of estimating a FE model without controlling for industry levels? – M_M May 20 '17 at 20:22