Announcement

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

  • Recentered Influence Function (RIF) regression and decomposition

    Dear all,
    Thanks to Prof. Baum the newest update to the package -rif- is now available, with the version of the commands that are explained in an upcoming article in STJ.
    Also thank you to the people who have used these commands before and reported some bugs that have now been fixed.
    So these commands include:

    - rifvar(), a set of extensions to egen to estimate RIF's for a large set of distribution statistics. It can now be used in combination with other user-written commands that estimate RIF statistics.

    - rifhdreg This command estimates RIF-OLS regressions, also allowing for multiple fixed effects. Perhaps the most popular application would be the estimation of unconditional quantile regressions. This command also has options to obtain treatment effects using binary treatment or multivariate treatments, based on Inverse probability weighting (IPW). This is similar to what -teffects ipw- does, but now also for inequality indices. They are also known as inequality treatment effects.
    Something not many people may have noticed about this command. It can be used to estimate confidence intervals of any statistic for which a RIF exists. And even do it for multiple groups at the same time.

    - oaxaca_rif This command implements both simple and reweighted oaxaca decompositions using RIFs as the dependent variable. The major update here is that using the option -noisily- provides the output of all intermediate steps and saves them as separate items as part of the stored results in e().

    - rifsureg and rifsureg2. Something people usually ask in the forum is to have an equivalent to sqreg (simultaneous quantile regression estimator) but for unconditional quantiles. This is exactly what rifsureg does. You can estimate simultaneous unconditional quantile regressions. In fact, you can use most of the same options as rifhdreg. The caveat, it only estimates unconditional quantile regressions.

    rifsureg2 also allows you to do simultaneous regressions. In contrast with rifsureg, this command can estimate other statistics: Gini, quantiles, variance, absolute indices, etc.

    - uqreg. This is the last command I added to the package. As the name says it only estimates unconditional quantile regression. The difference with rifhdreg, however, is that it allows using methods other than OLS. (RIF-probit, RIF-logit, etc)

    If interested in the details, all the relevant references are available in the helpfiles.

    Best Regards.
    Fernando

  • #2
    Dear Dr. Fernando Rios,

    Many thanks for providing this package. I have a question with regards to its suitability to my research question and I was hoping you could provide some insightful information.

    I would like to conduct a quantile regression of the treatment effect for cancer diagnosis on an individuals income. I have a panel data set of ~10,000 individuals observed over 9 years, 2000 of which have been diagnosed with cancer and the rest being controls. I have used a difference in difference specification to obtain the coefficient of interest which is the interaction of the patient term and post term (patient is dummy for being a patient, post is dummy for post diagnosis). reg gross_income i.Patient##i.Post i.Year $xdemographic, vce(cluster Patient).

    As mentioned I would like to conduct a quantile regression and have found multiple ways to do this including your rifhdreg command;
    egen dd=group(Patient Year)
    rifhdreg gross_income i.Patient##i.Post i.Year $xdemographic, over(dd) rif(q(20)) cluster(person_ID)

    My first question is, which command would you recommend? is the above suitable? I am aware the qregpd and the xtqreg command also exist (although with the later I would have to apply a jacknife correction).

    Following this I would like to plot the coefficients of the treatment effect that the quantile regression produces. In one of your previous posts you refer to https://twitter.com/friosavila/statu...973385/photo/1 and recomend changing uqreg with xtqreg, and changing i=5(5)95 to i=0.05(.05).9. I have followed this advice however I recieve the error message "quantile() invalid-- invalid numlist". I was wondering what causes this or if you knew of any other way to plot the coefficients of the treatment effect at different quantiles?

    Looking forward to your response and many thanks in advance,
    Ties


    Comment


    • #3
      Hi
      i think the code is right, it’s something I have done and suggested before
      i also suggest checking this paper which implemented something like what you are doing
      https://www.sciencedirect.com/scienc...05750X2030125X

      regarding the plots

      Try using -qregplot- from Ssc
      it should plot all coefficient like grqreg does for qreg

      hope this is helpful
      fernando

      Comment


      • #4
        There is also this
        https://pubs.aeaweb.org/doi/pdfplus/...7/app.20170085

        Comment


        • #5
          Dear Dr. Fernando Rios,

          Many thanks for your response and for providing these papers - very interesting!

          With regards to the plots, I assume qregplot only works for qreg and not rifhdreg?

          I ask this because I would like to carry out the regressions with rifhdreg but of course would like to ensure that my plot coincides with the estimates from the regressions.

          Many thanks in advance,
          Ties

          Comment


          • #6
            Right now qregplot works after qreg, mmqreg, xtqreg,rifhdreg (for uqreg)
            check the examples and my webpage to see how the command works
            best

            Comment


            • #7
              Dear Dr. Fernando Rios,

              Many thanks for all your help.

              Kind regards,
              Ties

              Comment


              • #8
                Dear Dr. Fernando Rios,

                Apologies, I have one last question in regards to the rifhdreg function.

                I would like to split my population into 5 quintiles of income i.e. 0-20%, 21%-40%, 41%-60%, 61% - 80% and 81%-100% . My idea was then to investigate whether there is an asymmetric treatment effect dependent on the quintile an individual belongs to. As such I was using the following commands;

                gen dd=group(Patient Year)
                rifhdreg gross_income i.Patient##i.Post i.Year $xdemographic, rif(q(20)) over(dd) cluster(patient)
                rifhdreg gross_income i.Patient##i.Post i.Year $xdemographic, rif(q(40)) over(dd) cluster(patient)
                etc.

                My question is then the following; the second formulation with rif(q(40)) measures the treatment effect in the 40th quantile i.e. from individuals with earnings from 0-40% and not the desired 20%-40%. Is my interpretation correct here? Is my methodology of splitting the individuals into 5 different quintiles non-conventional i.e. would you recommend not doing this? If this does sound like a suitable approach, do you have a recommendation on how I can get the treatment effect per quintile?

                Again many thanks in advance and hoping to hear back,
                Ties

                Comment


                • #9
                  That is a miss understanding of uqreg
                  you cannot identify who exactly is affected you only know the distribution is affected, and the number rifhdreg gives you is how the counter factual distribution would change , measuring changes in quantiles, when a variable x changes for everyone (not only 1 person)
                  and this effect is measure assuming the change in x is very small.

                  Comment


                  • #10
                    Dear Pro. Fernando Rios,
                    I run "rifhdreg lnincome edu $yy $xx , over(urban) rif(mean) absorb(year prov_code) vce(robust) rwlogit($yy $xx ) ate ” with my data.
                    The problem is " too many variables specified option absorb() incorrectly specifiedr(198);" why is that?
                    Meanwhile, I run "rifhdreg lnincome edu $yy $xx , over(urban) rif(mean) absorb(year prov_code) vce(cluster city) rwlogit($yy $xx ) ate ” with my data. the problem is "too many variables specified
                    options absorb() and cluster() with different variables may not be combined r(184);"
                    Thanks!

                    Comment


                    • #11
                      Make sure you have reghdfe installed in your computer
                      other than that , can you try dropping the robust option?

                      Comment


                      • #12
                        Dear Prof. Fernando Rios,

                        I have run the following commands, attempting to run an unconditional quantile regression and then plot these coefficients

                        egen dd=group(Patient Year)
                        rifhdreg lngross_income i.Patient i.Post treated $xdemographic, over(dd) rif(q(20)) cluster(Patient)
                        qregplot treated, q(5(5)95)

                        after i run this last command, qregplot, I receive the error command "coding operators not allowed, If the above message is not useful, please contact me at [email protected]"

                        I was wondering if you could advise me on what I am doing wrong? I have followed the help file myself but I cannot find anything which I am doing wrong.

                        Hoping to hear from you.

                        Many thanks,
                        TIes

                        Comment


                        • #13
                          I cannot replicate the error.
                          If you can send an example where with minimum data so i can replicate the problem, i may be able to help

                          Comment


                          • #14
                            Dear Prof. Fernando Rios,

                            Unfortunately I am working with confidential data which is stored in a secure environment. Below is an example of what the data looks like. Please let me know if I can provide any other information.

                            input float(ID Female Patient Post lngross_income) int Year float(dd treated)
                            1 1 0 0 6.5 2011 1 0
                            1 1 0 0 6.6 2012 2 0
                            1 1 0 1 6.8 2013 3 0
                            1 1 0 1 6.7 2014 4 0
                            2 0 0 0 5.4 2011 1 0
                            2 0 0 0 5.6 2012 2 0
                            2 0 0 1 5.8 2013 3 0
                            2 0 0 1 5.3 2014 4 0
                            3 0 0 0 4.8 2011 1 0
                            3 0 0 0 4.9 2012 2 0
                            3 0 0 1 5.1 2013 3 0
                            3 0 0 1 5.3 2014 4 0
                            4 0 1 0 6.4 2011 5 0
                            4 0 1 0 6.5 2012 6 0
                            4 0 1 1 6.5 2013 7 1
                            4 0 1 1 6.8 2014 8 1
                            5 1 0 0 8.4 2011 1 0
                            5 1 0 0 8.2 2012 2 0
                            5 1 0 1 8.8 2013 3 0
                            5 1 0 1 9 2014 4 0
                            6 1 1 0 . 2011 5 0
                            6 1 1 0 . 2012 6 0
                            6 1 1 1 . 2013 7 1
                            6 1 1 1 . 2014 8 1
                            7 0 0 0 3.2 2011 1 0
                            7 0 0 0 3.3 2012 2 0
                            7 0 0 1 3.1 2013 3 0
                            7 0 0 1 3.2 2014 4 0
                            8 0 0 0 7.5 2011 1 0
                            8 0 0 0 7.5 2012 2 0
                            8 0 0 1 6.8 2013 3 0
                            8 0 0 1 6.8 2014 4 0
                            9 0 0 0 6.5 2011 1 0
                            9 0 0 0 6.4 2012 2 0
                            9 0 0 1 6.7 2013 3 0
                            9 0 0 1 6.9 2014 4 0
                            10 1 1 0 6.5 2011 5 0
                            10 1 1 0 6.8 2012 6 0
                            10 1 1 1 6.7 2013 7 1
                            10 1 1 1 6 2014 8 1
                            end


                            Many thanks,
                            Ties

                            Comment


                            • #15
                              I still cant replicate that with the data you provided.
                              In any case. What happens when you remove $xdemographic?
                              Perhaps if you add the full list of covariates rather than a global? It shouldn't affect qregplot, but perhaps there is a very specific combination you are using that its causing the problem.

                              Oh, and just in case, do you have the latest versions of the "RIF" commands?
                              Thank you
                              Fernando

                              Comment

                              Working...
                              X