Solved – Multiple Time Fixed Effects in Panel Regression

fixed-effects-modelheterogeneitypanel data

I have weekly panel data for more than a hundred cities. The independent variables are temperature and precipitation. The time dimensions; year, month, and week – likely have time invariant characteristics and are all important for proper estimation.

I was wondering if there are any issues in controlling for all three fixed effects (year, month, and week) in the same regression? Thanks!

Best Answer

You can model year/time/week in various ways. First of all, I wonder if there really is an effect of month when adjusting for week? It depends on what you measure, obviously, but still, any effect that varies across the year should be taken care of by week.

In any case, I recommend using regression splines in a generalized additive model to do this. To take the correlation between repeated measurements within each city into account, you need to use a mixed model, so a generalized additive mixed model will be fine. Using R code:

library(mgcv)
M1 <- gamm(outcome ~ temperature + precipitation + s(year) + s(month) + s(week), random=~1|city)

And you can also try without month:

M2 <- gamm(outcome ~ temperature + precipitation + s(year) + s(week), random=~1|city)

You can now compare the models since the models are nested:

anova(M1$lme, M2$lme)

The second model is nested within the first, and a low p-value indicates that month should be kept, and a high p-value indicates that it should be dropped from the model.