I have estimated a random effects model with an unbalanced panel. I would like to know if Stata gives each individual the same weight when estimating the coefficients or whether each individual is weighted differently depending on the time units(year) available.

I have tried to find the answer here and in the usual documentation of xtreg unsuccessfully so far. Any comment/source hugely appreciated!


In my case, I want to estimate a model like for instance E.g. $$ wage = \beta_{1} + \beta_{2}educ + \beta_{3}experience + \epsilon $$

Some individuals have observations for all the years in the panel, others have missing years. The $\beta$ estimated in the model with the xtreg ... ,re command, are they giving the same weight to all the individuals regardless of some having less observations (missing years)? Or, on the contrary, those individuals with observations for all years will have "more leverage/influence" than the individuals with missing years?

  • $\begingroup$ This is a very Stata specific question. You may have more luck asking this question on Statalist, and if that fails you can try contacting StataCorp itself. $\endgroup$ Jun 18 '15 at 11:08
  • $\begingroup$ sorry, I have changed it to "individual" $\endgroup$ Jun 18 '15 at 11:08
  • $\begingroup$ yes, it is a panel, an unbalanced panel with some individuals having more years than others. I would like to know if the xtreg command does any weighting or not. $\endgroup$ Jun 18 '15 at 11:14
  • $\begingroup$ Now cross-posted at statalist.org/forums/forum/general-stata-discussion/general/… $\endgroup$
    – Nick Cox
    Jun 18 '15 at 11:25
  • $\begingroup$ @NickCox, then, should I delete this or the statalist question? Or just leave it like this? $\endgroup$ Jun 18 '15 at 11:31

Actually it is written in the documentation of xtreg under the section methods and formulas (link).

For unbalanced panels you use the individual maximum panel lengths $T_i$ instead of a fixed $T$ which you would have in the balanced case. You generate the demeaned variables as $$\overline{z}_i = \frac{1}{T_i}\sum^{T_i}_{t}z_{it}$$

and the GLS weight,

$$\widehat{\theta}_i = 1 - \sqrt{\frac{\widehat{\sigma}^2_e}{T_i\widehat{\sigma}^2_u + \widehat{\sigma}^2_e}}$$

where $\widehat{\sigma}^2_e$ is the error component from a fixed effects regression and $\widehat{\sigma}^2_u$ the one from a between effects regression (for further information on how to estimate these have a look at p.27 of the linked documentation). When you then perform the GLS transformation of your variables $$z^*_{it} = z_{it} - \widehat{\theta}_i\overline{z}_i $$

you just need to run the regression of your GLS transformed outcome on the GLS transformed explanatory variables and the GLS transformed constant ($1-\widehat{\theta}_i$), leaving out the constant that Stata includes by default (use the option nocons).

  • $\begingroup$ Thanks @Andy for your answer. I understand that all the individuals have the same "leverage" at estimating the model coefficients, regardless if they have observations for all the years, right? I have added a little example in my question to clarify it. $\endgroup$ Jun 23 '15 at 9:46
  • 1
    $\begingroup$ The random effects estimator already is a matrix weighted average of the between and within variation from each individual which takes into account the available information. In fact, Stata does not even allow you to change those weights (unlike for the fixed effects estimator, for instance). See the section "Remarks and Examples" in the documentation. What you should worry about is whether individual observations are missing at random - if not there might be a correlation between your observables and the error in which case neither RE nor FE are consistent. $\endgroup$
    – Andy
    Jun 23 '15 at 10:08
  • $\begingroup$ So the RE "is a matrix weighted average of the between and within variation from each individual" but each individual has the same leverage in the final betas reported by STATA, regardless of the number of missing years that each individual may have? $\endgroup$ Jun 23 '15 at 10:23
  • 1
    $\begingroup$ Not sure what you mean by leverage? The number of years an individual is in the sample is $T_i$ which directly enters the estimation of the GLS weight $\widehat{\theta}$. $\endgroup$
    – Andy
    Jun 23 '15 at 10:34
  • 2
    $\begingroup$ Okay, now I see. Individuals who are in the panel for longer provide more data points in the regression, hence given a certain degree of autocorrelation of wages in individual characteristics these individuals will have a larger effect on the regression line due to the higher frequency (since they also provide more information to the estimator) and thus on the estimated coefficients (assuming that individuals with missing years are missing at random, meaning that they do not bias the regression). $\endgroup$
    – Andy
    Jun 23 '15 at 12:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.