Hi Fellow Statalisters,
I need to loop through a post estimation r(table) after a mixed model, find the each "var(_cons)" (random effect variances) an sum them all together. I have code that is ridiculously long and tedious, so I am looking for some help in streamlining it.
Here is an example:
as you can see, there are 2 "var(_cons)". I need to create a scalar that sums the two related betas ("b" in row 1) to get (.00189637 + .00644388) = .00834025
I am too embarrassed to show the code I wrote to try and do this since it is very long and clunky...
The good news is that the colnames I need will always be "var(_cons)"
Thanks in advance!
Ariel
I need to loop through a post estimation r(table) after a mixed model, find the each "var(_cons)" (random effect variances) an sum them all together. I have code that is ridiculously long and tedious, so I am looking for some help in streamlining it.
Here is an example:
Code:
. webuse productivity, clear . mixed gsp private emp hwy water other unemp || region: || state:, reml . mat li r(table) . matrix coleq B = "" . mat li B
Code:
B[9,10]
private emp hwy water other unemp _cons var(_cons) var(_cons) var(e)
b .26603079 .75550594 .07188572 .07615521 -.10053959 -.00588152 2.1269949 .00189637 .00644388 .0013543
se .02154709 .02645561 .02334776 .01399523 .01701732 .00090925 .15748651 .00162251 .00153343 .00006949
z 12.346482 28.557495 3.0789125 5.4415121 -5.908074 -6.4685316 13.505886 .b .b .b
pvalue 5.089e-35 2.27e-179 .00207758 5.283e-08 3.461e-09 9.896e-11 1.444e-41 .b .b .b
ll .22379927 .7036539 .02612494 .04872506 -.13389293 -.00766361 1.818327 .00035453 .00404194 .00122472
ul .30826232 .80735798 .11764649 .10358535 -.06718626 -.00409942 2.4356627 .01014378 .01027318 .00149759
df . . . . . . . . . .
crit 1.959964 1.959964 1.959964 1.959964 1.959964 1.959964 1.959964 1.959964 1.959964 1.959964
eform 0 0 0 0 0 0 0 0 0 0
I am too embarrassed to show the code I wrote to try and do this since it is very long and clunky...
The good news is that the colnames I need will always be "var(_cons)"
Thanks in advance!
Ariel

Comment