esttab中的组数(xtmixed之后)

Dom*_*gel 3 stata

我想esttab在Stata(xtmixed)中拟合多级模型后将组数添加到输出中。我发现了这篇文章,并了解到组的数量存储在矩阵e(N_g)中。但是,我不明白如何使用此矩阵中的值并将其添加到输出中。我尝试过,estadd但没有成功。在estout手册中,我也没有发现有关在输出中使用矩阵的单个单元格的信息。

关于如何向esttab输出中添加树桩数量的任何想法?还是从矩阵中添加单个值的经验?

谢谢!!!

PS这是输出 matrix list e(N_g)

symmetric e(N_g)[1,1]
    c1
r1  117
Run Code Online (Sandbox Code Playgroud)

Eri*_* HB 5

Estadd是必经之路,下面是一个示例:

clear all
webuse pig

// model
eststo: xtmixed weight week || id:, vce(robust)

// estadd portion - pull the single element of the matrix into a local and estadd it
matrix N_g = e(N_g)
local groups = N_g[1,1]
estadd local groups `groups'

// add groups in the stats option and it will appear at the bottom along
// with the number of observations in this case
esttab ., stats(N groups)
Run Code Online (Sandbox Code Playgroud)