Announcement

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

  • Interaction in -reghdfe-

    I have the regression

    reghdfe log(demand) log(price) region#c.log(price), absorb("fixed effect...") vce(robust)

    In order to have the price elasticity change among regions, I added this interaction term. But reghdfe can't not give correct results.

    ...
    note: 1b.region#c.lprice omitted because of collinearity
    ...
    ...
    ------------------------------------------------------------------------------
    | Robust
    lsales | Coef. Std. Err. t P>|t| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    lprice | -3.045329 .2969301 -10.26 0.000 -3.627397 -2.46326
    vfc | -.6569514 .717027 -0.92 0.360 -2.062531 .7486286
    |
    region#c.lvrt |
    0 | 0 (empty)
    1 | -1.36208 .3830626 -3.56 0.000 -2.112993 -.6111664
    ...
    ...

    Why it still have region 0 as empty. Is it the base group?? even I use i.region#c.log(price)

  • #2
    Maybe try including the main effect of region in the model specification as well?

    Comment


    • #3
      Can you try and post the output with the latest version from github? There were a few bugfixes related to interactions in the latest update.

      Comment


      • #4
        As a partial answer:

        Let's run something similar to your code with the sample dataset:

        Code:
        sysuse auto
        reghdfe price weight i.foreign#c.weight, absorb(turn)
        areg price weight i.foreign#c.weight, absorb(turn)
        (Including -areg- as benchmark)

        You should notice two things:
        1. reghdfe expands "i." as "ibn." i.e. they include base factors. I think there was a good reason for that odd behavior but I don't recall exactly (probably related to this issue with the -syntax- command). In any case, it can be solved if you omit the main effect ("price") or set "show emptycells" to off.
        2. Due to a bug/limitation of Stata, what you see as "(empty)" is in fact "(omitted)". There was a long attempt at a workaround here, including contacting Statacorp support, but it proved impossible.
        So to recap: these bugs/limitations are a bit annoying but there are workarounds such as omitting the base effect (or maybe even running -fvrevar- yourself). I would fix them if I knew how

        Best,
        Sergio

        Comment


        • #5
          Thanks very much for your detail answer. so actually -reghdfe- uses "0" as base group? Just it does not show up properly in the final results?

          The reasons I can't use -areg-
          1. I have two types of fixed effects that needed to be absorbed.
          2. -areg- does not do IV regression



          Originally posted by Sergio Correia View Post
          As a partial answer:

          Let's run something similar to your code with the sample dataset:

          Code:
          sysuse auto
          reghdfe price weight i.foreign#c.weight, absorb(turn)
          areg price weight i.foreign#c.weight, absorb(turn)
          (Including -areg- as benchmark)

          You should notice two things:
          1. reghdfe expands "i." as "ibn." i.e. they include base factors. I think there was a good reason for that odd behavior but I don't recall exactly (probably related to this issue with the -syntax- command). In any case, it can be solved if you omit the main effect ("price") or set "show emptycells" to off.
          2. Due to a bug/limitation of Stata, what you see as "(empty)" is in fact "(omitted)". There was a long attempt at a workaround here, including contacting Statacorp support, but it proved impossible.
          So to recap: these bugs/limitations are a bit annoying but there are workarounds such as omitting the base effect (or maybe even running -fvrevar- yourself). I would fix them if I knew how

          Best,
          Sergio

          Comment


          • #6
            Sorry, was not suggesting you to use -areg-, but to keep using -reghdfe- with only the interactions but without the main effect. Alternatively, generate each interaction component by hand (not the prettiest choice but should work)

            Comment

            Working...
            X