统计:将回归结果与其他结果结合起来 [英] Stata: combining regression results with other results

查看:154
本文介绍了统计:将回归结果与其他结果结合起来的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试复制一项研究的一些结果。因此,通常我需要将回归结果与我要复制的研究结果进行比较。
我一直在excel中将esttab结果与研究结果手动合并。但是,这很乏味,因为我正在处理很多变量。我想知道是否有一种方法可以存储研究结果,然后称其为回归结果的旁边。我尝试将它们存储为标量,并使用estout调用它们,但这将存储的标量置于回归结果之下。我希望它们并列作为另一列。

I am trying to replicate some results from a study. therefore often i need to compare my regression results with results from the study that i'm trying to replicate. I have been manually combining my esttab results with the study results in excel. this however is tedious since i'm working with lot of variables. I was wondering whether there is a way to store the study results and then calling them to go next to my regression results. I tried storing them as scalars and calling them using estout however this puts the stored scalars below the regression results. i would prefer to have them side by side as another column.

示例:

参考研究结果为

var b
x  2.1
z  4.2

我将它们输入Stata

I entered these into Stata

estadd scalar x=2.1
estadd scalar z=4.2

我的回归是

eststore: reg y x z
estout, stats(x,z)

但是当我这样做时我得到这样的表

but when i do this i get a table like this

var        b
my reg x   5.3
my reg z   2.3
scalar x   2.1
scalar z   4.2

但是我想要这样的结果

var        b      scalar b
my reg x   5.3     2.1
my reg z   2.3     4.2


推荐答案

以下内容可能会有所帮助。

The following might help. Find comments inline.

clear 
set more off

*----- example data -----

sysuse auto
keep price weight mpg

*----- what you want -----

//regress and store
reg price weight mpg 
eststo m1

// create matrix of "scalars"
matrix w = (2.1 , 2.4 , 3.2) 

// rename matrix columns to coincide with those of regression
mat colnames w = weight mpg _cons 

// add
estadd matrix w

// print
estout m1, cells("b w")

这篇关于统计:将回归结果与其他结果结合起来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆