0
$\begingroup$

We have a great discussion here about controlling for three dimensions (firm, year, and industry fixed effects)

A reasonable way to do so so far is controlling for firms fixed effect and industry * year fixed effect.

However, today my senior friend said that we can do three dimensions controlling in Stata by using

reg y x i.firm. i.year i.industry

I cannot check this code because my data is around 300,000 obs so STATA will create a super big matrix of coefficients.. I am wondering is it code right and how to convert it to reghdfe code?

$\endgroup$
3
$\begingroup$

The short answer is yes, you can control for any number of dimensions. However, there are some caveats.

In terms of being able to estimate the model, you need at least one observation per cell. In your case, you need to have at least one observation for every firm$\times$year$\times$industry combination.

If you have only a single observation per cell, then you will have a perfect fit ($R^2 = 1$) and your residual will be swallowed up by your fixed effects estimates. Your coefficient will then simply equal your corresponding $y$-value.

In general, your fixed effects estimates will equal the average $y$ value over all observations in the given cell.

This means that if you want to have "good" estimates of your fixed effects coefficients, you need many observations per cell. To get consistent estimates, the number of observations per cell needs to go to infinity as the number of observations goes to infinity.

$\endgroup$
2
  • 1
    $\begingroup$ Not sure your 4th para is correct. It is not just the average y value, but the average y value partialled out from other regressors/fixed effects $\endgroup$
    – ChinG
    Jul 13 at 17:15
  • 1
    $\begingroup$ @ChinG I was under the impression that there were only fixed effects (no other regressors). If there are, you are indeed correct. $\endgroup$
    – tdm
    Jul 14 at 5:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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