Announcement

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

  • #76
    Hi, dear @FernandoRios

    my code is
    mmqreg y x ,q(0.25) absorb(v1) nols

    then send me error code like this
    last estimates not found
    r(301);

    I do not understand why should have last estimates
    Is there a problem with the source code?

    if not add abs(v1)
    just like
    mmqreg y x ,q(0.25) nols
    it can send me results

    but I really need add abs(v1) to get what I need
    hope you can help me

    Best wishes,
    Can Jin

    Comment


    • #77
      Try q(25) instead of q(.25)

      Comment


      • #78
        Originally posted by FernandoRios View Post
        Try q(25) instead of q(.25)
        thank you so much, Fernando
        but it can not work

        and I already solve this problem
        just use stata15 SE
        this code
        mmqreg y x ,q(0.25) absorb(v1) nols
        with abs(v1)
        it can work in stata 15 SE
        but can not work in stata 17 MP
        I use stata 17 MP before

        I do not know why
        but it works

        best wishes,
        Can




        Comment


        • #79
          Originally posted by FernandoRios View Post
          Try q(25) instead of q(.25)
          Dear FernandoRios

          According to what I've read in Prof. Santos Silva's research, the coefficient value of the scale cannot be negative, however, in reality, I'm still finding research papers with results where the location is a negative value, or a result right in the post also encounters this problem.

          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 ------------------------------------------------------------------------------ .
          Am I misunderstanding something regarding the explanation of Santos Silva and Machado?

          I'll wait for your response.

          Best wishes,

          Kha

          Comment


          • #80
            Dear Minh Kha,

            What cannot be negative is the fitted value of the scale function; there are no other restrictions on the coefficients.

            Best wishes,

            Joao

            Comment


            • #81
              Dear Joao Santos Silva,

              Thanks so much for your response, it really help with our team's workflow.

              Best wishes,

              Kha

              Comment


              • #82
                Dear, FernandoRios

                How are you?
                Please see if you can help me.
                I'm trying to use the MMQREG command in my study. I have a balanced panel where N = 86 and T = 8.
                From my reading in some statalist forums, I understood that for T that is not too short I can use the XTQREG code applying the jackknife correction.
                However, since XTQREG only includes one fixed effect at a time and I need to control fixed sector and year effects in the same model, MMQREG is ideal for my study.
                I am trying to implement the jackknife correction using the code that Professor Joao Santos Silva kindly made available on his page, but I have not been successful.

                The code that I have used in an adapted way for mmqreg is:
                xtset id_company
                egen c=count( id_company )
                g s=2*(( year /2)-int( year /2))

                ***MM-QR results with JK correction and clustered standard errors***
                mmqreg y x1 x2 x3 x4 x5, absorb(id_industry year) cluster (id_company) quantile(.50)
                mat V=e(V)
                matrix b=e(b_location)
                matrix g=e(b_scale)
                matrix Q50=e(q)
                scalar N=e(N)
                mmqreg y x1 x2 x3 x4 x5 if s==0, absorb(id_industry year) quantile(.50)
                scalar N0=e(N)
                matrix Q050=e(q)
                matrix g0=e(b_scale)
                mmqreg y x1 x2 x3 x4 x5 if s==1, absorb(id_industry year) quantile(.50)
                scalar N1=e(N)
                matrix Q150=e(q)
                matrix g1=e(b_scale)
                mat bjk=b+(2*g-g1*(N1/N)-g0*(N0/N))*(2*Q50-Q150*(N1/N)-Q050*(N0/N))
                ereturn post bjk V
                ereturn display"

                But I get the following error after "ereturn post bjk V": "Conformability error r(503);" "You have issued a matrix command attempting to combine two matrices that are not conformable, for example, multiplying a 3x2 matrix by a 3x3 matrix. You will also get this message if you attempt an operation that requires a square matrix and the matrix is not square."

                I've also tried the above code with the bootstrap option as it appears in the teacher's code, but I'm also unsuccessful. I also tried to include in xtset the variables id_company and year at the same time, but also without success.
                Would you be able to inform why this error appears?

                Would you have any specific code to apply jackknife correction in the MMQREG command that you could share?

                Thank you in advance if you can help me.

                Comment


                • #83
                  Dear Samuel Sousa,

                  I would say that T=8 is quite short; for the JK correction you will estimate with T=4...

                  Best wishes,

                  Joao

                  Comment


                  • #84
                    Dear Joao Santos Silva,

                    How are you?

                    Thank you for your feedback.

                    Could you please indicate any other correction that I can apply to my model so that I have consistent results? Or another way for me to be able to control for more than one fixed effect using quantile regression?

                    Thank you so much!

                    Best wishes,

                    Samuel

                    Comment


                    • #85
                      Sorry, Samuel Sousa, I am not familiar with the command mmqreg; the code you are using is for xtqreg and you would need to adapt it.

                      Comment


                      • #86
                        Hello professor Joao Santos Silva,
                        Thank you for your attention.
                        I have one last question.
                        I saw that I can use the correlated random effects model in conjunction with quantile regression to control for fixed effects.
                        FernandoRios, on his website, has an example of how to use correlated random effects using the CRE command. But I couldn't download it in Stata.
                        Would you know how to get this code in Stata?

                        Comment


                        • #87
                          Shoot me sn email

                          Comment


                          • #88
                            Dear Joao Santos Silva,

                            In an MM-QR model I'm estimating, the location coefficient for variable X is consistent with economic expectations and statistically significant.
                            The quantile values ​​obtained for variable X have the expected sign and are significant from the 1st to 7th quantile. They become insignificant at the 8th and 9th quantiles.
                            The scale coefficient for variable X is insignificant.
                            In this case, should we conclude that the explanatory power of variable X on dependent variable Y is homogeneous across the quantiles, and the quantiles do not differ from each other? Or should we conclude that variable X differs across the quantiles (1-7)?

                            Thank you very much.
                            Sincerely.
                            Last edited by merve kaya; 02 Mar 2026, 03:43.

                            Comment


                            • #89
                              Dear FernandoRios,

                              May I kindly ask for your thoughts on my question above?

                              Comment


                              • #90
                                Dear merve kaya,

                                If the coefficient of X in the scale is not zero, the effect of X on Y will vary by quantile.

                                Best wishes,

                                Joao

                                Comment

                                Working...
                                X