Announcement

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

  • Panel data regression, xtreg fe

    Hi statalist! I have some question related to running regression of panel data with fixed effect, I really hope you guys could help me with:

    1/ What is the different between these command?
    xtreg Y X, fe vce(cluster FIRM)
    xtreg Y X i.FIRM, fe vce(cluster FIRM)
    xtreg Y X i.TIME i.FIRM, fe vce(cluster FIRM)
    Is [xtreg Y X, fe] only control for firm fixed effect?

    2/ My panel data is strongly balance, it has 26 FIRMS and 24 quarters (from 2017Q1 to 2022Q4).
    + If I want to control for both time and firm fixed effect, which xtreg command is suitable?
    + The mean firm SIZE=6. How can I separate regression between large firm (Size >6) and small firm (Size =<6)?

    Thank you in advance.

  • #2
    1/ You don't say how you -xtset- the data, but I'll assume that you did -xtset FIRM-.
    -xtreg Y X, fe vce(cluster FIRM)- is the simplest way to code a regression of Y on X with FIRM-level fixed effects and clustered standad errors at the FIRM level.
    -xtreg Y X i.FIRM, fe vce(cluster FIRM)- will do the same as the preceding regression. With -fe- specified, i.FIRM is completely redundant and in the output it will show up as "(omitted)" due to colinearity with the fixed effects.
    xtreg Y X i.TIME i.FIRM, fe vce(cluster FIRM)- again includes the redundant i.FIRM term, which will appear in the output as "(omitted)." However, this model will include TIME fixed effects, whereas the previous models do not.
    Yes, -xtreg Y X, fe- adjusts only for firm fixed effects. Even if you specified -xtset FIRM TIME-, -xtreg, fe- does not inclue TIME fixed effects unless you specify i.TIME in the covariates.

    2/ N = 26 firms is borderline for using clustered standard errors. So I certainly would not use clustered standard errors in subset analyses which, in the best case scenario, each have only 12 firms--that's definitely not enough clusters for clustered standard errors to be valid. The way I would approach this is with an interaction term.
    Code:
    gen byte large = SIZE > 6
    xtreg Y i.SIZE##c.X, fe
    margins SIZE, dydx(X)
    Note: In the above I assume X is a continuous variable. If it is discrete, use i.x, not c.X.
    If you are not familiar with Stata's factor variable notation, read -help fvvarlist-. If you are not familiar with the -margins- command and interaction models, see https://www3.nd.edu/~rwilliam/stats/Margins01.pdf and https://www3.nd.edu/~rwilliam/stats2/l53.pdf for particularly readable explanations.

    Comment


    • #3
      Hi Clyde,

      Thank you so much for your help!

      Comment

      Working...
      X