Announcement

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

  • Interactions and time effects in a fixed-effects model

    Hi everyone,

    I’m currently analyzing how job satisfaction has changed since the COVID-19 pandemic. My dataset includes four survey waves: 2019/2020, 2020/2021, 2021/2022, and 2022/2023.

    To examine within-person changes, I’m estimating a fixed-effects model, and I also want to compare group-specific differences, particularly between men and women. For that purpose, I’m using the following model with an interaction term between wave and sex:

    xtreg jobsatisfaction i.wave##i.sex, fe vce(cluster ID_t) My questions are:
    1. Does this specification qualify as a two-way fixed-effects model (i.e., including both individual and time fixed effects)?
    2. Should I include all four waves in the model, or would it be more appropriate to focus on a pre- and post-COVID comparison (e.g., 2019/20 vs. 2020/21)?

    Any advice on model specification and interpretation in this context would be greatly appreciated! Best Beate


  • #2
    Beate:
    1) yes, yours is a two-way fixed effect model (even though I would cluster the SEs on -panelid- only);
    2) I would include all the four waves (one of them will be considered as the reference wave and omitted) and add a categorical variable pre/post COVID-19 (the previous comment about the reference category still holds);
    3) your regression probably needs more predictors;
    4) causal inference (-xtdidregress-) can be an altervative, assuming that the same individuals are the hypothetical control of the real participants.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Hello Carlo,

      thank you very much for your helpful response — it really clarified a lot!

      I have two follow-up questions:

      Do you think it makes sense to include a separate categorical variable for pre-/post-COVID (e.g., post_covid = wave >= 13) if I'm already including i.wave in the model?

      Currently, my specification looks like this:

      gen post_covid = wave >= 13
      label define covidlbl 0 "Pre-COVID" 1 "Post-COVID"
      label values post_covid covidlbl

      xtreg jobsatisfaction ///
      i.wave##i.sex ///
      i.post_covid, ///
      fe vce(cluster ID_t)

      I’d also like to include several other predictors, such as job type, education level, and birth cohort.
      Would you recommend estimating them all in one model, possibly with interactions like i.job##i.wave, i.education##i.wave, etc.?

      Or would it be better to run separate models to avoid overfitting or interpretational issues?

      Thanks again for your guidance and time. It’s very much appreciated!

      Kind regards,
      Beate

      Comment


      • #4
        Beate:
        1) including a separate categorical variable for pre-/post-COVID will probably create some collinearity issue with -i.wave-. Perhaps you may want to revise your previous interaction as -i.wave##i.post_covid-, leaving -i.sex- as a standalone predictor;
        2) I'd recommend plugging all the predictors in the same regression, keeping the interactions at minimum, as they may not be that easy to explain, if several.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Hello Carlo,

          thanks a lot for your response!
          Just to make sure I understand it correctly:

          If I conceptualize COVID-19 as an external shock and want to examine its impact on job satisfaction, it would make sense to focus only on the two relevant waves (pre- and post-COVID), e.g.:
          keep if inlist(wave, 12, 15) gen post_covid = wave >= 13
          Then I define the panel structure:
          xtset ID_t wave
          and estimate:
          xtreg jobsatisfaction i.wave, fe
          If I also want to look at gender differences, I would run:
          xtreg jobsatisfaction i.wave##i.sex, fe vce(cluster ID_t)
          Is that correct?
          Or would it be sufficient for examining gender differences to simply compare pre- and post-COVID periods using a categorical variable (e.g. i.post_covid##i.sex) instead of all waves? Do you need more than two waves to run a two-way fixed effects (TWFE) model? In my case, I’m comparing only two time periods (2019/2020 vs. 2022/2023).



          If I only keep these two waves (pre and post COVID) and estimate xtreg jobsatisfaction i.wave, fe, do I in fact create a First-Difference model (since there are only two time points), or is that still something different in Stata?

          Thanks again for your help and clarification!

          Best

          Beate
          Last edited by Beate Schmidt; 10 Nov 2025, 08:17.

          Comment


          • #6
            Beate:
            I would go:
            -xtreg jobsatisfaction i.wave##i.sex, fe vce(cluster ID_t)-.
            To avoid perfect collinearity issue, I would not create a pre- and post-COVID caterìgorical variable.
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #7
              The only problem with i.wave##i.sex generally is that Stata is choosing the reference period for you. In this case there is only one pre-intervention period, and I assume that’s chosen by Stata as the reference period. If so, I would go with your original thought as confirmed by Carlo.

              Comment

              Working...
              X