Announcement

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

  • Multi-way fixed effects by demeaning variables in unbalanced panel

    Dear all,

    I am running a structural gravity estimation over ISIC 2-digit trade flows during 1998-2014. To control for multilateral resistances I include importer-sector-time, exporter-sector-time, and bilateral-sector effects (the latter is the panel id). Stata issues the error message r(908); although my matsize is 11000 and emptycells drop is on.

    Now instead I want to find a way to run multi-way fixed effects regression, by demeaning the variables in my unbalanced panel data set. Of course, the demeaning procedure could give the same point estimates as Stata built-in xtreg does if the panel dataset is strongly balanced (e.g. in a one-way fixed effect). Exact point estimates could be also obtained in two-way or other multi-way fixed effects by including the fixed effect dummies only when the panel is a balanced data. The problem I have is that my dataset is very large with 1.7 million observations and with more than 32000 fixed effects.

    I would like to ask if there is any procedure that I can produce equivalent point estimates with my unbalanced panel data via the demeaning procedure. Of course, if there is any other possibility that could help me run ppml or normal OLS with large number of fixed effects, I will be grateful to hear.

    Thanks in advance,
    Mahdi

  • #2
    Mahdi:
    see -help areg-.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Dear Carlo,
      Thanks. But I usually work with areg, the same problem. If there was a possibility that absorb option could include more than one set of categorial variables, I could run my estimations without any problem. So areg doesn't work with those many fixed effects. Still my question is if in my unbalanced data I can demean my variables with respect to fixed effects and then get consistent estimates.
      Mahdi
      Last edited by Mahdi Ghodsi; 04 May 2017, 03:32.

      Comment


      • #4
        Mahdi:
        I do not know about user-written -areg-like commands that can do the trick you're looking for.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Dear Carlo,
          Thanks again for the reply. I think -reghdfe- is the user-written command I am looking for.
          Best,
          Mahdi

          Comment


          • #6
            Mahdi.
            happy with reading that you fix your problem.
            Just an aside from the pedantic corner: as Sergio Correia's -reghdfe- is not an official Stata command, FAQ kindly remind you (and explain why) to tell the list where you got it from (you probably refer to -net describe reghdfe, from(http://fmwww.bc.edu/RePEc/bocode/r-). Thanks.
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #7
              Dear Carlo,
              Thanks for the explanation and reminder. Yes exactly. I was referring to -net describe reghdfe, from(http://fmwww.bc.edu/RePEc/bocode/r-).
              Best,
              Mahdi

              Comment

              Working...
              X