Announcement

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

  • #61
    Ok so that is a good point
    if you use predict you can get model predictions with mmqreg based on any equation you estimate:
    Code:
    ssc install frause
    frause oaxaca, clear
    mmqreg lnwage educ , q(50)
    predict xb50, xb  eq(#3)
    mmqreg lnwage educ , q(75)
    predict xb75, xb  eq(#3)
    However, if you use "abs" option, it will not consider that part of the estimation.

    xtqreg (the original command) does allow you to estimate the quantile with fixed effects.
    Check the latest update of that command, and the option "predict()"

    Comment


    • #62
      .
      Last edited by david yu id; 04 Jun 2023, 11:44. Reason: Duplicate posting

      Comment


      • #63
        Dear Dr. @FernandoRios:

        I have a question about testing equality of coefficients across quantiles. I noticed that sometimes the estimated coefficients in both quantiles are insignificant and their 95% confidence intervals largely overlap with each other, but the "test" command will yield results showing the two estimated coefficients are significantly different. Do you know what might have caused this issue?

        I run the below code for illustrative purposes (also including "sqreg" for comparison):

        Code:
         
        . use http://fmwww.bc.edu/RePEc/bocode/o/oaxaca.dta, clear
        (Excerpt from the Swiss Labor Market Survey 1998)
        
        . mmqreg lnwage female educ exper tenure , q(85 90)
        MM-qreg Estimator
        Number of obs = 1434
        Quantile:  .
        ------------------------------------------------------------------------------
              lnwage | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
        -------------+----------------------------------------------------------------
        location     |
              female |  -.0841137   .0255318    -3.29   0.001    -.1341552   -.0340722
                educ |   .0847507   .0049257    17.21   0.000     .0750964     .094405
               exper |   .0110983   .0014531     7.64   0.000     .0082504    .0139463
              tenure |   .0077084   .0018578     4.15   0.000     .0040672    .0113496
               _cons |   2.213327   .0682166    32.45   0.000     2.079625    2.347029
        -------------+----------------------------------------------------------------
        scale        |
              female |   .0579893   .0192994     3.00   0.003      .020163    .0958155
                educ |  -.0125849   .0037233    -3.38   0.001    -.0198826   -.0052873
               exper |  -.0054269   .0010984    -4.94   0.000    -.0075796   -.0032741
              tenure |   .0031301   .0014043     2.23   0.026     .0003778    .0058825
               _cons |   .4823967   .0515647     9.36   0.000     .3813318    .5834617
        -------------+----------------------------------------------------------------
        qtile_85     |
              female |  -.0176419   .0253919    -0.69   0.487    -.0674091    .0321253
                educ |   .0703249   .0048994    14.35   0.000     .0607222    .0799275
               exper |   .0048776   .0014463     3.37   0.001     .0020429    .0077124
              tenure |   .0112964   .0018473     6.12   0.000     .0076759     .014917
               _cons |   2.766287   .0683739    40.46   0.000     2.632277    2.900298
        -------------+----------------------------------------------------------------
        qtile_90     |
              female |  -.0014663   .0283704    -0.05   0.959    -.0570713    .0541388
                educ |   .0668144    .005486    12.18   0.000      .056062    .0775668
               exper |   .0033638   .0016384     2.05   0.040     .0001525    .0065751
              tenure |   .0121696   .0020559     5.92   0.000     .0081401     .016199
               _cons |   2.900848   .0805478    36.01   0.000     2.742977    3.058719
        ------------------------------------------------------------------------------
        
        . test [qtile_85]female  = [qtile_90]female
        
         ( 1)  [qtile_85]female - [qtile_90]female = 0
        
                   chi2(  1) =    7.29
                 Prob > chi2 =    0.0069
        
        . lincom [qtile_85]female  - [qtile_90]female
        
         ( 1)  [qtile_85]female - [qtile_90]female = 0
        
        ------------------------------------------------------------------------------
              lnwage | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
        -------------+----------------------------------------------------------------
                 (1) |  -.0161756   .0059899    -2.70   0.007    -.0279157   -.0044356
        ------------------------------------------------------------------------------
        
        . 
        . sqreg lnwage female educ exper tenure , q(85 90)
        (fitting base model)
        
        Bootstrap replications (20): .........10.........20 done
        
        Simultaneous quantile regression                    Number of obs =      1,434
          bootstrap(20) SEs                                 .85 Pseudo R2 =     0.1235
                                                            .90 Pseudo R2 =     0.1002
        
        ------------------------------------------------------------------------------
                     |              Bootstrap
              lnwage | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
        -------------+----------------------------------------------------------------
        q85          |
              female |   -.048664   .0302942    -1.61   0.108    -.1080899    .0107618
                educ |   .0689975   .0040432    17.07   0.000     .0610663    .0769287
               exper |   .0050717   .0014436     3.51   0.000     .0022398    .0079035
              tenure |   .0099555   .0021046     4.73   0.000     .0058271    .0140838
               _cons |   2.807041   .0780006    35.99   0.000     2.654033    2.960049
        -------------+----------------------------------------------------------------
        q90          |
              female |  -.0542809    .038456    -1.41   0.158    -.1297171    .0211553
                educ |   .0639304   .0072212     8.85   0.000     .0497652    .0780957
               exper |   .0040191    .002412     1.67   0.096    -.0007124    .0087505
              tenure |   .0077403   .0026316     2.94   0.003      .002578    .0129027
               _cons |   2.983513   .1189851    25.07   0.000     2.750109    3.216917
        ------------------------------------------------------------------------------
        
        . test [q85]female  = [q90]female
        
         ( 1)  [q85]female - [q90]female = 0
        
               F(  1,  1429) =    0.06
                    Prob > F =    0.8084
        
        . lincom [q85]female  - [q90]female
        
         ( 1)  [q85]female - [q90]female = 0
        
        ------------------------------------------------------------------------------
              lnwage | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
        -------------+----------------------------------------------------------------
                 (1) |   .0056169   .0231544     0.24   0.808    -.0398034    .0510371
        ------------------------------------------------------------------------------
        
        .
        Thank you in advance!

        Comment


        • #64
          One reason is that in mmqreg all qregressions are connected via the scale function
          if those coefficients are significant then the difference between two qreg s will be statistically different

          Comment


          • #65
            Dear Dr. FernandoRios:

            Thank you so much for the reply!

            Then in this case is there a way I can "reconcile" the mmqreg equality test results to those of sqreg?

            Thanks again!

            Comment


            • #66
              They are different models
              keep in mind sqreg estimates each quantile regression model independently
              mmqreg imposes functional form restrictions across all quantiles. More restrictive but efficient too

              Comment


              • #67
                Got it. Thanks!

                Comment


                • #68
                  Thank you, prof FernandoRios and prof Joao Santos Silva, for the insightful explanations.

                  1. Using survey data on 1400 respondents and the dependent variable, which is the log of their monthly income and assets, an index of 20 assets. Is it ethically right to use mmqreq to estimate the quantile regression, considering the fact that there is no time variable?

                  Code:
                  mmqreg asset lnincome saving educationinyears age marriage, quantile(0.1 0.25 0.5 0.75 0.9)
                  Code:
                  mmqreg lnincome asset  saving educationinyears age marriage , quantile(0.1 0.25 0.5 0.75 0.9)

                  2. The output revealed that two of the variables under the scale estimation are significant. Do I need to impose a robust standard error for heteroskedasticity?

                  Thank you so much

                  Comment


                  • #69
                    Dear Emmanuel Owusu Oppong,

                    This looks fine to me, but if you do not have fixed effects you can simple use qreg2, right?

                    Best wishes,

                    Joao

                    Comment


                    • #70
                      Thank you professor Joao Santos Silva . I do not have fixed effects so I will try qreq2 also. Once again, thank you.

                      Comment


                      • #71
                        [QUOTE=FernandoRios;n1667677]There is no command "yet"
                        but here a simple example:

                        [CODE]
                        use c:\data\oaxaca, clear
                        ssc install qregplot
                        ssc install qreg2

                        keep if lnwage!=.
                        foreach i in educ exper tenure female {
                        bysort isco:egen m_`i'=mean(`i')
                        }


                        Dear Fernando,
                        I try to estimate a model with quantile regression. My dataset consist of N:36, T:8. It is recommended to use correlated random effect with small T size.
                        I get an error when running the above code

                        . keep if lnreading!=.foreach i in lnhdi lngini lngsfr lnstudentteacherratio {bysort isco:egen m_`i'=mean(`i')}

                        ".foreach invalid name"

                        Where am i doing wrong?

                        Comment


                        • #72
                          Please type the commands in
                          not just copy paste

                          Comment


                          • #73
                            Dear FernandoRios,
                            I want to use correlated random effect with T:8, N:36 panel data.

                            When I adapt the code you wrote above to my own data set, I get an error:

                            Code:
                            keep if lnreading!=.foreach i in lnhdi lngsfr lngini {bysort isco:egen m_`i'=mean(`i')}

                            Where am I wrong with this code?

                            Comment


                            • #74
                              hard to say. I cannot see your data, so i cannot run and verify your code,
                              however, you could use my other command for CRE

                              1. Install cre: net install cre, from("https://raw.githubusercontent.com/friosavila/stpackages/main")
                              2. Use CRE for model estimation

                              Example Qreg with CRE

                              cre, abs(gfe): qreg y x1 x2 x3, q(10)
                              done

                              HTH

                              Comment


                              • #75
                                Thank you Dear FernandoRios

                                Comment

                                Working...
                                X