Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Firm and year fixed effects with two way clustering- Is this command correct?

    I have an unbalanced data of 3000 firms over 30 years. I am trying to run a regression with firm and year fixed effects and two way clustering across firms and years. I am trying the following commands. Is this the correct way to estimate?

    1) xi: xtivreg2 Y x1 x2 x3, fe cluster( firmID Year)

    or

    2) xi: xtivreg2 Y x1 x2 x3 i.year, fe cluster( firmID Year)

    Also, it gives me centered and uncentered R2. Which one of them is equivalent to the adjusted-R2?
    Finally, there is NO constant in the output. Why is that?

  • #2
    You'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex.

    First, why use xtivreg2 when you don't have an endogenous variable? If you want many fixed effects, regdhfe is more appropriate. But for what you're doing, xtreg probably works fine. Or, with fancy error structures xtgls might work.

    Second, the two models are different. The second allows for different "intercepts" for each year while the first doesn't. You also have year in one place and Year in another - these are different variables in Stata.

    As for R-squared, in ivreg, the r-square is not what you think it is. The sum of squared errors that is minimized is not the ordinary ols sum of squares so you can even get negative r-squares in some such models and some datasets. Neither centered nor uncentered r-square is an adjusted r-square.

    Comment


    • #3
      Thanks for this. I am now using regdhfe, the coefficients and t-stats etc are the same as xtivreg2 command but at least I can have an proper adjusted R2 now instead of a centered r-square. Thank a lot for your help!!!

      Comment

      Working...
      X