如何使用 esttab 创建具有不同单元格的列
How to use esttab to create columns with different cells
假设我有这个数据:
sysuse auto2, clear
对于两个不同的样本,我可以使用 社区贡献 命令 esttab
创建一个 table 均值 a
和 b
均值下方括号中为标准差:
eststo clear
eststo a: estpost summarize trunk weight length turn
keep if inrange(mpg, 12, 20)
eststo b: estpost summarize trunk weight length turn
esttab a b, label cells("mean(fmt(2))" "sd(fmt(2) par)") ///
nonumbers booktabs collabels("a" "b")
我希望生成的 table 上面的两列完全保持原样,然后添加与 b
估计。
例如,我希望第三列如下:
esttab b, label cells("min") ///
nonumbers booktabs collabels("min")
另外,我希望第四列如下:
esttab b, label cells("max") ///
nonumbers booktabs collabels("min")
问题是我不确定如何将所有这些都放在一个 table 中(除了可能将所有内容保存到矩阵并在其上使用 esttab
之外)。
原因是好像不能得到cells
选项来对应一个单独的列;它将更改应用于所有列。
请注意,如果有办法做到这一点,但需要不包含 s.d.s,那很好。
如何在不创建矩阵的情况下生成所需的输出?
这是您在不创建矩阵的情况下所能做的最好的事情:
esttab a b, label cells( (mean(fmt(2)) min max) sd(fmt(2) par) )
--------------------------------------------------------------------------------------------------
(1) (2)
mean/sd min max mean/sd min max
--------------------------------------------------------------------------------------------------
Trunk space (.. ft.) 13.76 5.00 23.00 16.32 7.00 23.00
(4.28) (3.28)
Weight (lbs.) 3019.46 1760.00 4840.00 3558.68 2410.00 4840.00
(777.19) (498.89)
Length (in.) 187.93 142.00 233.00 203.89 173.00 233.00
(22.27) (13.87)
Turn Circle (ft.) 39.65 31.00 51.00 42.55 36.00 51.00
(4.40) (3.21)
--------------------------------------------------------------------------------------------------
Observations 74 38
--------------------------------------------------------------------------------------------------
假设我有这个数据:
sysuse auto2, clear
对于两个不同的样本,我可以使用 社区贡献 命令 esttab
创建一个 table 均值 a
和 b
均值下方括号中为标准差:
eststo clear
eststo a: estpost summarize trunk weight length turn
keep if inrange(mpg, 12, 20)
eststo b: estpost summarize trunk weight length turn
esttab a b, label cells("mean(fmt(2))" "sd(fmt(2) par)") ///
nonumbers booktabs collabels("a" "b")
我希望生成的 table 上面的两列完全保持原样,然后添加与 b
估计。
例如,我希望第三列如下:
esttab b, label cells("min") ///
nonumbers booktabs collabels("min")
另外,我希望第四列如下:
esttab b, label cells("max") ///
nonumbers booktabs collabels("min")
问题是我不确定如何将所有这些都放在一个 table 中(除了可能将所有内容保存到矩阵并在其上使用 esttab
之外)。
原因是好像不能得到cells
选项来对应一个单独的列;它将更改应用于所有列。
请注意,如果有办法做到这一点,但需要不包含 s.d.s,那很好。
如何在不创建矩阵的情况下生成所需的输出?
这是您在不创建矩阵的情况下所能做的最好的事情:
esttab a b, label cells( (mean(fmt(2)) min max) sd(fmt(2) par) )
--------------------------------------------------------------------------------------------------
(1) (2)
mean/sd min max mean/sd min max
--------------------------------------------------------------------------------------------------
Trunk space (.. ft.) 13.76 5.00 23.00 16.32 7.00 23.00
(4.28) (3.28)
Weight (lbs.) 3019.46 1760.00 4840.00 3558.68 2410.00 4840.00
(777.19) (498.89)
Length (in.) 187.93 142.00 233.00 203.89 173.00 233.00
(22.27) (13.87)
Turn Circle (ft.) 39.65 31.00 51.00 42.55 36.00 51.00
(4.40) (3.21)
--------------------------------------------------------------------------------------------------
Observations 74 38
--------------------------------------------------------------------------------------------------