Announcement

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

  • #61
    Thank you very much Joao Santos Silva and Jeff Wooldridge . I will try both methods to see how they turn out and if there are any more concerns I will ask for further clarifications. I am grateful for your responses.

    Comment


    • #62
      Dear

      Jeff Wooldridge,
      I am not sure if I should open new thread on this, but please permit me to clarify a few things on the quantile regression from the procedure outlined above:

      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)




      1. You stated that the procedure above should work for assuming a balanced panel. Please what happens if I have an unbalanced panel? Are there some modifications that can be made for the procedure to be valid for
      unbalanced panel?

      2. I was reading 12.10.3 of your book,
      "Econometric Analysis of Cross Section and Panel Data," 2010 where you describe the procedure in detail. However, I do not seem to pin down the exact name to call this procedure/method in my paper. Is it Correlated Fixed Effects Pooled Quantile Regression using the Chamberlain-Mundlak Device? Or What is the appropriate formal name that I should call it?
      3. My final question is arising out of my result from using a balanced sample from my data. I present below results just for the most important variables of interest (X2, X3 and their interaction). I left out the time averages and everything else. I realize that the mean-effect for X2 is largely above the effects at all the quartiles (in absolute terms). Are such results acceptable where the mean effect is either above the effects at the upper quartile or below
      the effects at
      the lower quartiles?



      Code:
       
      Results for Total Demand: Quantile Effects
      (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (13) (14) (15)
      Mean_Effects Q_05 Q_15 Q_25 Q_45 Q_50 Q_55 Q_65 Q_75 Q_85 Q_8875 Q_90 Q_95 Q_99 Q_9975
      VARIABLES
      X1 58.1145** 21.9807 23.8127 41.3204** 62.0513*** 76.3585*** 81.1684*** 71.7518*** 69.6911*** 88.0096** 115.1847*** 102.9998** 71.5924 -127.9446 -339.5787***
      (26.1367) (17.1387) (18.4458) (17.3128) (21.3057) (22.7966) (21.5244) (21.1384) (24.4936) (34.9356) (43.8180) (45.3374) (84.0194) (197.0906) (67.3985)
      X2 -63.7874*** -16.0557 -19.9413** -28.4479*** -32.6784*** -39.5835*** -41.7841*** -32.9478*** -27.3055* -36.7389 -51.0431*** -43.1305 -24.9020 64.1774 59.2534***
      (12.2551) (9.9122) (9.0798) (9.1337) (10.3506) (11.8519) (11.8891) (12.1729) (14.3594) (23.0355) (18.1450) (26.5561) (31.9265) (122.0253) (9.1669)
      X2*X3 -19.6117** -2.5290 -12.6594 -18.2245** -14.5731 -7.8030 -10.8540 -18.4405 -35.7097*** -48.9821* -43.7227 -51.5993 -71.5634** -92.4668 -215.2832***
      (9.5994) (11.6036) (8.7018) (8.7483) (9.4771) (9.3916) (10.6235) (12.7284) (12.4179) (26.0121) (27.5833) (37.7203) (33.7521) (134.6215) (15.0696)
      X3 2.0538 -8.5343 3.2451 9.5758 5.8199 3.1130 4.7100 4.5319 11.2573 18.7810 22.7945 18.4069 36.1491 -16.1521 41.5128**
      (6.4674) (9.3836) (6.5352) (6.7032) (7.0103) (7.2752) (8.2248) (9.1673) (9.1687) (22.2990) (23.8810) (24.8503) (22.3783) (41.7486) (18.2451)
      Observations 7,240 7,240 7,240 7,240 7,240 7,240 7,240 7,240 7,240 7,240 7,240 7,240 7,240 7,240 7,240
      R-squared 0.418 0.2094 0.3337 0.3801 0.4122 0.4185 0.4206 0.4184 0.4099 0.3920 0.3839 0.3854 0.3578 0.2707 0.2047
      Number of Individuals 1,448
      Correlated Fixed Effects YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES
      Robust standard errors in parentheses
      *** p<0.01, ** p<0.05, * p<0.1

      Thank you again for your time.

      Cobby.
      Last edited by Cobby Stoneson; 14 Oct 2019, 16:38.

      Comment


      • #63
        I am glad to see the post #62 above. I was reading the same part of Jeff Wooldridge's book yesterday and I had the same exact question. I hope he can answer it.

        Thanks.

        Comment


        • #64
          Cobby, Mehmet: It's probably not too important what you call it. I think correlated random effects quantile regression is as descriptive as anything.

          As far as unbalanced panels, I would use the method I propose in my 2019 Journal of Econometrics paper. The CRE approach can be used, but now you should model the heterogeneity as functions of the number of complete cases available for each i. The easiest way to do this is to define different dummy variables for having two periods, three periods, ..., up to T periods. These T-1 dummies can be added along with the time averages. You can also interact those dummies with the time averages to get more flexibility.

          As I discuss in my paper, my proposed method is for using complete cases. Data missing on any variable gets dropped. I define a complete cases indicator ahead of time to reduce the chance of making a mistake.

          I hope this helps.
          Jeff

          Comment


          • #65
            Dear Jeff Wooldridge ,

            This is absolutely helpful. Straightway I am off to look for and read your 2019 paper on the approach.

            And thank you Mehmet Sari for helping "pull" the distinguished professor from his busy schedules.

            Thank you all.

            Cobby.

            Comment


            • #66
              Hi Joao,
              Joao Santos Silva
              I am running the latest version of the package xtqreg.
              Thanks for the package, it is turning out to be useful.

              I am having trouble getting the tables of location and scale parameters while using bootstrap:

              sysuse auto
              xtqreg price weight length i.foreign, i(headroom) quantile(.25) ls
              bootstrap, cluster(headroom) idcluster(newid) group(headroom) reps(10): xtqreg price weight length i.foreign, i(headroom) quantile(.25) ls

              When using the bootstrap, tables of location and scale parameters are not reported. It is not obvious to me why this is the case... can you please help me here?

              I am aware that these are saved and the covariance matrix is as well, but it a bit tedious doing all this by hand when the tables otherwise are automized.

              Thanks in advance,
              Michael

              Stata SE 15.1

              Comment


              • #67
                Hi Michael,
                The reason why the location and scale parameters are not reported, is because, unless otherwise specified, bootstrap only reports results for e(b). xtqreg only stores the total results on e(b). Location and scale are stored in other matrices.
                Perhaps this would be useful tho:
                Code:
                sysuse auto
                program xtqwrapper, eclass
                xtqreg price weight length i.foreign, i(headroom) quantile(.25) ls
                matrix b1=e(b)
                matrix b2=e(b_scale)
                matrix b3=e(b_location)
                matrix coleq b1=total
                matrix coleq b2=scale
                matrix coleq b3=location
                matrix b=b1,b2,b3
                ereturn post b
                end
                bootstrap, cluster(headroom) idcluster(newid) group(headroom) reps(10): xtqwrapper

                Comment


                • #68
                  Dear FernandoRios, thanks very much for the code. That's very helpful.

                  Comment


                  • #69
                    Thanks for replying to this, FernandoRios.

                    Joao

                    Comment


                    • #70
                      Originally posted by Joao Santos Silva View Post
                      Dear Ch Man,

                      The variable will be dropped if it does not vary over time. The fixed effects can be computed using the expression at the top of page 12 (see the link to the paper in the help file); all the ingredients needed to compute that expression are saved by the command: e(q), e(b_location), and e(b_scale).

                      Best wishes,

                      Joao
                      Dear @Joao Santo Silva
                      Could you check the code to compute fixed effects following a call to xtqreg? I wasn't 100% sure about the notation in your paper. Also as a 99% R user, I sometimes find the magic of the STATA e() variables confusing!
                      Thanks
                      Ryan

                      Code:
                      ** First run xtqreg with say quantile(0.05) 
                      xtqreg f4infl infl dlrealgdp dlneer dloilprice_domcur, i(countryid) quantile(0.05)
                      
                      ** Collected e() variables
                      mat b05=e(b)
                      mat score xb05=b05
                      mat q1=e(q)
                      mat score qest05=q1
                      
                      ******************************************************************************
                      *     back out the fixed effects alpha_i(tau) = alpha_i + q(tau)*delta_i
                      ******************************************************************************
                      
                      * 1. alpha(i)
                      
                      mat fe1=e(b_location)
                      mat fe2=e(b_scale)
                      mat score feloc=fe1
                      mat score fescale=fe2
                      
                      gen alpha1 = f4infl-feloc
                      sort country obs
                      by country: egen alphai=mean(alpha1)
                      
                      * 2. delta_i
                      
                      gen Rhat    = f4infl-feloc - alphai
                      gen Rhatabs =  abs(Rhat)
                      gen delta1  =  Rhatabs - fescale
                      sort country obs
                      by country: egen deltai = mean(delta1)
                      
                      *************************************************************
                      * Put the pieces together for the quantile fixed effect
                      *************************************************************
                      gen quantile05_fe = alphai+(deltai*qest05)

                      Comment


                      • #71
                        Dear Ryan Banerjee,

                        Apologies for the late reply. Your code looks fine to me but I suggest you check it with a simple example where you can easily confirm the results.

                        Best wishes,

                        Joao

                        Comment


                        • #72
                          Originally posted by Joao Santos Silva View Post

                          Apologies for the late reply.
                          No need to apologise! Your reply was blisteringly fast! Thanks again, your function is super helpful.
                          Best
                          Ryan

                          Comment


                          • #73
                            Dear Ryan Banerjee,

                            I have updated the command so that you have an option to generate the fixed effects. If you want to try it, please do contact me by email.

                            Best wishes,

                            Joao

                            Comment


                            • #74
                              Joao Santos Silva , Hello,I am running into an error with using bootstrap with xtqreg. I would appreciate any suggestions for correcting my mistake, which is likely a very simple one. I have 75 groups over 97 years in my panel.Thanks in advance.

                              Code:
                              xtset Names1 year
                              panel variable: Names1 (strongly balanced)
                              time variable: year, 1 to 97
                              delta: 1 unit

                              Code:
                              generate newid= Names1
                              
                              bootstrap, cluster(Names1) idcluster(newid) reps(100):xtqreg mentions max careerage xcount mentions_lag i.year, i(Names1) quantile(.05) 
                              Using the above command, I get the error message:
                              Code:
                              running xtqreg on estimation sample)
                              
                              Bootstrap replications (100)
                              ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
                              repeated time values within panel
                              the most likely cause for this error is misspecifying the cluster(), idcluster(), or group() option
                              Last edited by Jake Ed; 29 Nov 2019, 08:44.

                              Comment


                              • #75
                                Dear Jake Ed,

                                I believe you need i(newid) instead of i(Names1).

                                Best wishes,

                                Joao

                                Comment

                                Working...
                                X