Announcement

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

  • Demean variables in quantile regression

    Hello Everyone,

    In panel data (repeated observations for different individuals over time) fixed effects regressions are used, where the fixed effects are defined based on time and individual. An alternative way of achieving the same, is to demean all variables by individual and time and use simple OLS regression.

    My question is the following: I am trying to run a quantile regression with fixed effects. I have tried the xtqreg procedure, but unsuccessfully (for reasons I won't get into here).

    My question is: is it wrong to demean variables first based on individual, and then run a quantile regression on demeaned variables?

    Thank you all very much in advance!




  • #2
    Hi there
    i would be curious if you also tried mmqreg(alternative to xtqreg)
    otherwise you may be interested in my forthcoming presentation
    https://friosavila.github.io/app_met..._metrics9.html
    hth
    fernando

    Comment


    • #3
      Hello Fernando,

      Many thanks for the reply. I was not aware of mmqreg, I tried it and it works great! Much faster as well. Thank you so much!

      Your presentation is also super useful in explaining the basics of quantile regressions and fixed effects, so thanks for that as well.

      One question: In my model I have interaction variables which I include using var1##var2. However, mmqreg gives the following error message.

      _i___1__post_fdelinq_cyc_X_1__cha invalid name
      st_addvar(): 3300 argument out of range
      map_solve(): - function returned error
      <istmt>: - function returned error

      Any idea why this happens?
      If I construct a new variable as var3=var1*var2 and I include that in the model (in addition to var1 and var2), then it all runs fine.
      best,
      Costas



      Comment


      • #4
        Costas: I mention another possibility in Section 12.10.3 in my 2010 MIT Press book (which is also discussed in my NBER lecture notes with Guido Imbens): Use the Mundlak device of including the time averages of all the time-varying covariates as controls and use pooled quantile regression. Cluster the standard errors. It's very easy and can serve as a basis for comparison with more complicated methods.

        I also discuss demeaning in the context of median estimation. The Mundlak approach is more appealing to me for general quantiles.

        Comment


        • #5
          Hello Jeff,
          Many thanks for the information. I will have a look at the Mundlak method. Indeed having something relatively simple to serve as a basis against other methods would be very useful.
          best wishes,
          Costas

          Comment


          • #6
            Hi costas
            first
            the interaction might be between very long names. Try changing the names to something smaller.
            what happens is that the command is creating a set of demean variables in the background. Names get very long for the new variables(will change that) and that is giving you the error.


            you can also apply prof Wooldridge option using the cre program as I describe on my presentation (bonus)
            Fernando
            Last edited by FernandoRios; 19 Jul 2023, 11:55.

            Comment


            • #7
              Thank you FernandoRios . I will try shortening the variable names.
              Costas

              Comment

              Working...
              X