Announcement

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

  • #46
    Dear Joao Santos Silva or any other person who can help me with this problem. How do I include these extra statistics in xtqreg:
    - I want to add a measure of fit (such as the Pseudo R2 recommended by Koenker)
    - The correlation between the error terms and the independent variables (if possible) since I am likely dealing with endogeneity (I am looking at the effect of news on returns), and whether this correlation is significant at 5%, 1% or 0.1%. I would like to show whether endogeneity is present in different parts of my sample, therefore I would like to include a measure (incl significance) that shows whether it is endogenous. I want to include a measure of endogeneity, as I believe this measure to be higher for higher amounts of news or risk based on news.
    - Clustering or dummies on a country level (I read something about bootstrapping them but I have not worked with Stata before so not sure how I would have to do that).

    Please note I am not a mathematician so I am looking for some code that is relatively simple to implement.

    My code right now looks like this

    eststo MYREG1: xtqreg Ret Word2 Art stdevnewsrisk sumweekscoring
    esttab . using nome.tex, b(3) replace not unstack compress obs label pr2

    But the pr2 is not showing any result and country clustering is not included (yet). And the endogeneity measure still needs to be included.

    Thanks in advance for your help.

    Comment


    • #47
      By the way, one more remark: I believe bootstrapping is not possible for my sample (I am using company specific returns and company-specific news). Therefore companies are my panel variable. Is it correct that with this kind of data set I cannot cluster based on country within xtqreg?

      Comment


      • #48
        Dear Joao Santos Silva

        I'm sorry,but it appears I did not get you.

        Is it the case that when doing a panel quantile iv regression we do not have to control for individual fixed-effects and time-fixed effects as is done in the usual panel regression? And regarding #43, how do you mean when you said
        If you do not have many FE
        ?

        Thank you for the support.

        Comment


        • #49
          Dear Lom Newton

          Whether or not you need to control for the fixed effects will depend on the problem and on the purpose of the model, but you may well need to control for them. The problem is that I am not aware of any quantile regression estimator that can cope with FE and endogenous variables, at least when you have few observations to estimate each FE. If you only have a few FE and a large sample, then you can treat the FE as any other regressor and use ivqreg2.

          Best wishes,

          Joao

          Comment


          • #50
            Dear Joao Santos Silva

            I tried use the ivqreg2 for my panel data without including the fixed effect but I got the following output with errors
            Code:
            WARNING: some fitted values of the scale function are negative
            Warning:  variance matrix is nonsymmetric or highly singular.
            and thus no values for the standard errors.

            In the code below:
            y = continuous dependent variable
            activetreat = dummy variable that takes the values 1 or 0
            s = continuous variable (endogenous)
            ActDeep = interaction between activetreat and s.
            c_tot = a continuous variable (endogenous)
            s_treat = interaction between treat and c_tot, where treat is another dummy variable that takes the values 1 or 0
            s_activetreat = interaction between activetreat and c_tot

            And I am using one period lag of the endogenous variables as IVs for the endogenous variables.


            Please may I know what I'm doing wrong and can you help me with suggestions how to rectify this situation?

            Thank you once again.

            Code:
            . ivqreg2 y activetreat s ActDeep c_tot s_treat s_activetreat if balance1==5, inst(activetreat L_s LActDeep Lc_tot Ls_treat LS_ac
            > tivetreat) q(0.15 .25 .5 .75 .85)
            
            
            
                                          MM-QR regression results
            
            Number of obs = 8620
            WARNING: some fitted values of the scale function are negative
            Warning:  variance matrix is nonsymmetric or highly singular
            .15 Structural quantile function
            -------------------------------------------------------------------------------
                          |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
            --------------+----------------------------------------------------------------
              activetreat |   3.445655          .        .       .            .           .
                        s |   1.443729          .        .       .            .           .
                  ActDeep |   .0821552          .        .       .            .           .
                    c_tot |   .0001003          .        .       .            .           .
                  s_treat |   .0000503          .        .       .            .           .
            s_activetreat |   .0000208          .        .       .            .           .
                    _cons |   30.72317          .        .       .            .           .
            -------------------------------------------------------------------------------
            
            Warning:  variance matrix is nonsymmetric or highly singular
            .25 Structural quantile function
            -------------------------------------------------------------------------------
                          |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
            --------------+----------------------------------------------------------------
              activetreat |   .1033156          .        .       .            .           .
                        s |   1.327807          .        .       .            .           .
                  ActDeep |  -.0226668          .        .       .            .           .
                    c_tot |    .000093          .        .       .            .           .
                  s_treat |   .0000364          .        .       .            .           .
            s_activetreat |   7.69e-06          .        .       .            .           .
                    _cons |   85.65261          .        .       .            .           .
            -------------------------------------------------------------------------------
            
            Warning:  variance matrix is nonsymmetric or highly singular
            .5 Structural quantile function
            -------------------------------------------------------------------------------
                          |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
            --------------+----------------------------------------------------------------
              activetreat |  -6.027171          .        .       .            .           .
                        s |   1.115183          .        .       .            .           .
                  ActDeep |  -.2149301          .        .       .            .           .
                    c_tot |   .0000794          .        .       .            .           .
                  s_treat |    .000011          .        .       .            .           .
            s_activetreat |  -.0000164          .        .       .            .           .
                    _cons |   186.4036          .        .       .            .           .
            -------------------------------------------------------------------------------
            
            Warning:  variance matrix is nonsymmetric or highly singular
            .75 Structural quantile function
            -------------------------------------------------------------------------------
                          |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
            --------------+----------------------------------------------------------------
              activetreat |  -13.22418          .        .       .            .           .
                        s |   .8655692          .        .       .            .           .
                  ActDeep |  -.4406416          .        .       .            .           .
                    c_tot |   .0000635          .        .       .            .           .
                  s_treat |  -.0000189          .        .       .            .           .
            s_activetreat |  -.0000447          .        .       .            .           .
                    _cons |   304.6824          .        .       .            .           .
            -------------------------------------------------------------------------------
            
            Warning:  variance matrix is nonsymmetric or highly singular
            .85 Structural quantile function
            -------------------------------------------------------------------------------
                          |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
            --------------+----------------------------------------------------------------
              activetreat |  -19.80319          .        .       .            .           .
                        s |   .6373893          .        .       .            .           .
                  ActDeep |  -.6469715          .        .       .            .           .
                    c_tot |    .000049          .        .       .            .           .
                  s_treat |  -.0000463          .        .       .            .           .
            s_activetreat |  -.0000706          .        .       .            .           .
                    _cons |   412.8047          .        .       .            .           .
            -------------------------------------------------------------------------------
            
            Instruments used: activetreat L_s LActDeep Lc_tot Ls_treat LS_activetreat
            
            . 
            end of do-file

            Comment


            • #51
              Dear Lom Newton,

              That is probably caused my misspecification of the model or by unsuitable instruments (or both).

              Best wishes,

              Joao

              Comment


              • #52
                Thank you, Joao Santos Silva . I will try and re-specify the model to see what happens.

                Comment


                • #53
                  hi @ Professor Joao Santos Silva ,
                  how to export xtqreg output from stata? please provide me stata command for it. Thanks

                  Comment


                  • #54
                    Dear rabiya gill,

                    Sorry, I do not understand your question.

                    Best wishes,

                    Joao

                    Comment


                    • #55
                      Hi João,

                      I need to test the coefficients of two quartiles regression using xtqreg, and I'm having a bit of trouble. I noticed that you mention that that features is not available in you program but bootstrap could be used for the same purpose. Do you have the code to do that?

                      best wishes,

                      Li

                      Comment


                      • #56
                        Hi Li Jiang,
                        A simple program to Bootstrap the results can be written as follows:
                        Code:
                        program bsxtqreg ,eclass
                         xtqreg y x, i(fe) q(.25)
                         matrix b1=e(b)
                         xtqreg y x, i(fe) q(.5)
                         matrix b2=e(b)
                         matrix coleq b1=q25
                         matrix coleq b2=q50
                         matrix b=b1,b2
                         ereturn post b
                        end 
                        bootstrap: bsxtqreg
                        This may need some adjustment to allow to cluster by the panel id, but you can get examples of that in the helpfile of Bootstrap
                        HTH
                        Fernando

                        Comment


                        • #57
                          Originally posted by FernandoRios View Post
                          Hi Li Jiang,
                          A simple program to Bootstrap the results can be written as follows:
                          Code:
                          program bsxtqreg ,eclass
                          xtqreg y x, i(fe) q(.25)
                          matrix b1=e(b)
                          xtqreg y x, i(fe) q(.5)
                          matrix b2=e(b)
                          matrix coleq b1=q25
                          matrix coleq b2=q50
                          matrix b=b1,b2
                          ereturn post b
                          end
                          bootstrap: bsxtqreg
                          This may need some adjustment to allow to cluster by the panel id, but you can get examples of that in the helpfile of Bootstrap
                          HTH
                          Fernando
                          Thank you Fernando! I'll try this solution!

                          Comment


                          • #58
                            Hello Joao Santos Silva and Jeff Wooldridge :


                            For Joao Santos Silva

                            Pardon me if I happen to ask a question that perhaps has been asked already.

                            I am trying to use the xtqreg comand to run a quantile fixed effects model for a panel data. As per your response

                            Originally posted by Joao Santos Silva View Post
                            Originally posted by Joao Santos Silva View Post

                            Yes, N=36 and T=18 should be just OK. qregpd and xtqreg estimate very, very different models, so it is not surprising that they lead to very different results; you need to decide which model you want to estimate and then choose the corresponding estimator. If you want to get estimates of the fixed effects, then you need xtqreg. Currently, xtqreg does not automatically compute the fixed effects, but you can do it using the results in the paper.

                            Best wishes,

                            Joao

                            My data has
                            N=1746 and T= 5. Just to confirm, is
                            this T "large" enough? And will I run into incidental parameter problem using results from the xtqreg?

                            Or would you suggest the use of qreg2 as per this thread:

                            Dear Javier,

                            Estimation of quantile regression with fixed effects is currently an area of intense research, and several new methods have been suggested recently. However, there is very little information on the performance of these estimators, and I would say that at the moment there is no established method to address this problem.

                            A standard thing that can always be done is to estimate pooled quantile regression and use clustered standard errors; this can be done with
                            qreg2
                            (check the help file for the appropriate references). An alternative that is also popular is the use of the so called correlated random effects, as in
                            Abrevaya and Dahl
                            . Again, you should use clustered standard errors.

                            All the best,

                            Joao

                            And also for @Jeff
                            Wooldridge:

                            I am honestly quite new to Econometrics. But in case I need to use the method you recommended in this thread below, is there a standard STATA package to implement it and if not, how may I go about transforming the data in STATA in other to apply the
                            pooled quantile regression
                            ?

                            I agree with Joao that exploiting a random effects variance-covariance structure is not done with quantile regression. Unlike in the case of estimating mean effects, it's difficult to impose an RE structure. But there are other ways to implement correlated random effects approaches and use pooled estimation. In 2007 lecture notes with Imbens, "What's New in Econometrics?", I proposed using the Mundlak device -- add the time averages of the covariates -- and then use pooled quantile regression. Clearly this is an approximation, but it could be as good as anything. This suggestion also appears in Section 12.10 of the second edition of my MIT Press book, "Econometric Analysis of Cross Section and Panel Data," 2010.

                            Joao might also be interested to know that the 2007 lecture notes with Imbens and my 2010 book proposed what appears to be the same cluster-robust variance covariance matrix studied in Parente and Santos Silva (2016). I only considered the panel data case but, of course, the structure is the same.

                            Here's a link to the NBER lecture notes; I can't link my MIT Press book chapter ....

                            http://www.nber.org/WNE/lect_14_quantile.pdf

                            I would imagine you are very busy people and your help in addressing my concerns is highly appreciated.

                            Thank you.

                            Cobby.



                            Comment


                            • #59
                              Dear Cobby Stoneson,

                              T=5 is too short for xtqreg. You can try it , but I would go for the "correlated fixed effects" (or Mundlak device) mentioned in the posts above.

                              Best wishes,

                              Joao

                              Comment


                              • #60
                                Assuming a balanced panel, the following should work. z1 ... zJ do not change over time, the xk do. I'm showing for the median and with time dummies.

                                Code:
                                egen x1bar = mean(x1), by(id)
                                egen x2bar = mean(x2), by(id)
                                ...
                                egen xKbar = mean(xK), by(id)
                                qreg2 y d2 ... dT z1 ... zJ x1 ... xK x1bar ... xKbar, q(.5) cluster(id)

                                Comment

                                Working...
                                X