Announcement

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

  • Unconditional quantile regression with fixed effects

    Hello,

    Can you please help me with the following:

    I want to run an unconditional quantile regression with fixed effects (therefore I need use the command xtrifreg) and I want to control for time fixed .
    What is the command that I need to use with xtrifreg y x1 x2 x3..to control for time fixed effects?
    Thank you in advance.

    Best

  • #2
    Hi Ana
    Both "xtrifreg" and "rifhdreg" can estimate models with fixed effects. Now, Im not sure what do you mean with fixed effects.
    Usually, when talking about panel data and fixed effects, all "xt" commands estimate fixed effects (fixed or random) based on the panel id. Time fixed effects are left out but can be directly included using dummies or "i.year".
    If what you have is a large set of panels and time variables, i would suggest you to use rifhdreg, since like "reghdfe" it can handle as many fixed effects as you may want to include in the model.
    Best Regards
    Fernando

    Comment


    • #3
      Thank you very much FernandoRios
      Best regards

      Comment


      • #4
        Hello,

        I use the following command to run an unconditional quantile regression with country fixed effects:

        xtrifreg y x1 x2 fe i(country_ ) quantile (0.1) bootstrap reps(100)

        Can you please help me with the command that I should add to run "xtrifreg" with also time fixed effects (variable name:year_q)?
        Thank you in advance.

        Best regards

        Comment


        • #5
          Try the following
          bootstrap, reps(100): reghdfe y x1 x2, abs(country year) rif(q(10))

          Comment


          • #6
            There is no such option rif(q(10)) in -reghdfe-, is there?
            Ho-Chuan (River) Huang
            Stata 17.0, MP(4)

            Comment


            • #7
              Originally posted by FernandoRios View Post
              Try the following
              bootstrap, reps(100): reghdfe y x1 x2, abs(country year) rif(q(10))
              You are right, that was my fault. I meant the following
              Code:
              bootstrap, reps(100): rifhdreg y x1 x2, abs(country year) rif(q(10))
              This under the assumption one has "oaxaca_rif" and "reghdfe" installed.

              Comment


              • #8
                The command doesn´t work..it says option i() not allowed..and therefore I cannot run rifhdreg..Do I need to install any command? Thank you in advance.
                best

                Comment


                • #9
                  That is weird. Can you copy paste the error you are obtaining?
                  Here is what i use on my computer and gives me no problem.
                  Code:
                  ssc install oaxaca_rif
                  ssc install reghdreg
                  reghdreg, compile
                  webuse nlswork
                   bootstrap, seed(1):rifhdreg   ln_wage age ttl_exp tenure hours, abs( idcode year) rif(q(10))
                  
                  ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
                  ..................................................    50
                  
                  HDFE Linear regression                            Number of obs   =     27,480
                  Absorbing 2 HDFE groups                           Wald chi2(4)    =      66.26
                                                                    Prob > chi2     =     0.0000
                                                                    R-squared       =     0.3703
                                                                    Adj R-squared   =     0.2580
                                                                    Within R-sq.    =     0.0044
                                                                    Root MSE        =     0.5006
                  
                  ------------------------------------------------------------------------------
                               |   Observed   Bootstrap                         Normal-based
                  RIF(ln_wage) |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                  -------------+----------------------------------------------------------------
                           age |  -.0013523    .017206    -0.08   0.937    -.0350755     .032371
                       ttl_exp |   .0099123   .0031595     3.14   0.002     .0037198    .0161047
                        tenure |   .0025574   .0015978     1.60   0.109    -.0005743     .005689
                         hours |   .0030789   .0005976     5.15   0.000     .0019077    .0042501
                         _cons |   1.028518   .5057344     2.03   0.042     .0372973     2.01974
                  ------------------------------------------------------------------------------
                  
                  Absorbed degrees of freedom:
                  -----------------------------------------------------+
                   Absorbed FE | Categories  - Redundant  = Num. Coefs |
                  -------------+---------------------------------------|
                        idcode |      4142           0        4142     |
                          year |        15           1          14     |
                  -----------------------------------------------------+
                  Distributional Statistic: q(10)
                  Sample Mean    RIF q(10) :  1.1681

                  Comment


                  • #10
                    Just in the beginning i receive this:
                    . ssc install oaxaca_rif
                    host not found
                    http://fmwww.bc.edu/repec/bocode/o/ either
                    1) is not a valid URL, or
                    2) could not be contacted, or
                    3) is not a Stata download site (has no stata.toc file).
                    r(631);

                    Comment


                    • #11
                      That is odd.
                      Seems a problem unrelated to oaxaca_rif. But that your stata is not connecting to internet to make the update.
                      My suggestion is to restart Stata, and try again.

                      Comment


                      • #12
                        Dear Fernando Rios,

                        Thank you for the posting the amazingly helpful -rifhdreg- command. I have been struggling much with the interpretation of the coefficients, however, and was wondering if you could give some directions here.

                        From Firpo et al. (2009) and Killewald and Bearak (2010), I see several interpretations of UQR.
                        (1) the marginal effect of a small shift in the distribution of the covariates on the unconditional quantile.
                        (2) the association between a covariate and an outcome at a given point (quantile) in the outcome distribution.
                        (3) the difference in the probability of belonging to a quantile, rescaled by the probability density function at that quantile.

                        I think that (1) is the most helpful in substantive terms. Taking unions and wages as an example, "an increase in the proportion of union membership of one percentage point would change the value of the unconditional wage quantile by the value of the estimated coefficient".

                        However, I have also read interpretations such as "union membership is most beneficial for those in the middle of the wage distribution". This confuses me for several reasons. First, it seems to imply that UQR does not only tell us how the distribution would change on the whole, but also where in the distribution that change would originate. That would exclude situations in which median wage growth is driven by low wage individuals who become unionized, or situations in which the unionization of median wage earners moves them up the distribution. Second, if we can really conclude this, then what do the coefficients tell us? The average wage increase for workers at a given quantile if they became union members? That seems conditional rather than unconditional quantile regression, but maybe I am wrong ....

                        Any help would be much appreciated, thank you.

                        Comment


                        • #13
                          Hi Bram,
                          First of all, I would encourage you to download the latest version of the commands (ssc install rif), as I have added a few other features to the command since this post started.
                          Second, I personally believe that the first option you provide is the best description of what UQR and RIF regressions can identify.
                          "How a small shift in the distribution of the covariates will affect the unconditional distribution of the dependent variable" For the UQR, we measure the change in the distribution by looking at the unconditional quantiles.

                          The second interpretation is not quite correct. When you do RIF regressions, you are measuring the impact on the WHOLE distribution, but summarizing only the effect of a specific statistic. Also, you do not really measure associations of individual changes in a covariate, but changes in the distribution of the covariate and distribution of the outcome.

                          The third interpretation is technically correct with a caveat. If you look at the definition of the unconditional quantile RIF, UQRegressions measure the re-scaled probability of an individual having an outcome below a given quantile, not the probability of belonging to a given quantile.

                          Regarding your other question. I disagree with that interpretation. UQR cannot be used to identify where are the potential changes coming from. It only allows you to obtain a prediction of what would the distribution as a whole, after the change in the distribution of the covariates occurred.

                          what do the coefficients tell us?
                          For UQR, the coefficients (divided by 100) tell you how will the unconditional quantile of wages will change if unionization rate increases in 1 percentage point. It will not tell you how an individual's wage will change if he/she unionizes.

                          For continuous variables, it will tell you how will the unconditional quantile of wages will change if the distribution of that covariate changes so that the Mean increases in 1 unit.

                          HTH
                          Fernando









                          Comment


                          • #14
                            Hi Fernando,
                            This certainly helps. Thank you so much for this very complete explanation!

                            Comment


                            • #15
                              Dear Fernando,

                              I'm also struggling to understand the interpretation of the coefficients, especially when the coefficients are significant in the higher quantiles (q20) but not significant in the lower quantiles (q10). What can I infer from the difference in significance of the two quantiles other than interpreting that a small shift of continuous X affects the 20th quantile of Y?

                              Any help would be much appreciated, thank you.

                              Comment

                              Working...
                              X