Announcement

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

  • country specific time trend using reghdfe

    I run the regression model reghdfe log_depvar varminus4 varminus3 varminus2 varminus1 var_event varplus1 varplus2 varplus3 varplus4 firmid i.country#year, absorb(firmid year ) vce(cluster firmid). I added i.country#year to assign each country its own country specific time trend but it doesn't seem to be working.
    My intention is to make sure that the period varminus4-var_event has a flat trend, but this is not the case.
    Can someone help with model specification to include a country specific time trend.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float firmid double year float(varminus4 varminus3 varminus2 varminus1 var_event varplus1 varplus2 varplus3 varplus4 log_depvar countrynum industrycode country_year country_ind ind_year firmid_year)
    1 1993 0 1 0 0 0 0 0 0 1        0 2 5 10 8 146 1
    1 1994 0 0 1 0 0 0 0 0 0        0 2 5 11 8 147 2
    1 1995 0 0 0 1 0 0 0 0 0 .6931472 2 5 12 8 148 3
    1 1996 0 0 0 0 1 0 0 0 0        0 2 5 13 8 149 4
    1 1997 0 0 0 0 0 1 0 0 0        0 2 5 14 8 150 5
    end

  • #2
    In Stata's factor variable notation, when you write an interaction term, if no c. prefix is specified, an involved variable is assumed to be categorical. So when you write i.country#year, Stata thinks you want year to be treated as a discrete variable. That will give you country-specific year-by-year shocks, but not a time trend. For a country-specific time trend you need i.country#c.year.

    As an aside, it looks like what you are calling varminus4, varminus3, etc. are a series of lagged values of var_event, and varplus1, etc. are forward values. If that is correct, you do not need to have those variables. You can use time series operators and Stata will automatically include them in your regression:

    Code:
    reghdfe log_depvar L(-4/4).var_event firmid i.country#c.year, absorb(firmid year ) vce(cluster firmid)
    Last edited by Clyde Schechter; 26 Jul 2022, 10:38.

    Comment


    • #3
      EDITED: Crossed with #2 which gives a more accurate response. Response deleted.
      Last edited by Andrew Musau; 26 Jul 2022, 10:31.

      Comment


      • #4
        I have tried executing reghdfe as recommended above but the period [-4,0] is not showing a flat trend as desired.

        Comment

        Working...
        X