Is it possible to use the Breusch-Pagan Lagrange multiplier test (xttest0) in Stata for unbalanced data? Is it possible to use xttest0 in Stata with unbalanced panel data? I want to test whether the I should use pooled OLS or random effects estimation. 
What does this test actually do? 
 A: The null hypothesis in Stata's xttest0 command is that the variance of the unobserved fixed effects is zero, i.e. var(u) = 0. Rejecting this hypothesis means that pooled OLS might not be the appropriate model given that it assumes an error structure $\sigma^2 I_{NT}$. If you have unbalanced panel data you can perform the Breusch-Pagan LM test with the xttest1 command. For a description and more information on this command type
net install sg164_1.pkg
help xttest1

If you want to test whether you should use fixed effects or random effects, you will have to check this with the Hausman test. You can perform this test with the hausman command or, if you have used robust or cluster robust errors, with xtoverid. For the latter command see the help file which includes at the bottom an example of how to test fixed versus random effects.
A: lm[code,t] = Xb + u[code] + e[code,t]

Estimated results:
                 |       Var     sd = sqrt(Var)
        ---------+-----------------------------
              lm |   .4200004       .6480744
               e |   .0110228       .1049893
               u |   .2056455       .4534815

Test:   Var(u) = 0
                      chi2(1) =   348.01
                  Prob > chi2 =     0.0000

