Announcement

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

  • Testing for equality of coefficients across quantiles with qreg2

    Hi,

    Is there a way to test for equality of coefficients across quantiles using the qreg2 as we can do with the command test in sqreg?

    Thank you.

  • #2
    Maria:
    welcome to this forum.
    The community-contributed module (as you're kindly request to mention it, for reasons that are well explained in the FAQ) supports the postestimation command -test-:
    Code:
    . . sysuse auto
    (1978 automobile data)
    
    . qreg2 price weight length foreign
    
    Median regression
    R-squared = .53467262
    Number of obs = 74
    Objective function = 735.28776
    
                         Heteroskedasticity robust standard errors
    ------------------------------------------------------------------------------
           price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
          weight |   3.933588    4.41814     0.89   0.376    -4.878115    12.74529
          length |  -41.25191   117.0082    -0.35   0.725    -274.6174    192.1136
         foreign |   3377.771   1338.855     2.52   0.014     707.5096    6048.032
           _cons |   344.6489   9596.801     0.04   0.971    -18795.57    19484.87
    ------------------------------------------------------------------------------
    
    Machado-Santos Silva test for heteroskedasticity
             Ho: Constant variance
             Variables: Fitted values of price and its squares
    
             chi2(2)      =  28.806
             Prob > chi2  =   0.000
    
    . test weight=length
    
     ( 1)  weight - length = 0
    
           F(  1,    70) =    0.14
                Prob > F =    0.7107
    
    . qreg2 price weight length foreign,quantile(0.25)
    
    .25 Quantile regression
    R-squared = .49241394
    Number of obs = 74
    Objective function = 470.29428
    
                         Heteroskedasticity robust standard errors
    ------------------------------------------------------------------------------
           price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
          weight |   1.831789    1.07567     1.70   0.093    -.3135663    3.977144
          length |    2.84556   25.20125     0.11   0.910    -47.41674    53.10786
         foreign |   2209.925   693.7268     3.19   0.002     826.3309     3593.52
           _cons |  -1879.775   2341.838    -0.80   0.425    -6550.424    2790.875
    ------------------------------------------------------------------------------
    
    Machado-Santos Silva test for heteroskedasticity
             Ho: Constant variance
             Variables: Fitted values of price and its squares
    
             chi2(2)      =  27.928
             Prob > chi2  =   0.000
    
    . test weight=length
    
     ( 1)  weight - length = 0
    
           F(  1,    70) =    0.00
                Prob > F =    0.9692
    
    . 
    
    
    .
    Last edited by Carlo Lazzaro; 16 Jul 2022, 00:57.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thanks for the reply, Carlo. But I was actually looking to test [q25]weight = [q50]weight, i.e., to test the linearity assumption.

      Comment


      • #4
        Dear Maria Martins,

        I am afraid that is not possible because qreg2 does not compute the covariance between the estimates of different quantiles. Note, however, that testing that a variable has the same effect in different quantiles is not a test of linearity. A simple way to test if a variable has different impacts on different quantiles is to test whether there is hetroskedasticity in the model and it depends on that variable.

        Best wishes,

        Joao

        Comment

        Working...
        X