You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用estout堆叠方程?如何堆叠汇总统计表中的est1与est2?

Stacking Models and Equations with estout in Stata

Let's tackle your two questions step by step—first stacking est1 and est2 vertically, then stacking equations within a model.

1. Stacking est1 and est2 Vertically (Model Stacking)

If you want to display the results of est1 and est2 one below the other (each model's full set of variable estimates in separate sections), here's how to do it:

First, confirm you've stored your models as estimates (replace the example code with your actual model specifications):

// Example: Store two regression models
sysuse auto, clear
reg price mpg weight if foreign == 0
estimates store est1
reg price mpg weight length if foreign == 0
estimates store est2

Then use esttab with the layout(vertical) option to stack the models vertically. Add a separator between them with separate for clarity:

esttab est1 est2, layout(vertical) separate ///
    title("Vertical Stack of est1 and est2") ///
    se star(* 0.1 ** 0.05 *** 0.01)

This will output est1's results first, followed by a horizontal line, then est2's results—all stacked vertically.

If you prefer to arrange models as rows (with variables as columns, each row showing a model's coefficient for that variable), use the transpose option instead:

esttab est1 est2, transpose ///
    title("Model Results as Rows") ///
    se star(* 0.1 ** 0.05 *** 0.01)

2. Stacking Equations (Within a Single Model)

For models with multiple equations (like sur, reg3, or seemingly unrelated regressions), you can stack equations vertically instead of displaying them side by side using the stack option.

Example workflow:

// Estimate a multi-equation model
sysuse auto, clear
reg3 (price mpg weight) (length mpg weight)
estimates store multi_eq_model

Then use esttab with stack to stack the equations, and eqlabels to add clear labels for each equation:

esttab multi_eq_model, stack ///
    title("Stacked Equations") ///
    se star(* 0.1 ** 0.05 *** 0.01) ///
    eqlabels("Price Equation" "Length Equation")

The stack option will list each equation's coefficients one after another, rather than placing them in separate columns.


内容的提问来源于stack exchange,提问作者Yan Song

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 09:41:56