Announcement

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

  • Problem: Regression with Fixed Effects (multiple dummies variables)

    Dear all,
    I want to run the following regressions with Fixed Effect for time (year) and firm identifiers (cusip).

    SALARY the dependent variable
    FIRMSIZE the independent variable
    YearFE dummy variable (for categorical variable year)
    FirmFE dummy variable (for categorical variable cusip)

    The models are:

    1] SALARY=α+β_a * FIRMSIZE + YearFE + ε
    Based on:
    xi: areg dependent_variable independent_variables i.year, absorb(firm_identifier)
    I write:

    Code:
     xi: areg SALARY FIRMSIZE i.year, absorb(cusip)
    Hopefully is correct (?)

    2] SALARY=α+β_b *FIRMSIZE + YearFE + FirmFE + ε
    Based on:
    xi: reg dependent_variable independent_variables i.year i.firm_identifier
    I write:

    Code:
    xi: reg SALARY FIRMSIZE i.year i.cusip
    Q1] the calculated coefficients β_a and β_b are equal, is that correct? Is there an error with the syntaxis?

    I am adding a new dummy variable:
    CRISIS. CRISIS is a dummy variable that takes value 1 if the year is bigger or equal to 2008, 0 otherwise. So:
    Code:
    gen CRISIS=(year>=2008)
    Then I want to run the following regression:

    3] SALARY=α + β _c FIRMSIZE *CRISIS +γ_c *FIRMSIZE + YearFE + ε

    Q2] Sorry but I don’t know how to write it… Any suggestions?

    Thank you in advance for your help!!

    ----------------------------------------------------------------------
    I am using STATA MP 13.1, in a Windows 10 PC.

  • #2
    Your code for question 1 looks OK. For question 2 (and also 3) you should not use -regress- because you have multiple observations per cusip, hence error terms are probably not independent. You need to use a fixed effects regression instead. See -help xtset- and -help xtreg-. And, yes, that should give you the same regression coefficients as the model in your first question. (But some other aspects of the output will differ.)

    Next, you don't need the -xi:- prefix for any of this; that is a relic of older versions of Stata, now only needed for a handful of commands that don't support factor variable notation. See -help fvvarlist- to learn all about that.

    The model you propose in question 3 is ill-formed (unless CRISIS is constant within each cusip). You need to include the main effect of CRISIS along with the interaction. For the model you want to estimate in question 3, the code would look like this:

    Code:
    xtset cusip  // IF cusip AND year UNIQUELY IDENTIFY OBSERVATIONS USE xtset cusip year
    
    xtreg SALARY c.FIRMSIZE##i.CRISIS i.year, fe
    Note:
    1. If either FIRMSIZE or CRISIS is constant within each cusip, then the corresponding main effect will be collinear with the cusip fixed effect and will be dropped from the analysis by Stata

    2. I don't know where you're going with this and what you will want to do with the results. But in interpreting the output, remember that the coefficient of CRISIS will represent the effect of the post-2008 environment conditional on FIRMSIZE = 0. I'm guessing that FIRMSIZE is never actually 0, either in your data or in the world at large. So the coefficient of CRISIS is probably not useful for you. Assuming you would like some meaningful measure of the effect of CRISIS for some value of FIRMSIZE, you might want to create and use a new variable for firm size that is centered around some meaningful value. So maybe something like:

    Code:
    summ FIRMSIZE
    gen FIRMSIZE_M = FIRMSIZE - r(mean)
    
    xtreg SALARY c.FIRMSIZE_M##i.CRISIS i.year, fe
    That way the coefficient of FIRMSIZE_M will represent the effect of the post-2008 environment conditional on FIRMSIZE = the average firm size.

    Comment


    • #3
      Dear C. Schechter,
      Thank you very much for your reply.


      Originally posted by Clyde Schechter View Post
      Your code for question 1 looks OK. For question 2 (and also 3) you should not use -regress- because you have multiple observations per cusip, hence error terms are probably not independent. You need to use a fixed effects regression instead. See -help xtset- and -help xtreg-. And, yes, that should give you the same regression coefficients as the model in your first question. (But some other aspects of the output will differ.)

      Next, you don't need the -xi:- prefix for any of this; that is a relic of older versions of Stata, now only needed for a handful of commands that don't support factor variable notation. See -help fvvarlist- to learn all about that.

      The model you propose in question 3 is ill-formed (unless CRISIS is constant within each cusip). You need to include the main effect of CRISIS along with the interaction. For the model you want to estimate in question 3, the code would look like this:

      Code:
      xtset cusip // IF cusip AND year UNIQUELY IDENTIFY OBSERVATIONS USE xtset cusip year
      
      xtreg SALARY c.FIRMSIZE##i.CRISIS i.year, fe
      Note:
      1. If either FIRMSIZE or CRISIS is constant within each cusip, then the corresponding main effect will be collinear with the cusip fixed effect and will be dropped from the analysis by Stata

      2. I don't know where you're going with this and what you will want to do with the results. But in interpreting the output, remember that the coefficient of CRISIS will represent the effect of the post-2008 environment conditional on FIRMSIZE = 0. I'm guessing that FIRMSIZE is never actually 0, either in your data or in the world at large. So the coefficient of CRISIS is probably not useful for you. Assuming you would like some meaningful measure of the effect of CRISIS for some value of FIRMSIZE, you might want to create and use a new variable for firm size that is centered around some meaningful value. So maybe something like:

      Code:
      summ FIRMSIZE
      gen FIRMSIZE_M = FIRMSIZE - r(mean)
      
      xtreg SALARY c.FIRMSIZE_M##i.CRISIS i.year, fe
      That way the coefficient of FIRMSIZE_M will represent the effect of the post-2008 environment conditional on FIRMSIZE = the average firm size.

      Comment

      Working...
      X