Announcement

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

  • Fixed effects - unconditional quantile regression

    Hello,

    Can you help me with the following:
    I am using the command "xtrifreg" with country fixed effects in the following way: xtrifreg Y X1 X2 X3, fe i(country_) q(25) clusterbootstrap reps (50).
    How can I add the time fixed effects (variable name:qdate)?
    Thank you in advance.
    Best regards

  • #2
    Dear Ana, the newly proposed command -rifhdreg- may help you. You can get this command using
    Code:
    ssc install rif, replace
    2B or not 2B, that's a question!

    Comment


    • #3
      Originally posted by Liu Qiang View Post
      Dear Ana, the newly proposed command -rifhdreg- may help you. You can get this command using
      Code:
      ssc install rif, replace
      Hello, do you know any way to plot the quantile coefficients after running rifhdreg?

      Comment


      • #4
        Hi Shrek
        There is no command to do that, but you can probably adapt the following code to make the figures you are looking for:
        Code:
        clear all
        use http://fmwww.bc.edu/RePEc/bocode/o/oaxaca.dta, clear
         
        
        capture matrix drop rbs rll rul
         forvalues i=10(5)95 {
         qui:rifhdreg lnwage educ exper tenure age , rif(q(`i')) robust
         matrix rtb=r(table)
         matrix rbs=nullmat(rbs)\[`i',rtb["b",.]]
         matrix rll=nullmat(rll)\[`i',rtb["ll",.]]
         matrix rul=nullmat(rul)\[`i',rtb["ul",.]]
        }
         
         svmat rbs
         svmat rll
         svmat rul
         local m: colfullnames rbs
         foreach i of local m {
         local ii=`ii'+1
         label var rbs`ii' "`i'"
         label var rll`ii' "`i'"
         label var rul`ii' "`i'"
         }
         
         label var rbs1 quantile
        
         two rarea rll3 rul3 rbs1 || scatter rbs3 rbs1 , connect(l)
         two rarea rll2 rul2 rbs1 || scatter rbs2 rbs1 , connect(l)
         two rarea rll5 rul5 rbs1 || scatter rbs5 rbs1 , connect(l)
        HTH
        Fernando

        Comment


        • #5
          Hi @
          FernandoRios

          Do you know any way to plot the quantile coefficients and xtreg (fe) after running rifhdreg and xtreg in one graph. I mean that the graph shows both results of xtreg (fixed effect) and rifhdreg.
          Thank you so much,

          Comment


          • #6
            Only the code I posted before
            i have written a code to do that automatically

            Comment


            • #7
              Hi FernandoRios,
              Thank you for your response.
              Best regards,
              Last edited by Henry Nguyen; 19 Apr 2020, 08:53.

              Comment


              • #8
                Originally posted by FernandoRios View Post
                Hi Shrek
                There is no command to do that, but you can probably adapt the following code to make the figures you are looking for:
                Code:
                clear all
                use http://fmwww.bc.edu/RePEc/bocode/o/oaxaca.dta, clear
                
                
                capture matrix drop rbs rll rul
                forvalues i=10(5)95 {
                qui:rifhdreg lnwage educ exper tenure age , rif(q(`i')) robust
                matrix rtb=r(table)
                matrix rbs=nullmat(rbs)\[`i',rtb["b",.]]
                matrix rll=nullmat(rll)\[`i',rtb["ll",.]]
                matrix rul=nullmat(rul)\[`i',rtb["ul",.]]
                }
                
                svmat rbs
                svmat rll
                svmat rul
                local m: colfullnames rbs
                foreach i of local m {
                local ii=`ii'+1
                label var rbs`ii' "`i'"
                label var rll`ii' "`i'"
                label var rul`ii' "`i'"
                }
                
                label var rbs1 quantile
                
                two rarea rll3 rul3 rbs1 || scatter rbs3 rbs1 , connect(l)
                two rarea rll2 rul2 rbs1 || scatter rbs2 rbs1 , connect(l)
                two rarea rll5 rul5 rbs1 || scatter rbs5 rbs1 , connect(l)
                HTH
                Fernando
                Thank you, Fernando. Sometimes, when I run regressions with rifhdreg, I encountered with r(2001): insufficient observations. Do you have any idea what could be the problems?

                Comment


                • #9
                  The most likely scenario is that you are using an incorrect index for the quantile.
                  For example, if you type
                  Code:
                  rifhdreg y x, rif(q(0.10))
                  It will not estimate the 10th quantile, but the 0.1th quantile.
                  The correct code would be:
                  Code:
                  rifhdreg y x, rif(q(10))
                  Also, if you are trying to make plots, perhaps you may want to look into -qregplot- (ssc install qregplot).
                  Fernando
                  Last edited by FernandoRios; 04 Jun 2021, 10:41.

                  Comment


                  • #10
                    Thanks for your suggestion for plotting. But I enter the index for quantile correctly. Could it be that I control too many fixed effects? As I reduce the number of variables absorbed, the error disappeared. But it works for reghdfe even when I control lots of fixed effects. So confusing.

                    Comment


                    • #11
                      Hi Shrek,

                      I had the same problem recently. The problem seems to occur when you include string variables in the abs() option of rifhdreg. When I encoded those string variables, I was able to run rifhdreg without error. You are right, however, that this is not the case under the current version of reghdfe.

                      Hope it helps!
                      Adrian

                      Comment

                      Working...
                      X