How Stata estimates a random effects for an unbalanced panel 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!
Example:
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? 
 A: 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).
