目录

  • 描述统计量

  • help tabstat   //Stata 官方命令
  • 描述统计量组间均值差异检验

  • help ttest
  • help ttable2
  • help estout
  • 相关分析命令

  • help pwcorr
  • help pwcorr_a
  • 回归相关分析命令

  • help esttab
  • help outreg2
  • help logout
  • stata命令汇总

  • help sum2docx     //输出基本统计量输出

  • help t2docx          //输出均值差异检验结果输出

  • help corr2docx    //输出 Pearson & Spearman 相关系数矩阵输出

  • help reg2docx     //输出回归结果输出

1、tabstat

描述性统计通常对收集来的数据进行直接的频率、频数等描述,描述性统计分析一般对样本的最小值、最大值、平均值、标准偏差等进行分析,这些数据有助于了解样本数据特征,能够清晰的看到各个统计量的分布情况。

描述性分析常用的统计量:

mean,均值

max,最大值

min,最小值

sd,标准差

variance,方差

semean,即sd/√n

skewness,偏度

kurtosis,峰度

p1,第一分位数

p5,第五分位数

p10,第十分位数

p50,中位数

median,中位数

range,max-min

示例:

sysuse auto tabstat price weight mpg rep78tabstat price weight mpg rep78, by(foreign) stat(mean sd min max)对变量price, weight, mpg, and rep78 按照foreign分类展示其描述统计量mean sd min max

结果为:

2、ttest

样本检验

示例:

sysuse auto ttest mpg==20 (one-sample t test)webuse fuel3 (setup) ttest mpg, by(treated) (two-sample t test using groups)webuse fuel (setup)ttest mpg1==mpg2 (two-sample t test using variables)

3、ttable2

示例:

sysuse auto,clearttable2 price wei len mpg, by(foreign)ttable2 price wei len mpg, by(foreign) f(%6.2f)tab rep78ttable2 price wei len mpg if rep78==3|rep78==4, by(rep78)**输出保存到Word文档等Save in Excel or Wordlogout, save(Tab2_corr) excel replace: ttable2 price wei len mpg, by(foreign)

结果为:

4、pwcorr VS pwcorr_a

相关系数的命令一般有corr、pwcorr,但是pwcorr的一个缺点是只能一次输出一个置信水平下的显著性,因此本文将为大家介绍pwcorr_a的具体使用。

1命令回顾correlate -- Correlations of variables进行变量相关系数的命令,该命令主要分为corr以及pwcorr语法格式为:

correlate [varlist] [if] [in] [weight] [, correlate_options]pwcorr [varlist] [if] [in] [weight] [, pwcorr_options]

案例1:

sysuse auto pwcorr price headroom mpg displacement ,sig star(0.01)

结果为:

使用pwcorr可以对指定的显著性水平进行标注。缺点是只能对指定的显著水平标注一个 *,即无法同时标注1% 5% 10%。2pwcorr_apwcorr_a 可以对1%,5%,10% 的显著水平进行标注 *** ,** 和 *语法格式为:

pwcorr_a [varlist] [if] [in] [weight] [, pwcorr_options]

主要选项含义为:

star1(#) :1% significance level for displaying with three stars, newly added 新增的标注1%水平下三颗星

star5(#) 5% significance level for displaying with two stars, newly added 新增的标注5%水平下两颗星

star10(#) 10% significance level for displaying with one star, newly added 新增的标注10%水平下一颗星

案例应用介绍

pwcorr_a price weight mpg displ, star1(0.01) star5(0.05) star10(0.1)

结果为:

3输出相关系数矩阵到Word文档中代码为:

sysuse auto, clearlogout, save(数量经济学) word replace: ///        pwcorr_a price wei len mpg    //标注star(0.05)

结果为:

4输出相关系数矩阵到Excel文档中代码为:

sysuse auto, clearlogout, save(数量经济学) excel replace: ///        pwcorr_a price wei len mpg    //标注star(0.05)

结果为:

5、esttab

新的esttab命令是estout的升级版本。它的语法相比较于estout而言,默认情况下,它会生成很好地结果,并输出在Stata的结果窗口中。

esttab不仅仅是estout的简化版本。另一方面,esttab提供完整的estout功能,因为所有的estout选项都是允许在esttab中。 另一方面,esttab也扩展了功能。例如,esttab支持与WORD、Excel、Latex、Html结果

一、Basic syntax and usage

Syntax

esttab [namelist] [using filename] [, options]

与estout(或官方Stata的估计表)一样,基本程序是首先存储多个模型,然后将esttab应用于这些存储的估计集以组成回归表。但是,esttab和estout之间的主要区别在于,如果在没有选项的情况下应用,esttab会生成一个完全格式化的表。

二、添加统计量

The default in esttab is to display raw point estimates along with t statistics and to print the number of observations in the table footer. Furthermore, the output displays asterisks denoting the statistical significance of coefficients. All this can be changed. To replace the t statistics with standard errors, add the adjusted R-squared, and omit the significance asterisks; for example, type

esttab, se ar2 nostar

结果为:

t统计量也可以用p值(p),置信区间(ci)或 估计中包含的任何参数统计信息(请参阅aux()选项)。更多信息请参考esttab的option选项。

esttab, beta not

三、添加数据来源以及表头等信息

Furthermore, the plain option produces a minimally formatted table with all display formats set to Stata’s %9.0g quasistandard, and compress reduces horizontal spacing to fit more models on screen without line breaking. Other options are, for example, label, which causes variable labels to be used, and mtitles(), which specifies that model titles be printed in the header above the model columns. For example,

esttab, se ar2 nostar brackets label title(This is a regression table) > nonumbers mtitles("Model A" "Model B") addnote("Source: auto.dta")

四、数据结果小数点位数保存格式

esttab, b(%9.0g) p(4) r2(4) nostar wide

五、结果输出

use "E:\stata\data\盈余管理新版.dta", clear

reg dacc rid tm

est store da

reg dacc rid tm size

est store qin

reg dacc rid tm size debt14 eps

est store daqinxueshu

esttab da qin daqinxueshu using daqinxueshu14.rtf, ///

mtitles("model 1" "model 2" "model 3" ) ///

title("This is the Second regression table") ///

append star( * 0.10 ** 0.05 *** 0.01 ) staraux r2 nogaps

6、outreg2

命令outreg2可以帮助你在学术论文中看到的展示类型。注意到这一点很重要,它不是一个Stata命令,它是一个用户编写的过程,您需要通过输入来安装它(只有第一次)。

ssc install outreg2

Example1:

stata code:

cd E:\stata\results

use "E:\stata\data\盈余管理新版.dta", clear

reg dacc rid tm size debt14 eps, robust

outreg2 using 计量经济学服务中心.doc, replace ctitle(Model 1)

结果输出为:

You can add other model (using variable x2) by using the option append

Example2:

stata code:

use "E:\stata\data\盈余管理新版.dta", clear

reg dacc rid tm size debt14 , robust

outreg2 using 计量经济学服务中心.doc, append ctitle(Model 1 Model 2)

结果输出为:

Showing variable labels

The command outreg2 gives you the type of presentation you see in academic papers. It is important to notice that outreg2 is not a Stata command, it is a user-written procedure, and you need to install it by typing (only the first time)

Example3:

stata code:

use "E:\stata\data\盈余管理新版.dta", clear

reg dacc rid tm size debt14 , robust

outreg2 using 计量经济学服务中心.doc, replace ctitle(Model 1) label

结果输出为:

Fixed effects regression

Example4:

stata code:

use "E:\stata\data\FDI.dta", clear

xtreg lngdp lnfdi lnie lnex lnim  lnci lngp,fe robust   //固定效应估计

outreg2 using 计量经济学服务中心.doc, replace ctitle(Fixed Effects) addtext(Country FE, YES)

结果输出为:

Comparing different linear models

Fixed effects with time fixed effects

Example5:

stata code:

use "E:\stata\data\FDI.dta", clear

xtreg lngdp lnfdi lnie lnex lnim  lnci lngp,re

est store re

xtreg lngdp lnfdi lnie lnex lnim  lnci lngp,fe

est store fe

hausman fe re

est table re fe, b(%6.3f) star(0.1 0.05 0.01)

outreg2 [fe re] using daqinxueshu.doc,stats(coef,tstat) addstat(Ajusted R2,`e(r2_a)') replace

结果输出为:

Summary statistics

Using outreg2 for summary statistics: all variables in dataset

Example6:

stata code:

cd E:\stata\results

sysuse auto, clear

outreg2 using 计量经济学服务中心.doc, replace sum(log)

Using outreg2 for summary statistics: selected variables

stata code:

cd E:\stata\results

sysuse auto, clear

outreg2 using 计量经济学服务中心.doc, replace sum(log) keep(price mpg turn)

Using outreg2 for summary statistics: selected variables in dataset and selected statistics

stata code:

sysuse auto, clear

outreg2 using 计量经济学服务中心.doc, replace sum(log) keep(price mpg turn) eqkeep(N mean)

Using outreg2 for summary statistics: selected variables in dataset and detail statistics

stata code:

sysuse auto, clear

set more off

outreg2 using 计量经济学服务中心.doc,  replace sum(detail) keep(price mpg turn)

7、logout

本文为大家介绍命令如下:

ssc install logout

方法1安装外部命令,另外一种方法为:findit logout

描述性分析-

描述性统计通常对收集来的数据进行直接的频率、频数等描述,描述性统计分析一般对样本的最小值、最大值、平均值、标准偏差等进行分析,这些数据有助于了解样本数据特征,能够清晰的看到各个统计量的分布情况。

程序如下:

sysuse auto.dta,clear

logout, save(logout-basic1) word excel replace: sum price mpg rep78 headroom

输出结果如下:

相关分析-

相关关系中的重要方法——相关分析,可以研究变量之间关联程度和密切程度,而变量之间的关联程度可以用相关系数表示。

logout, save(correlate) word excel replace: pwcorr price mpg rep78 headroom, sig

logout,save(corr2) word excel replace: pwcorr  price mpg rep78 headroom

回归分析结果

use "E:\stata\data\盈余管理新版.dta", clearreg dacc rid tmest store dareg dacc rid tm sizeest store qinreg dacc rid tm size debt14 epsest store daqinxueshulogout, save(计量经济学服务中心) word excel dec(3) replace:   ///          esttab da qin daqinxueshu, mtitle(模型   daqinxueshu deng) ///          b(%6.3f) se(%6.2f)                  /// //系数、标准误         star(* 0.1 ** 0.05 *** 0.01)        /// //显著水平的标注      scalar(r2 r2_a N F) compress nogap  

结果为:

·

·

·

五年,计量经济学服务中心,专业的计量服务平台

l 计量经济学服务中心 l

计量经济学服务中心,一个专注计量经济学的专业计量服务平台。中心专注于计量经济学及Eviews、Stata、SPSS、Matlab、Geoda、Python、ArcGIS、R等相关方法及软件操作,旨在为大家分享经管人文社科等领域的相关知识,希望能帮助大家更好的学习计量。转载请后台留言联系。

软件操作:Geoda | Matlab  | ArcGIS  | Python经典书单 | Eviews9.0简介  | Stata 16

| SPSS常见数据分析方法比较汇总 |

一文读懂:内生性专题(上) | 内生性专题(中) | 面板数据 | 数据管理  | 门限回归 |格兰杰因果检验 | 空间计量命令

面板数据:短面板 | 长面板  | 面板向量自回归 | 实证方法 | 方法汇总  | 主要命令 | 面板泊松模型 | 面板随机前沿模型 | 面板离散选择模型  | 面板工具变量法 | 面板负二项模型| 面板Tobit模型

横截面计量:回归分析 | 武功秘籍  |异方差自相关与多重共线性

时间序列:思维导图   | 知识汇总 | 平稳性 | 时间序列学习手册

空间计量:前世今生  | 不可不知  | 空间计量经济学分析  | 空间计量经济学:从横截面数据到空间面板

政策评估:合成控制法 | 倾向得分匹配法 | 断点回归(RD) | 双重差分

长按2秒识别二维码关注我们

欢迎把我们推荐给你的家人和朋友哟

stata 求输出相关系数矩阵命令_一文读懂结果输出命令大全(上)相关推荐

  1. stata 将数据集变量名称导出_一文读懂空间计量经济学及stata操作

    在Stata 15中,推出了最新的空间计量官方命令,均以sp开头,表示 spatial data),可以处理横截面与面板形式的空间数据.本文主要为大家介绍空间计量命令之spregress的使用. 一. ...

  2. mesh和wifi中继的区别_一文读懂:小米Wi-Fi6路由器上的Mesh到底是什么?

    ​​最近,小米第二款Wi-Fi6路由器,也就是小米路由器AX1800升级支持了Mesh技术,拥有两台以上AX1800的用户可以将它们进行Mesh组网,做到全屋信号无缝覆盖,走到哪都能享受高速Wi-Fi ...

  3. psm倾向得分匹配法举例_一文读懂倾向得分匹配法(PSM)举例及stata实现(一)

    原标题:一文读懂倾向得分匹配法(PSM)举例及stata实现(一) 一.倾向匹配得分应用之培训对工资的效应 政策背景:国家支持工作示范项目( National Supported Work,NSW ) ...

  4. python输入什么就输出什么_一文读懂Python的输入和输出

    本文介绍了Python的输入和输出,既然是Python代码,那么就一定有输出量,那么,Python是如何输出的呢? 输出 用print()在括号中加上字符串,就可以向屏幕上输出指定的文字.比如输出'h ...

  5. python读取枚举_一文读懂Python 枚举

    enum是一组绑定到唯一常数值的符号名称,并且具备可迭代性和可比较性的特性.我们可以使用 enum 创建具有良好定义的标识符,而不是直接使用魔法字符串或整数,也便于开发工程师的代码维护. 创建枚举 我 ...

  6. java中date类型如何赋值_一文读懂java中的Reference和引用类型

    简介 java中有值类型也有引用类型,引用类型一般是针对于java中对象来说的,今天介绍一下java中的引用类型.java为引用类型专门定义了一个类叫做Reference.Reference是跟jav ...

  7. gps导航原理与应用_一文读懂角速度传感器(陀螺仪)的应用场景

    前文我们大致了解陀螺仪的来历,原理和种类,那么,它与我们的日常生活有怎样的关系呢? 陀螺仪器最早是用于航海导航,但随着科学技术的发展,它在航空和航天事业中也得到广泛的应用.陀螺仪器不仅可以作为指示仪表 ...

  8. mysql 默认事务隔离级别_一文读懂MySQL的事务隔离级别及MVCC机制

    回顾前文: <一文学会MySQL的explain工具> <一文读懂MySQL的索引结构及查询优化> (同时再次强调,这几篇关于MySQL的探究都是基于5.7版本,相关总结与结论 ...

  9. ac3165 linux驱动_一文读懂Linux系统启动流程

    Linux启动管理 11.1 CentOS 6.x系统启动过程详解 CentOS 6.x系统启动过程发生了较大的变化,使用Upstart启动服务取代了原先的System V init启动服务.Upst ...

最新文章

  1. Node.js Express 框架 Express
  2. Javascript之 对象和原型
  3. hadoop3: mkdir: cannot create directory `/usr/local/hadoop/bin/../logs’: Permission denied
  4. boost::mpl模块实现copy相关的测试程序
  5. HDU - 6989 Didn‘t I Say to Make My Abilities Average in the Next Life?! 莫队/单调栈 + 线段树/ST表在线
  6. 移动端WEB开发之响应式布局(响应式开发原理、bootstrap、阿里百秀案例)
  7. TensorFlow打印一个tensor值报错
  8. [matlab]元胞数组(使用cellplot显示元胞数组)
  9. Django项目将debug模式设置为false时,静态文件出错
  10. 荣耀8 android8.0 2018,荣耀8青春版可升级Android 8.0+EMUI 8.0
  11. 小学计算机优秀说课稿ppt,【说课备考】各学科说课稿示范第7天 — 小学信息技术...
  12. java查找pdf关键字_java实现查找PDF关键字所在页码及其坐标
  13. 2021-06-16 srm平台电子化采购的优势
  14. 计算机efs加密,我的电脑文件efs加密了,现在从做系统打不开了怎么处理啊
  15. 求生之路无限火力服务器,《求生之路》终于数3了?还没开测就已经卖疯了……...
  16. 《计算机工程》从投稿到录用之一手经验
  17. Spectral clustering(谱聚类)算法的实现
  18. 华为OD机试 - 完美走位(Java JS Python)
  19. 数据结构基本概念和术语(数据、数据元素,数据对象,数据项)及举例描述
  20. nginx添加ssl证书

热门文章

  1. 20221222 Coppeliasim的视频导出功能
  2. Android根据输入法的状态隐藏和关闭输入法
  3. Python语法易混淆
  4. 电脑突然复制粘贴不了
  5. 58同城自动登录。。分享给大家
  6. 做国内最好的考勤软件,领航软件被评为2007中国软件创新100家典型企业
  7. 扇形导航 html svg
  8. linux进程间信号量
  9. Englis - 英文字母和音标
  10. 中文拼音转换成CMU的音素工具