Announcement

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

  • user written commands uqreg & rifhdreg by Fernando Rios-Avila

    Dear Stata users,

    I want to estimate unconditional quantile regression using recentered influence function. There are two user-written commands by Rios-Avila (Rios-Avila, F. 2020. Recentered influence functions (RIFs) in Stata: RIF regression and RIF decomposition. Stata Journal, 20(1), 51-94. https://doi.org/10.1177/1536867X20909690.) Commands are based on Firpo, Fortin and Lemieux paper (Firpo, S., N. M. Fortin, and T. Lemieux. 2009. Unconditional quantile regressions. Econometrica 77: 953-973. https://doi.org/10.3982/ECTA6822.)

    I am not sure which command is most suitable for unconditional quantile regression. These two commands give different results for e.g. 10th percentile.
    bootstrap, reps(5): rifhdreg y $xlist, rif(q(10))
    bootstrap, reps(5): uqreg y $xlist, q(10) method(regress)

    uqreg can be used exclusively for the estimation of UQR, which are the most popular application of recentered influence function (RIF) regressions. rifhdreg -- rifhdreg Recentered influence function regression with high-dimensional fixed effects

    Since I am interested in percentiles/quantiles, I am not interested in other distributional statistics, e.g. Gini, etc., which command you suggest?

    I realized that uqreg command is extremely slow with bootstrap s.e. even with 5 replications. Of course, bootstrap takes time, but it runs much faster for rifhdreg and oaxaca_rif, than for uqreg.

    Previously I used rifreg command, but this command is not available any more, and I am struggling which one is appropriate in the updated version of rif applications.

    If anyone has experience with this issue, please help.

    Best regards
    Aleksandra

  • #2
    Hi Alexandra
    i would say use rifhdreg, as it is an upgrade on rifreg.
    uqreg should give you same estimates (can you show how different they are?).
    i only added it to the package because few people wanted to work with logit rather than linear probably models.
    hope it helps
    fernando

    Comment


    • #3
      Dear FernandoRios , thank you for your response. Please find attached the results in Excel. I am mostly interested in female variable, and difference is large at the 80th and 90th percentile. On other deciles the difference is mostly small.

      Best regards,
      Aleksandra
      Attached Files

      Comment


      • #4
        Hi Aleksandra
        Yes, there is a difference because of the choice of bandwidth.
        If you look into rifreg.ado, the authors decided to use the default bandwidth from "kdensity" to do unconditional quantiles.
        In contrast, as i describe in my paper (see here https://journals.sagepub.com/doi/pdf...36867X20909690) I use a different bandwidth, based on a different plugin method.
        Depending on the bandwidth, the denominator of the RIF will change, changing the results slightly. Neither is incorrect, as long as you describe how things are different (if you are reconciling rifreg with rifhdreg.)
        HTH
        F

        Comment


        • #5
          Thank you for your help and quick answer.

          Best regards,
          Aleksandra

          Comment


          • #6
            .
            Last edited by Peter Toth; 24 Aug 2023, 07:06.

            Comment


            • #7
              Dear FernandoRios,

              Let me ask a related question on -uqreg- vs. -rifhdreg-. I compared the two commands by coding:
              uqreg yvar $xvars, q(50) method(regress)
              rifhdreg yvar $xvars, rif(q(50))
              The point estimates were very similar, if not identical. But it took 8.5 hours to estimate the same model with -uqreg- and just a few seconds with -rifhdreg-. I had no bootstrap prefix anywhere. Do you know why this happens? If I stop the estimation forcefully shortly after runing -uqreg-, it shows the estimation output already, but not the "Sample Mean RIF q(50) :" result.

              And a second, less related question would be, if it can stay in this thread, what default method is used for calculating the treatment weights if I have an over(T) option after -rifhdreg-, where T is multi-categorical treatment, and I skip the options rwmlogit() or rwmprobit()?

              Thanks and best regards,
              Peter
              Last edited by Peter Toth; 24 Aug 2023, 07:05.

              Comment


              • #8
                Hi Peter
                So UQREG estimates unconditional quantile regressions allowing for other methods. Specifically, following FFL(2009) one could use logit models, or even non-parametric models.
                UQREG allows you to do that using a two step approach.
                Step1: Estimates a model with a dummy as dependent variable ( y>q(t) )
                Step2: estimates and rescales the marginal effects (margins) by the density at q(t).
                The first step is as fast as rifhdreg, but the second step will take longer because of how margins operate, as it is trying to estimate the numerical derivatives of the model.

                So, unless you have a strong preference for using a logit model, it would be better to stick with rifhdreg, even tho it basically estimates a LPM.

                For your second question. When you use "over(T)", internally, the RIF is estimated for separate groups based on T. No weights are used.

                A good way f thinking about it.

                the following two commands should give you roughly the same results


                Code:
                ssc install frause, clear
                frause oaxaca
                rifhdreg lnwage i.female, rif(q(10))
                qreg lnwage i.female, q(10)
                Best wishes
                Fernando

                Comment


                • #9
                  Thanks a lot, Fernando!
                  Regards,
                  Peter

                  Comment


                  • #10
                    Hello FernandoRios ! I'm using your new csdid2 package (it's much faster than the old one, thank you very much!!), but I don't understand how to save the results of my regression (like the number of observations and the R2). The old csdid package had a "saverif()" option that allowed me to do this and then use cs_estat. But csdid2 doesn't seem to have this option, so how do I view/save these statistics?

                    Comment


                    • #11
                      Hi Isabella
                      well, csdid2 works on mata directly. There is an option (save use) that allows you to save in disk, or read from disk all the elements behind csdid2 so you can reproduce them at a later point.
                      This include the full set of "RIFS".
                      However, the arquitecture of those mata elements is not as easy to display. (Perhaps something i need to build at some point)
                      that being said, calculating the number of observations is not an easy task, which is why i do not add it anymore. Using only Mata gets harder to do so.
                      Also, because CSDID works with many models (OLS and logit), there is nothing equivalent to an R2. In fact, even with jwdid (which could provide you such a thing) the r2 would be meaningless.
                      Hope this helps
                      F

                      Comment

                      Working...
                      X