Stata 将边际效应t统计添加到estout表中
我想在Stata 将边际效应t统计添加到estout表中,stata,Stata,我想在estout表(ssc install estout)中添加边际效应t统计数据 我可以使用estadd margins添加边际效应系数和标准误差。 但是,页边距不添加t统计 我原以为我可以用estadd matrix添加一个t统计量,但该代码无法计算margins\u t: webuse grunfeld eststo clear regress mvalue c.kstock##c.invest eststo estadd margins, dydx(kstock) estadd
estout
表(ssc install estout
)中添加边际效应t统计数据
我可以使用estadd margins
添加边际效应系数和标准误差。
但是,页边距
不添加t统计
我原以为我可以用estadd matrix
添加一个t统计量,但该代码无法计算margins\u t
:
webuse grunfeld
eststo clear
regress mvalue c.kstock##c.invest
eststo
estadd margins, dydx(kstock)
estadd matrix margins_t = margins_b :/ margins_se
我只想报告kstock
的边际效应(即,仅一个交互变量):
标准错误版本可以工作,但我更喜欢t-statistics。以下内容适合我:
webuse grunfeld
eststo clear
eststo m1: regress mvalue c.kstock##c.invest
eststo m2: margins, dydx(kstock) post
esttab m1 m2 using output, replace
type output.txt
--------------------------------------------
(1) (2)
mvalue
--------------------------------------------
kstock -0.0230 -0.207
(-0.09) (-0.94)
invest 6.673***
(19.14)
c.kstock#c~t -0.00126***
(-4.35)
_cons 219.3**
(2.90)
--------------------------------------------
N 200 200
--------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001
webuse-grunfeld
埃斯托清除
eststo m1:回归价值c.kstock##c.invest
eststo m2:边距,dydx(kstock)邮政
esttab m1 m2使用输出,替换
键入output.txt
--------------------------------------------
(1) (2)
价值
--------------------------------------------
kstock-0.0230-0.207
(-0.09) (-0.94)
投资6.673**
(19.14)
c、 kstock#c~t-0.00126**
(-4.35)
_cons 219.3**
(2.90)
--------------------------------------------
N 200 200
--------------------------------------------
括号中的t统计量
*p以下内容对我有用:
webuse grunfeld
eststo clear
eststo m1: regress mvalue c.kstock##c.invest
eststo m2: margins, dydx(kstock) post
esttab m1 m2 using output, replace
type output.txt
--------------------------------------------
(1) (2)
mvalue
--------------------------------------------
kstock -0.0230 -0.207
(-0.09) (-0.94)
invest 6.673***
(19.14)
c.kstock#c~t -0.00126***
(-4.35)
_cons 219.3**
(2.90)
--------------------------------------------
N 200 200
--------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001
webuse-grunfeld
埃斯托清除
eststo m1:回归价值c.kstock##c.invest
eststo m2:边距,dydx(kstock)邮政
esttab m1 m2使用输出,替换
键入output.txt
--------------------------------------------
(1) (2)
价值
--------------------------------------------
kstock-0.0230-0.207
(-0.09) (-0.94)
投资6.673**
(19.14)
c、 kstock#c~t-0.00126**
(-4.35)
_cons 219.3**
(2.90)
--------------------------------------------
N 200 200
--------------------------------------------
括号中的t统计量
*p在我的问题中,代码(至少)有两个问题
:/
是Mata中的元素除法。使用matewd
在Stata中进行元素分割matewd
来自Stata技术公告,因此请使用findit matewd
Elementwise division将不保留列名,estout
使用列名正确对齐系数估计值和其他统计数据
下面的代码解决了原来的问题,但需要一些额外的步骤。手动修改表布局可能比执行这几个附加步骤更容易
webuse grunfeld
eststo clear
regress mvalue c.kstock##c.invest
eststo
estadd margins, dydx(kstock)
matrix margins_b = e(margins_b)
matrix margins_se = e(margins_se)
matewd margins_b margins_se margins_t
local colnames : colnames margins_b
matrix colnames margins_t = "`colnames'"
estadd matrix margins_t
esttab, cells("b margins_b" "t(par) margins_t(par)")
// --------------------------------------
// (1)
// mvalue
// b/t margins_b/~t
// --------------------------------------
// kstock -.0229636 -.2073908
// (-.0947377) (-.9367782)
// invest 6.672997
// (19.13787)
// c.kstock#c~t -.0012636
// (-4.351608)
// _cons 219.3425
// (2.903506)
// --------------------------------------
// N 200
// --------------------------------------
esttab, cells(b t(par) margins_b margins_t(par))
// -------------------------
// (1)
// mvalue
// b/t/margin~t
// -------------------------
// kstock -.0229636
// (-.0947377)
// -.2073908
// (-.9367782)
// invest 6.672997
// (19.13787)
// c.kstock#c~t -.0012636
// (-4.351608)
// _cons 219.3425
// (2.903506)
// -------------------------
// N 200
// -------------------------
在我的问题中,代码(至少)有两个问题
:/
是Mata中的元素除法。使用matewd
在Stata中进行元素分割matewd
来自Stata技术公告,因此请使用findit matewd
Elementwise division将不保留列名,estout
使用列名正确对齐系数估计值和其他统计数据
下面的代码解决了原来的问题,但需要一些额外的步骤。手动修改表布局可能比执行这几个附加步骤更容易
webuse grunfeld
eststo clear
regress mvalue c.kstock##c.invest
eststo
estadd margins, dydx(kstock)
matrix margins_b = e(margins_b)
matrix margins_se = e(margins_se)
matewd margins_b margins_se margins_t
local colnames : colnames margins_b
matrix colnames margins_t = "`colnames'"
estadd matrix margins_t
esttab, cells("b margins_b" "t(par) margins_t(par)")
// --------------------------------------
// (1)
// mvalue
// b/t margins_b/~t
// --------------------------------------
// kstock -.0229636 -.2073908
// (-.0947377) (-.9367782)
// invest 6.672997
// (19.13787)
// c.kstock#c~t -.0012636
// (-4.351608)
// _cons 219.3425
// (2.903506)
// --------------------------------------
// N 200
// --------------------------------------
esttab, cells(b t(par) margins_b margins_t(par))
// -------------------------
// (1)
// mvalue
// b/t/margin~t
// -------------------------
// kstock -.0229636
// (-.0947377)
// -.2073908
// (-.9367782)
// invest 6.672997
// (19.13787)
// c.kstock#c~t -.0012636
// (-4.351608)
// _cons 219.3425
// (2.903506)
// -------------------------
// N 200
// -------------------------
我可能得走这条路。对我来说,这种方法的缺点是它会生成另一个列号和页脚条目。此外,结合点估计值和边际效果可以将结果叠加在一列中。谢谢。每次手动修改外观可能是最简单的方法。estout
非常灵活,可以通过循环等方式进行扩展。但它确实有一个学习曲线,您需要进行实验。我可能不得不走这条路。对我来说,这种方法的缺点是它会生成另一个列号和页脚条目。此外,结合点估计值和边际效果可以将结果叠加在一列中。谢谢。每次手动修改外观可能是最简单的方法。estout
非常灵活,可以通过循环等进行扩展。但它确实有一个学习曲线,您需要进行实验。