# Why we need to control for the interation of year and industry fixed effects?

Normally, we control for firm and year fixed effects, but in some case I saw people control for the firm along with yearxindustry or firm and yearxregion fixed effects. Could you please hint me why they need to do so?

When you control for not just year fixed effects but instead year-region or year-industry it adds flexibility.

The year fixed effects controls in a flexible manner for the time-trend and is more flexible - less restrictive - than for example assuming that the time trend is for example linear $$a \cdot t$$, second order polynomial $$at + bt^2$$, exponential $$exp(at)$$ ect.

Nevertheless, year fixed effects are still restrictive compared to year-region or year-industry because the assume that the time trend is the same for all regions or for all industries instead of allowing different regions to follow different trends or different industries.

Consider for example this plot here

and assume that it show the average wage of women (red) and the average wage of men (black) over time.

We then conclude that the gender wage-gap is closing. However, someone then points out this is not really the case because although female workers on average over time get the same as male workers this is simply because female workers have changed from predominantly working in the low-wage industry to be working in the high-wage industry.

Offcourse you are sharp and you run a regression controlling for industry

$$\log y_{it} = \beta_0 + \alpha \cdot \text{male}_{it} + \lambda \cdot \text{industry}_{it} + \delta_t + \epsilon_{it}$$

which is a good idea and for the simulated data used to generate the plot above you then get an estimate $$\hat \alpha = 3.05$$ clearly showing that male workers are given more in wage than female workers.

However, the true $$\alpha$$ is actually even larger and equal to $$4$$ so you are still underestimating the degree to which female workers are discriminated on the labor market.

In this example this happens because:

Over time the wage in the high wage sector increases faster than the wage in the low wage sector. So while women over time changed to the high wage sector you are undercontrolling for the sector effect because the early year with a small difference between the sectors bias the sector effect downwards.

In this case what you should have been doing to get an unbiased estimate was to run the regression

$$\log y_{it} = \beta_0 + \alpha \cdot \text{male}_{it} + \lambda_{st} + \epsilon_{it}$$

where $$\lambda_{st}$$ is the sector-time fixed effect.

You can simulate this example in R using the following code

library(data.table)
library(lfe)
N1 <- 1000
N2 <- 1000
N <- N1+N2
T <- 10
b0 <- 1

# a1 is the true gender effect
a1 <- 4

gender <- rep(c(rep(0,N1),rep(1,N2)),T)
a2 <- rep(1:T * 2,N)
dt <- data.table(id=rep(1:N,each=T),time=rep(1:T,N),gender=gender)
setkey(dt,time,gender)
industry <- c()
for (t in 1:T)
{
temp1 <- sample(c(0,1),N1,replace=TRUE,prob=c(0.5,t/T))
temp2 <- sample(c(0,1),N1,replace=TRUE,prob=c(0.5,0.5))
industry <- c(industry,temp1,temp2)
}
dt$$industry <- industry setkey(dt,id,time) dt$$log_y <- b0 + a1*dt$$gender + a2*dt$$industry + 0.3*dt$$time + rnorm(N*T) foo <- dt[,.(m_wage=mean(log_y)),by=.(time,gender)] plot(1:T,foo[gender==0,]$$m_wage,ylim=c(0,20),col="red",type="l")
points(1:T,foo[gender==1,]$m_wage,type="l") dt$$i_time <- interaction(dt$$time,dt$industry)
# Regression with industry dummy

summary(felm(log_y ~ gender+industry|time,data=dt))
#          Estimate Std. Error t value Pr(>|t|)
# gender    3.05645    0.04164   73.41   <2e-16 ***
# industry 11.13346    0.04215  264.12   <2e-16 ***

# Regression with industry time fixed effects
summary(felm(log_y ~ gender |i_time,data=dt))

#        Estimate Std. Error t value Pr(>|t|)
# gender  4.00873    0.01443   277.7   <2e-16 ***

savePlot("male_female.jpg",type="jpg")

• Thank you for your clear explanation, I am using SAS so I am wondering if there is any SAS code available for this example. Thank you. May 15 '21 at 23:20
• You are welcome. Unfortunately SAS i dont know. There is also an accept button you can press if you find this answered your question. May 16 '21 at 5:39
• I am curious about one point: where λst is the sector-time fixed effect. So at that time, can you please help me to clarify what exactly λst stand for ? Thanks. May 16 '21 at 6:01
• I can try. But I think you should make this follow up question in a seperate post. But $\lambda_{st}$ is short hand notation of $\sum_s \lambda_{st} 1[(i,t) \in s]$ where $1[(i,t) \in s]$ is indicator of individual $i$ working in sector $s$ at time $t$. So it is just a factor variable with levels being sector-time groups. I ignore the dummy variable trap. But this may not necessarily clean up any confusion you are having. May 16 '21 at 10:55
• Thank you for your clear explanation. I raise another question here cited your answer as mentioned, I am wondering if you can have a look on that. quant.stackexchange.com/questions/64055/… May 17 '21 at 4:47