Announcement

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

  • Test equality of coefficients across quantiles by manually

    Hi, dear statalists,
    First I estimate the quantile regression model and I want to test the equality of coefficients across
    quantiles. One way we can implement it as following

    Code:
    sysuse auto,clear
    sqreg price weight length foreign, quantile(.25 .5 .75) reps(100)
    test [q25]weight - [q25]length=[q50]weight - [q50]length
    The wald test be used to test the equality of coefficients across quantiles using the above
    codes. However, how could I implement this test manually (step by step)?

    Best Regards,
    wanhaiyou

  • #2
    Wanhaijou may want to take a look at -test- entry in Stata 13.1 .pdf manual (pages 2357).
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Thanks very much for your help Carlo. I am reading the related document and then give you the feedback.

      Best regards,
      wanhaiyou

      Comment


      • #4


        Originally posted by Carlo Lazzaro View Post
        Wanhaijou may want to take a look at -test- entry in Stata 13.1 .pdf manual (pages 2357).
        Dear Carlo, thanks for your help.Following your suggestions, I have computed the statistical step by step and the result is similar with one using 'test' routine.
        Code:
        sysuse auto,clear
        sqreg price weight length foreign, quantile(.25 .5 .75) reps(100)
        matrix b = e(b)'
        matrix V = e(V)
        mat list b
        mat list V
        
        
        ***Method 1: Using 'test' command
        test [q25]weight - [q25]length=[q50]weight - [q50]length
        
        *** Method 2: step by step
        matrix R = (1,-1,0,0,-1,1,0,0,0,0,0,0)  
        matrix r = 0
        scalar q = rowsof(R)
        matrix W = (R*b-r)'*syminv(R*V*R')*(R*b-r)/q
        scalar Wald = W[1,1]
        scalar k = colsof(R)
        display "Wald test statistic: " Wald "  with p-value: " Ftail(q,_N-k,Wald)
        Thanks again for your help.

        Best regards,
        wanhaiyou

        Comment


        • #5
          wanhaiyou:
          thanks for closing ou this thread positively.
          Kind regards,
          Carlo
          (StataNow 18.5)

          Comment


          • #6
            dear @Carlo Lazzaro
            Sorry
            How to test the equality of coefficients in panel quantile the xtqreg or qregpd ?

            test [q25]weight - [q25]length=[q50]weight - [q50]length This command does not work and gives the following error
            equation [q25] not found

            How is the bootstrap test?

            Thank you for your guidance

            Comment


            • #7
              Usef:
              I do not know whether the community-contributed module -xtqreg- has an option similar to -iqreg-.
              Let's hope that Joao Santos Silva chimes in and provides guidance on this interesting topic.
              Kind regards,
              Carlo
              (StataNow 18.5)

              Comment


              • #8
                -xtqreg- identifies variation across quantiles based on the Scale component.
                for example
                Code:
                sysuse auto, clear
                xtqreg price mpg, i(foreign) ls
                . xtqreg price mpg, i(foreign) ls
                
                
                
                                              MM-QR regression results
                Number of obs = 74
                
                                                                           Location parameters
                                                (Std. err. adjusted for 2 clusters in foreign)
                ------------------------------------------------------------------------------
                             |               Robust
                       price | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
                -------------+----------------------------------------------------------------
                         mpg |  -294.1955   39.22634    -7.50   0.084    -792.6134    204.2223
                       _cons |   12430.83    835.415    14.88   0.043     1815.873    23045.78
                ------------------------------------------------------------------------------
                                                                              Scale parameters
                                                (Std. err. adjusted for 2 clusters in foreign)
                ------------------------------------------------------------------------------
                             |               Robust
                             | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
                -------------+----------------------------------------------------------------
                         mpg |  -86.66115   60.70132    -1.43   0.389    -857.9445    684.6222
                       _cons |   3733.451   1292.774     2.89   0.212     -12692.8     20159.7
                ------------------------------------------------------------------------------
                
                .5 Quantile regression
                ------------------------------------------------------------------------------
                             | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
                -------------+----------------------------------------------------------------
                         mpg |  -258.4703    49.2663    -5.25   0.000    -355.0304   -161.9101
                ------------------------------------------------------------------------------
                The Scale parameter shows MPG has no effect on the conditional heteroskedasticity, thus, quantile coefficients across MPG are all statistically the same

                Comment

                Working...
                X