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)?
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)? $\endgroup$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? $\endgroup$