Announcement

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

  • mmqreg when X!=Z

    mmqreg enforces X=Z. Machado and Santos Silva (2019) also do this for simplicity (footnote 4).

    The marginal effect of X, when X=Z, on the tau-quantile of Y (the "regression quantile coefficient") is (from equation 4, but written with parameters on page 150):

    beta_hat(tau,X) = beta_hat + q_hat*gamma_hat

    That made me wonder, if X!=Z, then what? Suppose Z=[X,W], where W is some additional variable. Then is it true that

    beta_hat(tau,W) = q_hat*gamma_hat_W?

    This is obviously not the "regression quantile coefficient", rather it allows W to only affect scale and not location. Am I thinking about this correctly? In fact, I'm not even sure how to interpret beta_hat(tau,X), when X!=Z. The X's are still affecting location and scale, but they are conditional on W affecting only scale.

    The below code reproduces mmqreg when X=Z (by hand, but no s.e.). The second chunk adds a variable to Z, in this case age.

    FernandoRios
    Joao Santos Silva

    Code:
     use http://fmwww.bc.edu/RePEc/bocode/o/oaxaca.dta, clear
     
    * standard qreg
     qreg lnwage female educ exper tenure i.isco, q(25)
     
     * mmqreg no cluster
     mmqreg lnwage female educ exper tenure i.isco, q(25)
     
     * mmqreg cluster
      mmqreg lnwage female educ exper tenure , q(25) abs(isco) cluster(isco)
      
      * adjusts for clusters automatically, but differs from mmqreg
      xtqreg lnwage female educ exper tenure , q(.25) i(isco) ls
      
      *1. Location: get beta 
      xtreg lnwage female educ exper tenure, fe i(isco)
      mat beta=e(b)' 
      
      *2. predict alpha and R
      predict double alpha, u    
      predict double R, e    
      
      *3. Scale: reg abs(R) on Z to get gamma
      gen double absR=abs(R)
      xtreg absR female educ exper tenure, fe i(isco)
      mat gamma=e(b)' 
      
      *4. predict delta and Z'gamma
      predict double delta, u
      predict double zgam, xb
      predict double delta_zgam, xbu
      
      *5. Quantile regression, using standardized residuals
      gen double U = R/delta_zgam
       qreg U, q(25)
       sca q=_b[_cons]
      
      *6. Eq (4) (mentioned on page 150) beta for quantile: b_l + q*gamma
      mat b_q=beta+q*gamma
      mat list beta
      mat list gamma
      mat list b_q
      
      
      ********************************************
      * Now try with an additional variable in Z: age
      ********************************************
      *Steps 1 & 2 are same as above (omit) 
      
      *3. Scale: reg abs(R) on Z to get gamma
      xtreg absR female educ exper tenure age, fe i(isco)
      mat gamma2=e(b)' 
      
      *4. predict delta and Z'gamma
      predict double delta2, u
      predict double zgam2, xb
      predict double delta_zgam2, xbu
      
      *5. Quantile regression, using standardized residuals
      gen double U2 = R/delta_zgam2
       qreg U2, q(25)
       sca q2=_b[_cons]
      
      *6. Eq (4) (mentioned on page 150) beta for quantile: b_l + q*gamma
      mat b_q_x=beta+q2*(gamma2[1..4,1]\gamma2[6,1])
      mat b_q_z=q2*gamma2[5,1]
      mat list beta
      mat list gamma2
      mat list b_q_x
      mat list b_q_z

    Ref: Machado, J.A.F. and Santos Silva, J.M.C. (2019), Quantiles via Moments, Journal of Econometrics, 213(1), pp. 145-173.

  • #2
    Hi Travis
    So, my understanding of the approach proposed by Machado and Santos Silva (2019), which I implemented in mmqreg, could potentially allow you to have different variables (or even functional forms ) on the location and scale models.
    As MSS indicates in their paper, one way of looking at it is to consider nonlinear transformations for the modeling of the conditional variance. But, for simplicity, a linear model is the way xtqreg and mmqreg proceed.

    NOw, if you think about the underlying model, you have the following:
    Q(y|t) = B0(t) +B1(t)x

    which under the assumptions of MSS(2019) is decomposed as:
    Q(y|t) = b0+b0(t)+b1*x+b1(t)x

    You can certainly constraint either the location coefficients (b0,b1) or the scale coefficients (b0(t) b1(t)) to be equal to zero, and will still have a varying quantile set of parameters. However, I think that may introduce other problem when doing the aggregations and standard error estimations.

    HTH

    PS. Make sure you have the latest update of mmqreg. I did a couple of modification that had to do with cluster and robust standard errors on the program.

    Comment


    • #3
      Thanks, FernandoRios. I think that confirms that it's ok to do what I have done.

      I just installed mmqreg this week, so it should be up-to-date.

      Concerning s.e., I plan on using the jackknife, as suggested in the paper. Do you know if the leave-one-out is at the observation level, or unit level? Seems like at the unit-level would effectively cluster at the unit level, which is what we want. On that note, you may consider an option to turn off the s.e. calculation to speed up computation for someone implementing the jackknife. I see you perform the linear combination of the betas within the covariance functions, so that'd have to be moved out of the mmqreg1, mmqreg2 functions...just a suggestion. Either way, I'm just going to use jackknife on the code I have above.

      Thanks for putting this code together.

      Comment


      • #4
        that is a very good suggestion. Thank you. I ll add that for a future update.
        Oh, and the Jacknife that is implemented in the paper (bias correction Jacknife) is done within unit, but using half of the sample.
        Perhaps this paper may help for that:
        https://journals.sagepub.com/doi/ful...36867X19854016
        Last edited by FernandoRios; 29 Jul 2021, 11:19.

        Comment


        • #5
          Dear Travis A. Smith and FernandoRios,

          Sorry for the late reply. I do not have much to add but want to clarify some points, especially for the benefit of less experienced users that may read this thread.

          We are estimating the conditional quantiles of y given X, so Z must be a function of X. Of course, as illustrated above, the scale function may contain variables that are excluded from the location function and are not functions of them (as in the example above) but that means that we are conditioning on those variables but imposing the restriction that their coefficient in the location is zero (we can also exclude variables from the scale function). Our xtqreg command does not allow the imposition of these restrictions, so we always have the same variables in the location and scale. So, going back to #1, what Travis estimated is indeed a "regression quantile coefficient" but it assumes that the variable has no effect on the mean.

          As Fernando noted, the Jackknife we suggest in the paper (see also here) it to correct the bias when N is large relatively to T. In that case, we suggest splitting the sample in two halves by considering separately even and odd years (rather than the first and second half of the sample). In the paper we did not consider clustered standard errors, so we did not implement that in xtqreg. To obtain valid standard errors when there is clustering, I suggest using the bootstrap resampling units; this is also illustrated in the file linked above.

          Best wishes,

          Joao

          Comment


          • #6
            Thank you Joao Santos Silva
            And for clarification. My implementation of cluster standard errors is really a horizontal extension of what your paper does. It just assumes that once you have all the IFs (scores) for all equations, they can be aggregated using the same rules we do for standard regression model.
            Best wishes
            Fernando

            Comment


            • #7
              DearJoao Santos Silva
              what is the difference between panel quantile and quantile panel data?

              Comment


              • #8
                Dear setareh amd.

                I am not sure if I understand your question. I guess both expressions refer to the estimation of quantile regressions using panel data.

                Best wishes,

                Joao

                Comment


                • #9
                  Dear Joao Santos Silva
                  I really appreciate your answer. I want to know the differences between xtqreg and qregpd, because I want to choose one of them for my estimation.

                  Comment


                  • #10
                    Dear setareh amd,

                    These commands estimate two very different models. xtqreg estimates a fixed effects quantile regression and is the quantile regression analogue of the usual fixed effects model. qregpd estimates a very different model that conditions on fixed effects but the estimated model does not actually include fixed effects.

                    Best wishes,

                    Joao

                    Comment


                    • #11
                      Dear Joao Santos Silva
                      I am thankful to your clear explanation. I want to estimate a quantile panel data that includes 122 sections and 11 years, with which I had estimated GLS formerly, which one do you recommend xtqreg or qregpd?

                      Comment


                      • #12
                        Dear setareh amd,

                        xtqreg implements an estimator that is more comparable to what you would get with xtreg, fe.

                        Best wishes,

                        Joao

                        Comment


                        • #13
                          Dear Joao Santos Silva

                          thank you, at last how can I specify time( i mean 11 years) in the xtqreg syntax?

                          Comment


                          • #14
                            Dear setareh amd,

                            You do not need to define that, but you can use the xtset command before xtqreg to define the time period.

                            Best wishes,

                            Joao

                            Comment


                            • #15
                              Dear Joao Santos Silva,
                              I really appreciate you,
                              best regards.

                              Comment

                              Working...
                              X