Stata 15 新功能简介

彭华@StataCorp

2017 Stata 中国用户大会

Why Stata

"Stata is a complete, integrated statistical software package that provides everything you need for data analysis, data management, and graphics."

Stata 15 新功能

  • Extended regression models
  • Latent class analysis (LCA)
  • Bayesian prefix command
  • Linearized dynamic stochastic general equilibrium (DSGE) models
  • Dynamic Markdown documents for the web

  • Nonlinear mixed-effects models
  • Spatial autoregressive models (SAR)
  • Interval-censored parametric survival-time models
  • Finite mixture models (FMMs)
  • Mixed logit models
  • Nonparametric regression

  • Power analysis for cluster randomized designs and regression models
  • Word and PDF documents
  • Graph color transparency/opacity
  • ICD-10-CM/PCS support
  • Federal Reserve Economic Data (FRED) support

其他

  • Bayesian multilevel models
  • Threshold regression
  • Panel-data tobit with random coefficients
  • Multilevel regression for interval-measured outcomes
  • Multilevel tobit regression for censored outcomes

  • Panel data cointegration tests
  • Tests for multiple breaks in time series
  • Multiple-group generalized SEM
  • Heteroskedastic linear regression
  • Poisson models with Heckman-style sample selection

  • Panel-data nonlinear models with random coefficients
  • Bayesian panel-data models
  • Panel-data interval regression with random coefficients
  • SVG export
  • Bayesian survival models

  • Zero-inflated ordered probit
  • Add your own power and sample-size methods
  • Bayesian sample-selection models
  • Stata in Swedish
  • Improvements to the Do-file Editor

  • Stream random-number generator
  • Improvements for Java plugins
  • More parallelization in Stata/MP

新功能举例-可重复文件

减少手工编辑文件

  • 混合Stata输出与格式化文句
  • 在句子中包括Stata结果
  • 加入Stata图型
  • 部分Stata命令支持生成表格

Stata 15命令

  • dyndoc - 转换dynamic Markdown documents成网页
  • putdocx - 生成Word文件
  • putpdf - 生成PDF文件

dyndoc举例

dynamic markdown document生成a blog article

dynamic tags

dd_do - Stata命令

<<dd_do>>
sysuse auto
regress weight displacement
<</dd_do>>

. sysuse auto
(1978 Automobile Data)

. regress weight displacement

      Source |       SS           df       MS      Number of obs   =        74
-------------+----------------------------------   F(1, 72)        =    289.52
       Model |  35312313.3         1  35312313.3   Prob > F        =    0.0000
    Residual |  8781865.08        72  121970.348   R-squared       =    0.8008
-------------+----------------------------------   Adj R-squared   =    0.7981
       Total |  44094178.4        73  604029.841   Root MSE        =    349.24

------------------------------------------------------------------------------
      weight |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
displacement |   7.573261   .4450891    17.02   0.000     6.685992     8.46053
       _cons |   1525.276   96.74555    15.77   0.000     1332.417    1718.134
------------------------------------------------------------------------------

Attributes改变tag的行为

<<dd_do:quietly>>
matrix define eb = e(b)
<</dd_do>>

dd_display - Stata结果

  • displacement每增加一单位,预计weight增加<<dd_display:%9.4f eb[1,1]>>单位
  • displacement每增加一单位,预计weight增加 7.5733单位

dd_graph - Stata图型

<<dd_do:quietly>>
scatter weight displacement, mcolor(red%30)
<</dd_do>>
<<dd_graph>>

putdocx

do-file生成.docx document

  • 可具体控制文字格式
  • 灵活可调节的表格输出

Markdown表格

Stata命令生成Markdown tables

  • estimation命令使用 _coef_table
  • table
  • estimates table

dyntext

dynamic tag可用于任意文本文件,例如LaTeX

LaTeX文件

从包含dynamic tags的LaTeX文件生成.pdf file

  • sjlog (a user written command)
  • pdflatex

使用pandoc替换Stata's markdown命令

使用dynpandoc生成本次讲座的文件

Another Example

Collect results from tab to save in docx file

putpdf

do-file生成.pdf文件

谢谢