Announcement

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

  • How to do WLS with custom WLS weights in panel

    I am trying to do a unit-level panel with custom-set analytic weights set to a variable with clustered SEs clustered at the panel level.

    I am trying to do the following:

    xtset (unit)

    xtreg effectSize moderatorOne moderatorTwo moderatorThree [aweight = variable], cluster(unit)

    AND THEN

    xtreg effectSize moderatorOne moderatorTwo moderatorThree [aweight = variable], cluster(unit) fe

    However, it tells me weights cannot be used with xtreg. What can I do? Is there another panel command beside xtreg that can accept the use of aweights or pweights?

  • #2
    You can do
    Code:
    reghdfe effectSize moderatorOne moderatorTwo moderatorThree [aweight = variable], cluster(unit)
    -reghdfe- is written by Sergio Correa and is available from SSC.

    If you do not wish to install a user-written program, you can also do
    Code:
    regress effectSize moderatorOne moderatorTwo moderatorThree i.unit [aweight = variable], cluster(unit)
    if you don't mind getting a potentially lengthy list of coefficients for the unit indicators.

    Comment


    • #3
      sorry, but are these panel regressions then? does i.unit in the second option make it panel? And in the first option, I just set the panel with xtset and then use the option one command? Thanks, Clyde!

      Comment


      • #4
        Yes, -regress ... i.unit- emulates -xtset unit- -xtreg ..., fe-. And -reghdfe- is a generalization of -xtreg, fe-. It allows high-dimensional fixed effects, whereas with -xtreg- only one fixed effect dimension is allowed. And you don't need to use -xtset- for either of these options.

        Comment


        • #5
          with reghdfe, how does it know what the panel unit is?

          Comment


          • #6
            It goes in the -absorb()- option, which, I now notice, I forgot to include in my -reghdfe- command in #2. Sorry about that. It should be
            Code:
            reghdfe effectSize moderatorOne moderatorTwo moderatorThree [aweight = variable], cluster(unit) absorb(unit)

            Comment


            • #7
              Thank you very much! What about if you want to do random effects with weights in panel instead of fixed effects?

              Comment


              • #8
                You are not asking your questions very well.

                The -xtreg, fe- accepts weights, as long as the weights are constant by panel.

                The -xtreg, re- does not accept weights.

                Code:
                . sysuse auto
                (1978 Automobile Data)
                
                . xtset rep
                       panel variable:  rep78 (unbalanced)
                
                . xtreg price mpg [aweight = weight]
                weights not allowed
                r(101);
                
                . xtreg price mpg [aweight = weight], fe
                weight must be constant within rep78
                r(199);
                
                . egen avgwe = mean(weight), by(rep)
                
                . xtreg price mpg [aweight = avgwe], fe
                
                Fixed-effects (within) regression               Number of obs     =         69
                Group variable: rep78                           Number of groups  =          5
                
                R-sq:                                           Obs per group:
                     within  = 0.2491                                         min =          2
                     between = 0.0014                                         avg =       13.8
                     overall = 0.2079                                         max =         30
                
                                                                F(1,63)           =      20.90
                corr(u_i, Xb)  = -0.4414                        Prob > F          =     0.0000
                
                ------------------------------------------------------------------------------
                       price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                -------------+----------------------------------------------------------------
                         mpg |  -299.1687    65.4403    -4.57   0.000    -429.9407   -168.3967
                       _cons |   12434.03   1408.365     8.83   0.000     9619.632    15248.42
                -------------+----------------------------------------------------------------
                     sigma_u |  1202.9487
                     sigma_e |  2654.1381
                         rho |  .17041509   (fraction of variance due to u_i)
                ------------------------------------------------------------------------------
                F test that all u_i=0: F(4, 63) = 1.02                       Prob > F = 0.4025
                
                .

                Comment


                • #9
                  And what you want, does not really make sense on the surface. The Random Effects model is some specific form of weighting. If you want to weight in another way, so are explicitly admitting that the random effects weighting is incorrect.

                  I would say just do a regression with weights.

                  If you insist to do random effects model with weighting, and you think you know what you are doing, read Wooldridge "Cross sectional and panel data econometrics" and find one chapter in which it is explained how to do random effects regression manually. The procedure is called "quasi demeaning." I used this quasi demeaning manual random effects procedure for the first draft of my paper

                  Kolev, Gueorgui I. "Underperformance by female CEOs: A more powerful test." Economics Letters 117, no. 2 (2012): 436-440.

                  because back in the days -xtreg- did not accept the robust/cluster option. So I had to implement random effects through -regress-.



                  Originally posted by Joe Korkey View Post
                  Thank you very much! What about if you want to do random effects with weights in panel instead of fixed effects?

                  Comment

                  Working...
                  X