Code:
* Model A

. eststo A, title ("Model A"):  xtmixed Y X2 X1 time c.X2#c.time c.X1#c.time group c.group#c.X2 c.group#c.X1 c.group#c.X2#c.time c.group#c.X1#c.time || company: ,cov(un) variance mle  
estadd scalar deviance = -2*e(ll)


estadd scalar cov = tanh([atr1_1_1_2]_b[_cons]) * exp([lns1_1_1]_b[_cons]) *exp([lns1_1_2]_b[_cons])

* show table with all models in STATA results window

esttab, se nostar transform(ln*: exp(@) exp(@) at*: tanh(@) (1-tanh(@)^2)) label eqlabels("" "var(time)" "var(_cons)" "cov(time,_cons)" "var(Residual)", none) varlabels(,elist(weight:_cons "{break}{hline @width}"))  varwidth(16)

* save results in .rtf file

esttab using dj_models.rtf, replace nogap onecell se compress label eqlabels("" "var(time)" "var(_cons)" "cov(time,_cons)" "var(Residual)", none)transform(ln*: exp(2*@) 2*exp(2*@) at*: tanh(@) (1-tanh(@)^2)) stats(cov deviance aic bic, labels(Covariance Deviance AIC BIC))
Array

Array


. test group c.group#c.X2 c.group#c.X1 c.group#c.X2#c.time c.group#c.X1#c.time

( 1) [Y]group = 0
( 2) [Y]c.group#c.X2 = 0
( 3) [Y]c.group#c.X1 = 0
( 4) [Y]c.group#c.X2#c.time = 0
( 5) [Y]c.group#c.X1#c.time = 0

chi2( 5) = 175.81
Prob > chi2 = 0.0000