Announcement

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

  • Two variable fixed effect

    Dear all,
    I know how to use xi to do fixed effect,
    For example, suppose I want to do a firm fixed effect

    Code:
    xi i.firmid  
    global dummies _Ifirmid *
    Xtreg y x1 x2 $dummies, fe
    Or
    Xtreg y x1 x2 i.firmid, fe
    My question is how do I do a two variable combined fixed effect
    e.g. I want to do firm and merger deal fixed effect, given that one firm can show up in more than one mergers,
    if firm is identified as firmid, merger deal is coded with dealid , taking interger value 1~100

    how do I generate the new category based on both firmid and dealid ?

    just to clarify,

    Xtreg y x1 x2 i.firmid i.dealid, fe

    is not what I am asking, I want to pair firmid and dealid together using a new varaible.



    Thanks,

    Rochelle


    Last edited by Rochelle Zhang; 03 Sep 2017, 18:40.

  • #2
    Your question is not clear. Do you want to separately incorporate fixed effects for firmid and merger id? Or do you want fixed effects for the pairings of firmid and mergerid? If separate:

    Code:
    xtreg y x1 x2 i.firmid i.mergerid, fe
    If for pairings of firmid and merger id it's
    Code:
    xtreg y x1 x2 i.firmid#i.mergerid, fe
    Bu the way, if you are incorporating these additional fixed effects in your model, what variable did you use as the panel in your -xtset- command?

    By the way, get out of the habit of using -xi-. Although there are a few places in Stata where factor notation isn't supported, they don't come up very much, especially not in financial/economic analysis. When you use -xi-, you prevent yourself from taking advantage of the -margins- command later on.

    Comment


    • #3
      Thank you Clyde very much !

      1. I want to do the pairing of firmid and merger id

      2. I agree I should try factor notation.

      3. for xtset, if I use pairing in xtreg, do I need to do pairing in xtset ? In the past, I only do

      Code:
      xtset firmid
      Please advise !

      Comment


      • #4
        I suspect you have in mind a model like that presented here: http://www.uh.edu/~adkugler/Abowdetal.pdf
        If so, this may be of help for you: http://www.stata-journal.com/article...article=st0143

        Comment


        • #5
          Thank you Depato !

          Comment


          • #6
            You might also consider (ssc install) reghdfe.

            Comment


            • #7
              You can do this in xtreg or areg by manually creating an interaction between firm and merger and using this new variable as your panelid or absorb variable. I did this when creating university president-university fixed effects for university president university pairs.

              Comment


              • #8
                Thanks Phil.

                Thanks Philip. Post #7 You are suggesting something like

                [CODE]
                gen firm_merger=firmid*mergerid
                [/CODE

                ?

                I am not sure that is correct if variables are string.

                or

                Code:
                egen firm_merger=group (firmid, mergerid)

                Comment

                Working...
                X