Announcement

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

  • Interaction terms using panel data

    Hi StataListers

    I am running a panel regression to uncover district-level trends. My code is

    Code:
    xtset district_id year
    xtreg y x controls i.year i.state
    Each state has multiple districts.

    My question is, if I want to include state-year interaction, does it still make sense to include i.state and i.year separately? I know that i.state##i.year will include i.state i.year i.state#i.year, whereas i.state#i.year will only include the interaction term. So I guess my precise question is should I use i.state##i.year or i.state#i.year? How does the interpretation change?

    Also, if I want to use district-fixed effects, can I still include the state-year interaction? With that, my understanding is that I should only use i.state#i.year because otherwise there will be perfect collinearity between district and state--am I right?


  • #2
    Parul:
    1) the recommended approach is -i.state##i.year- (you can easily see yoursefl how coefficients change; see also Interaction terms (# vs ##) in linear regression and factorial ANOVA - Statalist);
    2) when Stata detects perfect collinearity, it omits the culprit(s) with no additional action from your side.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      With enough variation of your key explanatory variables across district and time, perhaps the most convincing analysis is to have additive district and time fixed effects, and interactive FEs between state and year.

      Code:
      xtset district_id year
      xtreg y x1 ... xK i.year i.state#i.year, fe vce(cluster district_id)

      As Carlo says, if there are any perfect collinearities in the FEs, Stata will drop them. One does have to be a little careful, though, if some xj do not vary by district.

      Comment


      • #4
        Are you trying to "uncover" the different trends or "account" for them?

        Comment


        • #5
          Thanks Carlo and Jeff!

          George, I am trying to identify the district-level drivers contributing to a phenomenon. Perhaps, 'account' is a better term to use! Thank you!

          Comment

          Working...
          X