Stata esttab中的组数(xtmixed后)

Stata esttab中的组数(xtmixed后),stata,Stata,在Stata(xtmixed)中拟合多级模型后,我想将组数添加到esttab输出中。我发现并理解了矩阵e(N_g)中存储的组数。但是,我不明白如何使用这个矩阵中的值并将其添加到输出中。我尝试了estadd,但没有成功。我也没有在estout手册中找到关于在输出中使用矩阵的单个单元格的内容 关于如何将gorup的数量添加到esttab输出中,有什么想法吗?或者从矩阵中添加单个值的经验 谢谢 注意:这是矩阵列表e(N\u g) Estadd是一条路,下面是一个例子: clear all webuse

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

关于如何将gorup的数量添加到esttab输出中,有什么想法吗?或者从矩阵中添加单个值的经验

谢谢

注意:这是
矩阵列表e(N\u g)


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)

实际上,
esttab,stats(N_g,labels(“N”))
就足够了
estout
可以识别
N_g

只是一个简短的补充:如果您想使用
ESTAB.,stats(N个组,fmt(2))
定义组的显示格式,最好使用
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)