Announcement

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

  • When operate RIF-QR, does the command 'rifhdreg' contain a Gaussian kernel distribution?

    Generally, the Gaussian kernel distribution is recommended for RIF quantile regression.

    When I use the 'rifhdreg' command, don't I need to insert a separate option to use the Gaussian kernel distribution?
    Last edited by Kim Myounghwan; 22 Apr 2019, 05:30.

  • #2
    Hi Kim
    Just a few points
    1. There is no real recommendations regarding which kernel function is the most adequate. Based on the non-parametric literature, the choice of kernel is of second order importance. However, because gaussian distributions are easier to use (simply using normaldensity), that is the one that is most often used.
    2. The are more recommendations regarding the appropriate bandwidth. On that regard, the way i programmed rifhdreg uses the Silverman's Rule of Thumb plug-in bandwidth. This is slightly different from the bandwidth used within the "kdensity" program.
    3. The commands rifhdreg, oaxaca_rif and _grifvar all use gaussian kernels with Silverman's Rule of Thumb bandwidths. If you would like to play with different bandwidths or kernel functions, you could do something like this:
    Code:
    webuse nlswork, clear
    rifhdreg ln_wage age grade i.race msp , rif(q(25)) robust
    est sto m1
    rifhdreg ln_wage age grade i.race msp , rif(q(25) kernel(ep)) robust
    est sto m2
    rifhdreg ln_wage age grade i.race msp , rif(q(25) kernel(biweight)) robust
    est sto m3
    esttab m1 m2 m3, se nogaps scalar(rifmean)
    
    
    
    ------------------------------------------------------------
                          (1)             (2)             (3)   
                 RIF(ln_wage)    RIF(ln_wage)    RIF(ln_wage)   
    ------------------------------------------------------------
    age               0.00473***      0.00471***      0.00471***
                   (0.000449)      (0.000447)      (0.000447)   
    grade              0.0593***       0.0590***       0.0590***
                    (0.00117)       (0.00116)       (0.00116)   
    1.race                  0               0               0   
                          (.)             (.)             (.)   
    2.race             -0.109***       -0.109***       -0.109***
                    (0.00688)       (0.00685)       (0.00685)   
    3.race            -0.0117         -0.0117         -0.0117   
                     (0.0244)        (0.0243)        (0.0243)   
    msp              -0.00633        -0.00630        -0.00630   
                    (0.00593)       (0.00591)       (0.00591)   
    _cons               0.516***        0.520***        0.520***
                     (0.0186)        (0.0185)        (0.0185)   
    ------------------------------------------------------------
    N                   28492           28492           28492   
    rifmean             1.362           1.362           1.362   
    ------------------------------------------------------------
    Standard errors in parentheses
    * p<0.05, ** p<0.01, *** p<0.001
    Notice that the point estimates vary very little, except, perhaps with the constant. The standard errors are also quite close across different kernels functions.

    If you would like to use your own bandwidth (one taken from other strategy) you could use something like:
    Code:
    rifhdreg ln_wage age grade i.race msp , rif(q(25) bw(0.1)) robust
    rifhdreg ln_wage age grade i.race msp , rif(q(25) bw(0.15)) robust
    rifhdreg ln_wage age grade i.race msp , rif(q(25) bw(0.025)) robust
    In these examples, Im assuming Gaussian kernel, with three different Bandwidths.

    Hope this helps
    Fernando




    Comment


    • #3
      Dear Fernando.
      Thank you for your kind comments.

      Comment


      • #4
        hi, I found the results from rifhdreg and results from rifreg are different, and it is due to the difference in the recentered outcome variable
        webuse nlswork, clear
        rifhdreg ln_wage , rif(q(50)) retain(rif1)
        rifreg ln_wage , q(50) retain(rif2)
        sum rif*

        Variable Obs Mean Std. Dev. Min Max

        rif1 28,534 1.640541 .5686096 1.071941 2.209141
        rif2 28,534 1.640541 .5661384 1.074413 2.20667

        the difference is no much in this data ,but differs a lot in my data
        could you please explain the reason ?
        Thanks!
        Last edited by yang zx; 28 Jul 2019, 19:01.

        Comment


        • #5
          Hi Yang,
          The reason for that is because of how rifreg sets the bandwidth for the estimation of the density function.
          namely, rifreg uses the output from kdensity, whereas rifhdreg uses silverman plugin bw.
          if you would like to replicate rifreg results, you would need to obtain the bw from kdensity first. See the code below:
          Code:
          webuse nlswork, clear 
          rifreg ln_wage , q(50) retain(rif1)
          kdensity ln_wage, nograph
          * This replicates rifreg
          rifhdreg ln_wage , rif(q(50) bw(`r(bwidth)')) retain(rif2) 
          * this uses alternative bandwidth.
          rifhdreg ln_wage , rif(q(50)) retain(rif3) 
          sum rif1 rif2 rif3
          Now, results shouldnt vary much between rifreg and rifhdreg. However, if they do, I would re-examine your dependent variable.
          Perhaps there is a spike around the point of interest you are analyzing, or that you need a better method to obtain an estimate for the bandwidth.
          You could also use different bandwidths as robustness for your results.
          Best
          Fernando



          Comment


          • #6
            Hi, I have very different results with rifreg and rifhdreg:

            rifreg lshoraact, quantile(0.5)

            kdensity lshoraact, nograph
            rifhdreg lshoraact, rif(q(0.5) bw(`r(bwidth)'))

            Coefficients:
            With rifreg: 2.50
            With rifhdreg=0.586

            Why could they be so different?
            Thanks

            Comment


            • #7
              if you are interested in the median you need to use "q(50)" not q(0.50).
              It was a programming decision i made that quantiles will be defined between 0 - 100. rather than between 0-1.

              Comment


              • #8
                Thank you very much.
                i followed the same quantity of rifreg....
                ​​​

                Comment


                • #9
                  Right, but "rifreg" parses what goes in "q()" different from what I do. For RIFREG, q(0.5) is interpreted the same as q(50).

                  Comment


                  • #10
                    Originally posted by FernandoRios View Post
                    Hi Yang,
                    The reason for that is because of how rifreg sets the bandwidth for the estimation of the density function.
                    namely, rifreg uses the output from kdensity, whereas rifhdreg uses silverman plugin bw.
                    if you would like to replicate rifreg results, you would need to obtain the bw from kdensity first. See the code below:
                    Code:
                    webuse nlswork, clear
                    rifreg ln_wage , q(50) retain(rif1)
                    kdensity ln_wage, nograph
                    * This replicates rifreg
                    rifhdreg ln_wage , rif(q(50) bw(`r(bwidth)')) retain(rif2)
                    * this uses alternative bandwidth.
                    rifhdreg ln_wage , rif(q(50)) retain(rif3)
                    sum rif1 rif2 rif3
                    Now, results shouldnt vary much between rifreg and rifhdreg. However, if they do, I would re-examine your dependent variable.
                    Perhaps there is a spike around the point of interest you are analyzing, or that you need a better method to obtain an estimate for the bandwidth.
                    You could also use different bandwidths as robustness for your results.
                    Best
                    Fernando


                    Thank you so much for your help!

                    Comment

                    Working...
                    X