苹果6cell=3 SD-TCL2Pextsdcard是什么意思思

(中关村在线江苏行情)随着新品的上市,也同步停产,该机的走势很微妙,尤其在当前这段时间内,虽说价格没有大幅度的降价,不过涨价是不大可能了,苹果iPhone5和新上市的配置基本一致。目前该机在经销商“苏州安奇数码 ”处报价为1800元,喜欢的朋友不妨去了解一下!
  苹果 (16GB)外观上很明显的变化是屏幕升级到了4.0英寸,并且机身变得更加修长。机身正面拥有一块4英寸的IPS屏,分辨率为像素,显示效果非常清晰的。
  苹果 iPhone 5(16GB)在机身背面依然内置一枚摄像头,拍照效果出色。另外该机内置一颗主频1GHz的全新苹果A6双核处理器,同时该机的运行内存也提升至,运行iOS 6系统丝毫不成问题。
触摸屏类型
电容屏,多点触控
主屏分辨率
屏幕像素密度
视网膜Retina技术,In-Cell全贴合技术
HSPA+,(),联通2G/移动2G(GSM)
2G:GSM 850/900/3G: 850/900/MHz
WIFI,IEEE 802.11 a/n/b/g
GPS导航,GLONASS导航
连接与共享
Imagination PowerVR SGX543 MP3
不支持容量扩展
不可拆卸式电池
理论通话时间
480分钟(3G)
理论待机时间
摄像头类型
双摄像头(前后)
后置摄像头
前置摄像头
传感器类型
背照式/BSI CMOS(二代)
1080p(,30帧/秒)视频录制
HDR,全景模式,微距,滤镜,场景模式,自动对焦,数码变焦
黑配碳黑色,白配银白色
123.8x58.6x7.6mm
感应器类型
重力感应器,加速传感器,光线传感器,距离传感器,陀螺仪,电子罗盘
Nano SIM卡
3.5mm耳机接口,Lightning数据接口
支持AAC/Protected AAC/HE-AAC/MP3/MP3 VBR/Audible/Apple Lossless/AIFF/WAV等格式
支持H.264/M4V/MP4/MOV/MPEG-4/AVI等格式
支持JPEG/PNG/GIF/BMP等格式
计算器,电子词典,备忘录,日程表,记事本,电子书,闹钟,手电筒,录音机,情景模式,主题模式,地图软件
飞行模式,语音助手,名片扫描,数据备份
主机&x1具有线控功能和麦克风的 Apple EarPods&x1Lightning to USB 连接线&x1USB 电源适配器&x1资料&x1
编辑点评:在众多苹果手机中,iPhone 5手机是其中一款最出色的的手机,传闻已久的廉价发布之后,许多人失望不已,价格不廉价,改变也毫无新意,没有亮点,消费者还是觉得iPhone5更具性价比,如今已经停产,更显得珍贵。如果您喜欢这款苹果手机,可与商家联系进行详细咨询。
  [参考价格]:1800元
  [销售商家]:苏州安奇数码
  [销售电话]:
  [联系QQ ]:
  [销售地址]:苏州市沧浪区平桥直街90号
  [商城链接]:
※小编提醒:网购有风险,请尽量到实体店试机,如必须网购请大家保留好有效的交易记录、通信记录、QQ记录等,以备维护自己的权益!一旦发生纠纷请拔打投拆电话:(此电话为投诉专用,不接受产品价格等咨询,不含节假日)。
主屏尺寸 4G网络
手机论坛精选
下载中关村在线Android 客户端
下载中关村在线 iPhone 客户端
下载中关村在线Windows8客户端
成为中关村在线微信好友
4¥14995¥60886¥19997¥38008¥29999¥219910¥1699雪茄细烟什么意思,vf3l5ohoamycsw8gm2frw7dv66w83legakdhlv3sstzt7ddz3rtt85qmoq2tpu4dcz9jd2dxfmvjlfcwr6p6ug==
风湿骨刺丹
直邮,85后妈妈 宁妈海淘,着其他女人。”
<a href=".cn/daigouZamenoys/760.html" title="<div cla,日本二手渔具店,
“哎呀,你就亲人家一口嘛!让人家等
<a href=".cn/daigouZamenoys/793.html" title="日本二手店代购的手表是真是假,亚马逊日本 英文网站,向您QQ群和微博里的朋友推荐哦!日本二手店代购的手表是真是假,亚马逊日本 英文网站,向您QQ群和微博里的朋友推荐哦!</ce
友情链接:estout - Making Regression Tables in Stata
Advanced Examples
Coefficients/equations
Exponentiated coefficients (odds ratio, hazard ratio)
To report exponentiated coefficients (aka odds ratio in logistic
regression, harzard ratio in the Cox model, incidence rate ratio, relative risk ratio),
option. Example:
. sysuse auto
(1978 Automobile Data)
. eststo: quietly logit foreign mpg
(est1 stored)
. eststo: quietly logit foreign mpg weight
(est2 stored)
. esttab, eform
--------------------------------------------
--------------------------------------------
--------------------------------------------
--------------------------------------------
Expone t statistics in parentheses
* p&0.05, ** p&0.01, *** p&0.001
. eststo clear
Note that eform also transforms the standard errors (and confidence intervals),
as is illustrated bellow:
. sysuse auto
(1978 Automobile Data)
. quietly logit foreign mpg weight
. eststo raw
. eststo or
. esttab raw or, se mtitles eform(0 1)
--------------------------------------------
--------------------------------------------
-0.00391***
--------------------------------------------
--------------------------------------------
Standard errors in parentheses
* p&0.05, ** p&0.01, *** p&0.001
. eststo clear
The example also illustrates that, optionally, eform can be applied to selected
models only. If you are interested in applying other transformations, see estout's
Marginal effects
Since Stata 11,
is the preferred command to compute marginal effects
(). However, esttab and estout
also support Stata's old
command for calculating marginal effects and elasticities. To make
mfx's results available for tabulation it is essential that the model is
stored after applying mfx. In esttab or estout then
option to display the marginal effects. Example:
. sysuse auto
(1978 Automobile Data)
. generate reprec = (rep78 & 3) if rep78&.
(5 missing values generated)
. eststo raw: logit foreign mpg reprec
Iteration 0:
log likelihood = -42.400729
Iteration 1:
log likelihood = -28.036843
Iteration 2:
log likelihood = -27.117187
Iteration 3:
log likelihood =
Iteration 4:
log likelihood =
Logistic regression
Number of obs
LR chi2(2)
Prob & chi2
Log likelihood =
------------------------------------------------------------------------------
[95% Conf. Interval]
-------------+----------------------------------------------------------------
------------------------------------------------------------------------------
. eststo mfx: mfx
Marginal effects after logit
= Pr(foreign) (predict)
------------------------------------------------------------------------------
variable |
---------+--------------------------------------------------------------------
------------------------------------------------------------------------------
(*) dy/dx is for discrete change of dummy variable from 0 to 1
. esttab, se margin mtitles
--------------------------------------------
--------------------------------------------
reprec (d)
--------------------------------------------
--------------------------------------------
M Standard errors in parentheses
(d) for discrete change of dummy variable from 0 to 1
* p&0.05, ** p&0.01, *** p&0.001
. eststo clear
Multiple-equation models
The default in esttab or estout is to arrange the different equations of
multiple-equation models in vertical order, as in:
. sysuse auto
(1978 Automobile Data)
. quietly heckman price weight, select(foreign = weight mpg) twostep
. esttab, wide
-----------------------------------------
-----------------------------------------
-5925.0***
-----------------------------------------
-0.00234***
-----------------------------------------
-----------------------------------------
-----------------------------------------
t statistics in parentheses
* p&0.05, ** p&0.01, *** p&0.001
However, for models such as
it is sometimes sensible to arrange the
equations horizontally, which can be achieved through the use of the
option. Example:
. sysuse auto
(1978 Automobile Data)
. sureg (price foreign weight length) (mpg displ = foreign weight)
Seemingly unrelated regression
----------------------------------------------------------------------
----------------------------------------------------------------------
displacement
----------------------------------------------------------------------
------------------------------------------------------------------------------
[95% Conf. Interval]
-------------+----------------------------------------------------------------
-------------+----------------------------------------------------------------
-------------+----------------------------------------------------------------
displacement |
------------------------------------------------------------------------------
. esttab, unstack scalars(r2 chi2 p) noobs nomtitle
------------------------------------------------------------
displacement
------------------------------------------------------------
-0.00659***
------------------------------------------------------------
------------------------------------------------------------
t statistics in parentheses
* p&0.05, ** p&0.01, *** p&0.001
Table of effects signs, significance stars, or "significant signs"
Tables containing the signs of the coefficients,
"significance stars", or "significant signs" (i.e.
the signs of the coefficient where each sing is repeated according to
significance level) can be produced as follows:
. sysuse auto
(1978 Automobile Data)
. eststo: regress price mpg foreign
Number of obs
-------------+----------------------------------
Residual |
-------------+----------------------------------
Adj R-squared
------------------------------------------------------------------------------
[95% Conf. Interval]
-------------+----------------------------------------------------------------
------------------------------------------------------------------------------
(est1 stored)
. eststo: regress price mpg foreign weight
Number of obs
-------------+----------------------------------
Residual |
-------------+----------------------------------
Adj R-squared
------------------------------------------------------------------------------
[95% Conf. Interval]
-------------+----------------------------------------------------------------
------------------------------------------------------------------------------
(est2 stored)
. esttab, cells(_sign) nogap
--------------------------------------
--------------------------------------
--------------------------------------
--------------------------------------
. esttab, cells(_star) nogap ///
starlevels(n.s. 1 * 0.05 ** 0.01)
--------------------------------------
--------------------------------------
--------------------------------------
--------------------------------------
. esttab, cells(_sigsign) nogap ///
starlevels("+/-" 1 "++/--" 0.05 "+++/---" 0.01)
--------------------------------------
--------------------------------------
--------------------------------------
--------------------------------------
. eststo clear
Add a hypotheses column
option to add a column indicating the expected
directions of effects according to theory:
. sysuse auto
(1978 Automobile Data)
. quietly regress price mpg foreign weight displ
. esttab, labcol2(+ ? + -, title("" Hypothesis))
-----------------------------------------
Hypothesis
-----------------------------------------
displacement
-----------------------------------------
-----------------------------------------
t statistics in parentheses
* p&0.05, ** p&0.01, *** p&0.001
Indicate whether groups of control variables are in the model or not
To save space full output is sometimes suppressed for certain control variables
and it is only indicated whether the model contains the variables or not.
supports the construction of such tables:
. sysuse auto
(1978 Automobile Data)
. eststo: quietly regress price mpg foreign
(est1 stored)
. eststo: xi: quietly regress price mpg foreign i.rep78
_Irep78_1-5
( _Irep78_1 omitted)
(est2 stored)
. esttab, indicate(rep dummies = _Irep78*)
--------------------------------------------
--------------------------------------------
11905.4***
10856.2***
rep dummies
--------------------------------------------
--------------------------------------------
t statistics in parentheses
* p&0.05, ** p&0.01, *** p&0.001
. eststo clear
indicate() prints its information at the bottom of the
main body of the table containing the coefficients.
If you want to include the information in the table footer, then use
the following approach:
. sysuse auto
(1978 Automobile Data)
. eststo: quietly regress price mpg foreign
(est1 stored)
. estadd local hasrep "No"
added macro:
e(hasrep) : "No"
. eststo: xi: quietly regress price mpg foreign i.rep78
_Irep78_1-5
( _Irep78_1 omitted)
(est2 stored)
. estadd local hasrep "Yes"
added macro:
e(hasrep) : "Yes"
. esttab, drop(_Irep78*) scalars("hasrep rep dummies")
--------------------------------------------
--------------------------------------------
11905.4***
10856.2***
--------------------------------------------
rep dummies
--------------------------------------------
t statistics in parentheses
* p&0.05, ** p&0.01, *** p&0.001
. eststo clear
Display reference category information
add a table row containing the (omitted) reference category of a categorical
variable. Example:
. sysuse cancer
(Patient Survival in Drug Trial)
. stset studytime, failure(died)
failure event:
died != 0 & died & .
obs. time interval:
(0, studytime]
exit on or before:
------------------------------------------------------------------------------
total observations
exclusions
------------------------------------------------------------------------------
observations remaining, representing
failures in single-record/single-failure data
total analysis time at risk and under observation
at risk from t =
earliest observed entry t =
last observed exit t =
. xi: stcox age i.drug, nolog
_Idrug_1-3
( _Idrug_1 omitted)
failure _d:
analysis time _t:
Cox regression -- Breslow method for ties
No. of subjects =
Number of obs
No. of failures =
Time at risk
LR chi2(3)
Log likelihood
-81.652567
Prob & chi2
------------------------------------------------------------------------------
_t | Haz. Ratio
[95% Conf. Interval]
-------------+----------------------------------------------------------------
_Idrug_2 |
_Idrug_3 |
------------------------------------------------------------------------------
. lab var _Idrug_2 "Tadalafil"
. lab var _Idrug_3 "Sildenafil"
. esttab, eform wide label nostar refcat(_Idrug_2 "Placebo")
----------------------------------------------
analysis t~s
----------------------------------------------
Patient's age at s..
Sildenafil
----------------------------------------------
Observations
----------------------------------------------
Expone t statistics in parentheses
. esttab, eform wide label nostar refcat(_Idrug_2 "Placebo", label(1))
----------------------------------------------
analysis t~s
----------------------------------------------
Patient's age at s..
Sildenafil
----------------------------------------------
Observations
----------------------------------------------
Expone t statistics in parentheses
Adding extra rows using the refcat() option
option is designed
to include information on the (omitted) reference category of a categorical
variable (see ), but it can also be used
to include extra rows in the table containing subtitles or other information.
. sysuse auto
(1978 Automobile Data)
. regress price weight mpg turn foreign
Number of obs
-------------+----------------------------------
Residual |
-------------+----------------------------------
Adj R-squared
------------------------------------------------------------------------------
[95% Conf. Interval]
-------------+----------------------------------------------------------------
------------------------------------------------------------------------------
. foreach v of varlist weight mpg turn foreign {
label variable `v' `"- `: variable label `v''"'
. esttab, refcat(weight "Main effects:" turn "Controls:", nolabel) wide label
-------------------------------------------------
-------------------------------------------------
Main effects:
- Weight (lbs.)
- Mileage (mpg)
- Turn Circle (ft.)
- Car type
-------------------------------------------------
Observations
-------------------------------------------------
t statistics in parentheses
* p&0.05, ** p&0.01, *** p&0.001
Match coefficients across models
Rename coefficients using the
option before matching the models and equations to merge different coefficients into
the same table row. Example:
. sysuse auto
(1978 Automobile Data)
. set seed 123
. generate altmpg = invnorm(uniform())
. eststo: quietly regress price weight mpg
(est1 stored)
. eststo: quietly regress price weight altmpg
(est2 stored)
--------------------------------------------
--------------------------------------------
--------------------------------------------
--------------------------------------------
t statistics in parentheses
* p&0.05, ** p&0.01, *** p&0.001
. esttab, rename(altmpg mpg)
--------------------------------------------
--------------------------------------------
--------------------------------------------
--------------------------------------------
t statistics in parentheses
* p&0.05, ** p&0.01, *** p&0.001
. eststo clear
Model summary statistics
Display summary statistics only (suppress coefficients)
If you want to produce a table that only contains the summary statistics of the models,
but no coefficients, add
to the command:
. sysuse auto
(1978 Automobile Data)
. eststo: quietly regress price weight mpg
(est1 stored)
. eststo: quietly regress price weight mpg foreign
(est2 stored)
. esttab, cells(none) scalars(rank r2 r2_a bic aic) nomtitles
--------------------------------------
--------------------------------------
--------------------------------------
. eststo clear
Adding likelihood-ratio test statistics
The estadd's
subcommand may be used to add results from likelihood-ratio tests as follows:
. sysuse auto
(1978 Automobile Data)
. eststo A: quietly logit foreign weight
. eststo B: quietly logit foreign weight mpg price
. estadd lrtest A
Likelihood-ratio test
LR chi2(2)
(Assumption: A nested in .)
Prob & chi2 =
added scalars:
e(lrtest_p) =
e(lrtest_chi2) =
e(lrtest_df) =
. esttab, scalars(lrtest_chi2 lrtest_df lrtest_p)
--------------------------------------------
--------------------------------------------
-0.00259***
-0.00685***
0.000926**
--------------------------------------------
lrtest_chi2
--------------------------------------------
t statistics in parentheses
* p&0.05, ** p&0.01, *** p&0.001
. eststo clear
Rearranging the summary statistics in the table footer
The default in estout and esttab is to
print the scalar summary statistics in the table footer in separate rows beneath
one another (in each model's first column). Use the
to rearrange the statistics. The option allows you to place
the statistics in separate columns beside one another or also
to combine multiple statistics in one table cell (see ).
Here is an example:
. sysuse auto
(1978 Automobile Data)
. eststo: quietly regress price weight
(est1 stored)
. eststo: quietly regress price weight foreign
(est2 stored)
. esttab, p wide nopar label
stats(F p N, layout("@ @" @) fmt(a3 3 a3) ///
labels("F statistic" "Observations"))
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Weight (lbs.)
-4942.8***
------------------------------------------------------------------------------
F statistic
Observations
------------------------------------------------------------------------------
p-values in second column
* p&0.05, ** p&0.01, *** p&0.001
. eststo clear
In the layout() suboption, the "@" character is used as a placeholder
for the statistics, one after another. Statistics to be printed in the same row
have to be enclosed in quotes.
Combining multiple summary statistics in one cell
The syntax for combining multiple summary statistics in one table cell
is a bit clumsy, as is illustrated in the following example.
The cell definition has to be enclosed in double quotes in the example
because it contains a blank, and a set of
compound double quotes is needed to mark off the row definition.
. sysuse auto
(1978 Automobile Data)
. eststo: quietly logit foreign weight mpg
(est1 stored)
. eststo: quietly logit foreign weight mpg turn displ
(est2 stored)
. esttab, stats(chi2 df_m r2_p N, layout(`""@ (@)""' @ @))
--------------------------------------------
--------------------------------------------
-0.00391***
displacement
--------------------------------------------
chi2 (df_m)
--------------------------------------------
t statistics in parentheses
* p&0.05, ** p&0.01, *** p&0.001
. eststo clear
Note that in this example the layout definition could be simplified to layout(`""@ (@)""')
without changing the result.
Specific models
Tabulate results from factor
The factor command does not return e(b) and e(V), which makes
tabulation less obvious. For example, the factor loadings are returned in matrix e(L)
and the unique variances are returned in e(Psi):
. webuse bg2
(Physician-cost data)
. factor bg2cost1-bg2cost6
Factor analysis/correlation
Number of obs
Method: principal factors
Retained factors =
Rotation: (unrotated)
Number of params =
--------------------------------------------------------------------------
Eigenvalue
Difference
Proportion
Cumulative
-------------+------------------------------------------------------------
--------------------------------------------------------------------------
LR test: independent vs. saturated:
chi2(15) =
269.07 Prob&chi2 = 0.0000
Factor loadings (pattern matrix) and unique variances
-----------------------------------------------------------
Variable |
Uniqueness
-------------+------------------------------+--------------
bg2cost1 |
bg2cost2 |
bg2cost3 |
bg2cost4 |
bg2cost5 |
bg2cost6 |
-----------------------------------------------------------
. ereturn list
e(chi2_i) =
e(evsum) =
e(cmdline) : "factor bg2cost1-bg2cost6"
e(cmd) : "factor"
e(marginsnotok) : "_ALL"
e(properties) : "nob noV eigen"
e(title) : "Factor analysis"
e(predict) : "factor_p"
e(estat_cmd) : "factor_estat"
e(rotate_cmd) : "factor_rotate"
e(rngstate) : "Xf7c401ea8f6684aaee21b8f"
e(mtitle) : "principal factors"
e(method) : "pf"
e(means) :
functions:
. matrix list e(L)
. matrix list e(Psi)
e(Psi)[1,6]
Uniqueness
The simplest way to tabulate the factor loadings is to type:
. esttab e(L)
---------------------------------------------------
---------------------------------------------------
---------------------------------------------------
Reproducing the factor loadings table including the unique variances is more involved. The
single factors in e(L) have to be addressed individually. For example, type:
. esttab, ///
cells("L[1](transpose) L[2](transpose) L[3](transpose) Psi") ///
nogap noobs nonumber nomtitle
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
The transpose suboption is required since the factors are in the columns
of e(L) and, by default, e()-matrices are read row-wise
(transpose can be abbreviated to t). Hence,
L[#](transpose) refers to the #th column of e(L).
The label() suboption can be used to add labels, for example:
. esttab, ///
cells("L[1](t label(Factor 1)) L[2](t) L[3](t) Psi") ///
nogap noobs nonumber nomtitle
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
Alternatively, you can also use syntax el[name], where
name refers to the name of the row to be tabulated (or column if
transpose is specified) and also sets the label:
. esttab, ///
cells("L[Factor1](t) L[Factor2](t) L[Factor3](t) Psi[Uniqueness]") ///
nogap noobs nonumber nomtitle
----------------------------------------------------------------
Uniqueness
----------------------------------------------------------------
----------------------------------------------------------------
Clean out table after ologit or oprobit
look somewhat complicated in
Stata 9 or newer since each cutoff is stored in its own equation. To clean out
the table, specify :
. sysuse auto
(1978 Automobile Data)
. ologit rep mpg foreign
Iteration 0:
log likelihood = -93.692061
Iteration 1:
log likelihood = -78.844995
Iteration 2:
log likelihood = -78.106784
Iteration 3:
log likelihood =
Iteration 4:
log likelihood = -78.089242
Ordered logistic regression
Number of obs
LR chi2(2)
Prob & chi2
Log likelihood = -78.089242
------------------------------------------------------------------------------
[95% Conf. Interval]
-------------+----------------------------------------------------------------
-------------+----------------------------------------------------------------
------------------------------------------------------------------------------
. esttab, wide
-----------------------------------------
-----------------------------------------
-----------------------------------------
-----------------------------------------
-----------------------------------------
-----------------------------------------
-----------------------------------------
-----------------------------------------
t statistics in parentheses
* p&0.05, ** p&0.01, *** p&0.001
. esttab, wide eqlabels(none)
-----------------------------------------
-----------------------------------------
-----------------------------------------
-----------------------------------------
t statistics in parentheses
* p&0.05, ** p&0.01, *** p&0.001
To print a line between the main part of the table and the cutoffs, type:
. esttab, wide eqlabels(none) ///
varlabels(,blist(cut1:_cons "{hline @width}{break}"))
-----------------------------------------
-----------------------------------------
-----------------------------------------
-----------------------------------------
-----------------------------------------
t statistics in parentheses
* p&0.05, ** p&0.01, *** p&0.001
Furthermore, to suppress significance stars and standard errors for the cutoffs, type:
. esttab, cells("b(fmt(a3) star) se(drop(cut*:))")
stardrop(cut*:) eqlabels(none)
varlabels(,blist(cut1:_cons "{hline @width}{break}"))
-----------------------------------------
-----------------------------------------
-----------------------------------------
-----------------------------------------
-----------------------------------------
Marginal effects for all outcomes after mlogit
To tabulate the marginal effects for all outcomes after
it is necessary to store several sets of results from margins. Example:
. sysuse auto
(1978 Automobile Data)
. replace price = price / 1000
variable price was int now float
(74 real changes made)
. replace weight = weight / 1000
variable weight was int now float
(74 real changes made)
. quietly mlogit rep78 price mpg foreign if rep78&=3, nolog
. eststo mlogit
. foreach o in 3 4 5 {
quietly margins, dydx(*) predict(outcome(`o')) post
eststo, title(Outcome `o')
estimates restore mlogit
(est2 stored)
(results mlogit are active now)
(est3 stored)
(results mlogit are active now)
(est4 stored)
(results mlogit are active now)
. eststo drop mlogit
(mlogit dropped)
. esttab, noobs se nostar mtitles nonumbers title(Average Marginal Effects)
Average Marginal Effects
---------------------------------------------------
---------------------------------------------------
---------------------------------------------------
Standard errors in parentheses
. eststo clear
Transforming random-effects parameters of an xtmixed model
Variance parameters are returned by
as logarithms of
standard deviations in e(b).
To tabulate the parameters as standard deviations, back-transform
them using the
option. Example:
. webuse pig
(Longitudinal analysis of pig weights)
. xtmixed weight week || id: week
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0:
log restricted-likelihood = -870.51473
Iteration 1:
log restricted-likelihood = -870.51473
Computing standard errors:
Mixed-effects REML regression
Number of obs
Group variable: id
Number of groups
Obs per group:
Wald chi2(1)
Log restricted-likelihood = -870.51473
Prob & chi2
------------------------------------------------------------------------------
[95% Conf. Interval]
-------------+----------------------------------------------------------------
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters
[95% Conf. Interval]
-----------------------------+------------------------------------------------
id: Independent
sd(week) |
sd(_cons) |
-----------------------------+------------------------------------------------
sd(Residual) |
------------------------------------------------------------------------------
LR test vs. linear model: chi2(2) = 765.92
Prob & chi2 = 0.0000
Note: LR test is conservative and provided only for reference.
. esttab, se wide nostar transform(ln*: exp(@) exp(@))
--------------------------------------
--------------------------------------
--------------------------------------
--------------------------------------
--------------------------------------
--------------------------------------
--------------------------------------
Standard errors in parentheses
. esttab, se wide nostar transform(ln*: exp(@) exp(@))
eqlabels("" "sd(week)" "sd(_cons)" "sd(Residual)", none) ///
varlabels(,elist(weight:_cons "{break}{hline @width}"))
varwidth(13)
---------------------------------------
---------------------------------------
---------------------------------------
sd(Residual)
---------------------------------------
---------------------------------------
Standard errors in parentheses
(Note that in transform() you also have to include
the function's first derivative, which is required for the standard errors.
The example above might be confusing because the first derivative of exp(x)
is simply exp(x). See below for examples where the two differ.)
Similarly, to display the parameters as variances, type:
. xtmixed, variance
Mixed-effects REML regression
Number of obs
Group variable: id
Number of groups
Obs per group:
Wald chi2(1)
Log restricted-likelihood = -870.51473
Prob & chi2
------------------------------------------------------------------------------
[95% Conf. Interval]
-------------+----------------------------------------------------------------
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters
[95% Conf. Interval]
-----------------------------+------------------------------------------------
id: Independent
var(week) |
var(_cons) |
-----------------------------+------------------------------------------------
var(Residual) |
------------------------------------------------------------------------------
LR test vs. linear model: chi2(2) = 765.92
Prob & chi2 = 0.0000
Note: LR test is conservative and provided only for reference.
. esttab, se wide nostar transform(ln*: exp(2*@) 2*exp(2*@))
eqlabels("" "var(week)" "var(_cons)" "var(Residual)", none) ///
varlabels(,elist(weight:_cons "{break}{hline @width}")) ///
varwidth(13)
---------------------------------------
---------------------------------------
---------------------------------------
var(_cons)
var(Residual)
---------------------------------------
---------------------------------------
Standard errors in parentheses
If the model also has covariance terms, these are returned as
arc-hyperbolic tangents of correlations in e(b) and can be back-transformed
to correlations using Stata's tanh() function. Example:
. xtmixed weight week || id: week, covariance(unstructured)
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0:
log restricted-likelihood = -870.43562
Iteration 1:
log restricted-likelihood = -870.43562
Computing standard errors:
Mixed-effects REML regression
Number of obs
Group variable: id
Number of groups
Obs per group:
Wald chi2(1)
Log restricted-likelihood = -870.43562
Prob & chi2
------------------------------------------------------------------------------
[95% Conf. Interval]
-------------+----------------------------------------------------------------
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters
[95% Conf. Interval]
-----------------------------+------------------------------------------------
id: Unstructured
sd(week) |
sd(_cons) |
corr(week,_cons) |
-----------------------------+------------------------------------------------
sd(Residual) |
------------------------------------------------------------------------------
LR test vs. linear model: chi2(3) = 766.07
Prob & chi2 = 0.0000
Note: LR test is conservative and provided only for reference.
. esttab, se wide nostar ///
transform(ln*: exp(@) exp(@) at*: tanh(@) (1-tanh(@)^2)) ///
eqlabels("" "sd(week)" "sd(_cons)" "corr(week,_cons)" "sd(Residual)", ///
varlabels(,elist(weight:_cons "{break}{hline @width}"))
varwidth(16)
------------------------------------------
------------------------------------------
------------------------------------------
corr(week,_cons)
sd(Residual)
------------------------------------------
------------------------------------------
Standard errors in parentheses
Unfortunately, it is not possible for transform() to turn such correlations
into covariances (requires multiplication by the standard deviations). However, you can
use estadd to manually compute the terms in advance and add them in the footer
of the table. Example:
. xtmixed, variance
Mixed-effects REML regression
Number of obs
Group variable: id
Number of groups
Obs per group:
Wald chi2(1)
Log restricted-likelihood = -870.43562
Prob & chi2
------------------------------------------------------------------------------
[95% Conf. Interval]
-------------+----------------------------------------------------------------
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters
[95% Conf. Interval]
-----------------------------+------------------------------------------------
id: Unstructured
var(week) |
var(_cons) |
cov(week,_cons) |
-----------------------------+------------------------------------------------
var(Residual) |
------------------------------------------------------------------------------
LR test vs. linear model: chi2(3) = 766.07
Prob & chi2 = 0.0000
Note: LR test is conservative and provided only for reference.
. mat list e(b)
atr1_1_1_2:
. estadd scalar v1
= exp(2*[lns1_1_1]_b[_cons])
added scalar:
. estadd scalar v2
= exp(2*[lns1_1_2]_b[_cons])
added scalar:
. estadd scalar cov = tanh([atr1_1_1_2]_b[_cons]) ///
* exp([lns1_1_1]_b[_cons])
* exp([lns1_1_2]_b[_cons])
added scalar:
. estadd scalar v_e = exp(2*[lnsig_e]_b[_cons])
added scalar:
. esttab, se wide nostar keep(weight:) obslast
scalars("v1 var(week)" "v2 var(_cons)"
"cov cov(week,_cons)" "v_e var(Residual)") ///
eqlabels(none) varwidth(15)
-----------------------------------------
-----------------------------------------
-----------------------------------------
var(_cons)
cov(week,_cons)
var(Residual)
-----------------------------------------
Standard errors in parentheses
Advanced LaTeX example: Arrange models in groups
. sysuse auto
(1978 Automobile Data)
. eststo: quietly reg weight mpg
(est1 stored)
. eststo: quietly reg weight mpg foreign
(est2 stored)
. eststo: quietly reg price weight mpg
(est3 stored)
. eststo: quietly reg price weight mpg foreign
(est4 stored)
. esttab using example.tex, booktabs label
mgroups(A B, pattern(1 0 1 0)
prefix(\multicolumn{@span}{c}{) suffix(})
span erepeat(\cmidrule(lr){@span}))
alignment(D{.}{.}{-1}) page(dcolumn) nonumber
(output written to example.tex)
. eststo clear
Descriptive tables
Table of descriptives
[ supersedes this example.
under "".]
Research papers usually contain a table displaying the descriptive
statistics for all variables in the analysis. The following
example illustrates how such a table can be produced using
and esttab.
Assume, your analysis uses
price as the dependent variable and weight, mpg,
and foreign as independent variables. To create a descriptives table
including all four variables, type:
. sysuse auto
(1978 Automobile Data)
. generate y = uniform()
. quietly regress y price weight mpg foreign, noconstant
. estadd summ
added matrices:
. esttab, cells("mean sd min max") nogap nomtitle nonumber
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
The trick is to generate a fake variable and regress it
on all involved variables, including the dependent variable.
Table of descriptives by subgroups
[ supersedes this example.
under "".]
A table of descriptive statistics by subgroups can easily be produced using by and
. sysuse auto
(1978 Automobile Data)
. generate y = uniform()
. by foreign: eststo: quietly regress y price weight mpg, nocons
-------------------------------------------------------------------------------
-& Domestic
(est1 stored)
-------------------------------------------------------------------------------
-& Foreign
(est2 stored)
. estadd summ : *
. esttab, main(mean) aux(sd) label nodepvar nostar nonote
----------------------------------------------
----------------------------------------------
Weight (lbs.)
Mileage (mpg)
----------------------------------------------
Observations
----------------------------------------------
. eststo clear
Tabulating results from t-Tests
[ supersedes this example.
under "".]
Basically anything can be tabulated by estout or esttab
once it is posted in e(). Here is an example with t-tests:
. capt prog drop myttests
. *! version 1.0.0
. program myttests, eclass
syntax varlist [if] [in], by(varname) [ * ]
marksample touse
markout `touse' `by'
tempname mu_1 mu_2 d d_se d_t d_p
foreach var of local varlist {
qui ttest `var' if `touse', by(`by') `options'
mat `mu_1' = nullmat(`mu_1'), r(mu_1)
mat `mu_2' = nullmat(`mu_2'), r(mu_2)
= nullmat(`d'
), r(mu_1)-r(mu_2)
mat `d_se' = nullmat(`d_se'), r(se)
= nullmat(`d_t' ), r(t)
= nullmat(`d_p' ), r(p)
foreach mat in mu_1 mu_2 d d_se d_t d_p {
mat coln ``mat'' = `varlist'
tempname b V
mat `b' = `mu_1'*0
mat `V' = `b''*`b'
eret post `b' `V'
eret local cmd "myttests"
foreach mat in mu_1 mu_2 d d_se d_t d_p {
eret mat `mat' = ``mat''
. sysuse auto
(1978 Automobile Data)
. myttests price weight mpg, by(foreign)
. ereturn list
e(cmd) : "myttests"
e(properties) : "b V"
. esttab, nomtitle nonumbers noobs ///
cells("mu_1(fmt(a3)) mu_2 d(star pvalue(d_p))" ". . d_se(par)")
------------------------------------------------------
------------------------------------------------------
------------------------------------------------------
(An alternative approach would be to save three sets of estimates, one
for each group, and one for the differences.)
Frequency tables
[ supersedes this example.
under "".]
With a little programming you could even do frequency tables in estout. Here
is an example for a one-way table:
. capt prog drop e_tabulate
. *! version 1.0.0
. prog e_tabulate, eclass
version 8.2
syntax varname(numeric) [if] [in] [fw aw iw] [, noTOTal * ]
tempname count percent vals V
tab `varlist' `if' `in' [`weight'`exp'], matcell(`count') matrow(`vals
& ') `options'
local N = r(N)
mat `count' = `count''
forv r =1/`=rowsof(`vals')' {
local value: di `vals'[`r',1]
local label: label (`varlist') `value'
local values "`values' `value'"
local labels `"`labels' `value' `"`label'"'"'
if "`total'"=="" {
mat `count' = `count', `N'
local values "`values' total"
local labels `"`labels' total `"Total"'"'
mat colname `count' = `values'
mat `percent' = `count'/`N'*100
mat `V' = `count''*`count'*0
eret post `count' `V', depname(`varlist') obs(`N')
eret local cmd "e_tabulate"
eret local depvar "`varlist'"
eret local labels `"`labels'"'
eret mat percent = `percent'
. sysuse auto
(1978 Automobile Data)
. e_tabulate foreign
Car type |
------------+-----------------------------------
Domestic |
------------+-----------------------------------
. ereturn list
e(labels) : " 0 `"Domestic"' 1 `"Foreign"' total `"Total"'"
e(depvar) : "foreign"
e(cmd) : "e_tabulate"
e(properties) : "b V"
e(percent) :
. mat list e(b)
. mat list e(percent)
e(percent)[1,3]
. esttab, cell("b percent") noobs nonumbers nomtitles ///
collabels(Freq. Percent, lhs(`:var lab `e(depvar)'')) ///
varlabels(`e(labels)', blist(total "{hline @width}{break}"))
--------------------------------------
--------------------------------------
--------------------------------------
--------------------------------------
To construct a twoway table, save the conditional distributions in the table columns
as separate estimation sets. Example:
. bys foreign: eststo: e_tabulate rep
-------------------------------------------------------------------------------
-& Domestic
Record 1978 |
------------+-----------------------------------
------------+-----------------------------------
(est1 stored)
-------------------------------------------------------------------------------
-& Foreign
Record 1978 |
------------+-----------------------------------
------------+-----------------------------------
(est2 stored)
. esttab, main(percent 2) not nostar mtitles noobs nonote
varlab(`e(labels)', blist(total "{hline @width}{break}"))
--------------------------------------
--------------------------------------
--------------------------------------
--------------------------------------
. eststo clear
Tabulating a Stata matrix
can be tabulated in
estout or esttab by typing matrix(matname)
instead of providing a list of names of stored estimation sets. Example:
. matrix A = (11,12,13)\(21,22,23)\(31,32,33)\(41,42,43)
. esttab matrix(A)
---------------------------------------------------
---------------------------------------------------
---------------------------------------------------
Numeric formats can be set by adding a fmt() suboption
in the matrix() argument. Examples:
. esttab matrix(A, fmt(1 2 3))
---------------------------------------------------
---------------------------------------------------
---------------------------------------------------
. esttab matrix(A, fmt("1 2 3 4" "4 3 2 1"))
---------------------------------------------------
---------------------------------------------------
---------------------------------------------------
Examples for tabulating a matrix that also contains equation names:
. mat rownames A = "eq1:row1" "eq1:row2" "eq2:row1" "eq2:row2"
. esttab matrix(A)
---------------------------------------------------
---------------------------------------------------
---------------------------------------------------
---------------------------------------------------
. esttab matrix(A), unstack compress
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
. set seed 123
. matrix A = matuniform(4,4)
. mat coleq A = eq1 eq1 eq2 eq2
. mat roweq A = eq1 eq1 eq2 eq2
. esttab matrix(A), eqlabels(,merge)
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
More on correlation coefficients
under "" for some basic examples on
tabulating correlation coefficients.)
Kelvin Tan asked on statalist
"I would like to know if I can stack two correlation matrix tables into
one big correlation matrix ((foreign=1) in lower diagonal and
(foreign=0) in upper diagonal of the big correlation matrix table)."
Maarten Buis suggested a solution that works for the coefficients but does not
provide significance stars or p-values
Here are some examples for combining correlation coefficients while preserving the p-values. If
you just want to stack two correlation matrices, you could code:
. eststo clear
. sysuse auto
(1978 Automobile Data)
. local vlist price mpg weight
. local rest `vlist'
. foreach v of local vlist {
estpost correlate `v' `rest' if foreign==0
foreach m in b rho p count {
matrix tmp = e(`m')
matrix coleq tmp = "foreign=0"
matrix `m' = tmp
estpost correlate `v' `rest' if foreign==1
foreach m in b rho p count {
matrix tmp = e(`m')
matrix coleq tmp = "foreign=1"
matrix `m' = `m', tmp
ereturn post b
foreach m in rho p count {
quietly estadd matrix `m' = `m'
eststo `v'
local rest: list rest - v
-------------+--------------------------------------------
mpg | -.5042629
-------------+--------------------------------------------
mpg | -.6313026
-------------+--------------------------------------------
weight | -.8759427
-------------+--------------------------------------------
-------------+--------------------------------------------
-------------+--------------------------------------------
. esttab, nonumbers mtitles noobs not
------------------------------------------------------------
------------------------------------------------------------
------------------------------------------------------------
------------------------------------------------------------
* p&0.05, ** p&0.01, *** p&0.001
The trick is to save a separate estimation set for each column of the correlation matrix and
use equation names for the two groups.
Kelvin's upper/lower triangle layout can be achieved using a similar approach:
. eststo clear
. sysuse auto
(1978 Automobile Data)
. local vlist price mpg weight
. local upper
. local lower `vlist'
. foreach v of local vlist {
estpost correlate `v' `lower' if foreign==1
foreach m in b rho p count {
matrix `m' = e(`m')
if "`upper'"!="" {
estpost correlate `v' `upper' if foreign==0
foreach m in b rho p count {
matrix `m' = e(`m'), `m'
ereturn post b
foreach m in rho p count {
quietly estadd matrix `m' = `m'
eststo `v'
local lower: list lower - v
local upper `upper' `v'
-------------+--------------------------------------------
mpg | -.6313026
-------------+--------------------------------------------
-------------+--------------------------------------------
price | -.5042629
-------------+--------------------------------------------
-------------+--------------------------------------------
mpg | -.8759427
. esttab, nonumbers mtitles noobs not
------------------------------------------------------------
------------------------------------------------------------
------------------------------------------------------------
* p&0.05, ** p&0.01, *** p&0.001
Flip models and coefficients (place models in rows instead of in columns)
esttab and estout place different models in separate columns.
Sometimes it is desirable, however, to arrange a table so that the models are
placed in separate rows. Here are two approaches to construct such a
Approach 1:
esttab and estout return a matrix r(coefs) that
contains the tabulated results. You can run esttab or estout and
then run it again in matrix mode to transpose and tabulate r(coefs).
This approach is simple but the possibilities for formatting the table
are somewhat limited. Example:
. sysuse auto
(1978 Automobile Data)
. eststo model1: quietly reg price weight
. eststo model2: quietly reg price weight mpg
. esttab, se nostar
--------------------------------------
--------------------------------------
--------------------------------------
--------------------------------------
Standard errors in parentheses
. mat list r(coefs)
r(coefs)[3,4]
-49.512221
-6.7073534
. esttab r(coefs, transpose)
---------------------------------------------------
---------------------------------------------------
---------------------------------------------------
---------------------------------------------------
. eststo clear
Approach 2:
Again run esttab or estout to compile r(coefs) but
then, for each coefficient, collect the results and post them in e()
(i.e. post one "model" per coefficient). This approach requires some
programming but gives you full flexibility. Example:
. sysuse auto
(1978 Automobile Data)
. eststo model1: quietly reg price weight
. eststo model2: quietly reg price weight mpg
. esttab, se nostar
--------------------------------------
--------------------------------------
--------------------------------------
--------------------------------------
Standard errors in parentheses
. matrix C = r(coefs)
. eststo clear
. local rnames : rownames C
. local models : coleq C
. local models : list uniq models
. local i 0
. foreach name of local rnames {
capture matrix drop b
capture matrix drop se
foreach model of local models {
matrix tmp = C[`i', 2*`j'-1]
if tmp[1,1]&. {
matrix colnames tmp = `model'
matrix b = nullmat(b), tmp
matrix tmp[1,1] = C[`i', 2*`j']
matrix se = nullmat(se), tmp
ereturn post b
quietly estadd matrix se
eststo `name'
. esttab, se mtitle noobs
------------------------------------------------------------
------------------------------------------------------------
------------------------------------------------------------
Standard errors in parentheses
* p&0.05, ** p&0.01, *** p&0.001
. eststo clear
Approach 2 with summary statistics:
. sysuse auto
(1978 Automobile Data)
. eststo model1: quietly reg price weight
. eststo model2: quietly reg price weight mpg
. esttab, se nostar r2
--------------------------------------
--------------------------------------
--------------------------------------
--------------------------------------
Standard errors in parentheses
. matrix C = r(coefs)
. matrix S = r(stats)
. eststo clear
. local rnames : rownames C
. local models : coleq C
. local models : list uniq models
. local i 0
. foreach name of local rnames {
capture matrix drop b
capture matrix drop se
foreach model of local models {
matrix tmp = C[`i', 2*`j'-1]
if tmp[1,1]&. {
matrix colnames tmp = `model'
matrix b = nullmat(b), tmp
matrix tmp[1,1] = C[`i', 2*`j']
matrix se = nullmat(se), tmp
ereturn post b
quietly estadd matrix se
eststo `name'
. local snames : rownames S
. local i 0
. foreach name of local snames {
capture matrix drop b
foreach model of local models {
matrix tmp = S[`i', `j']
matrix colnames tmp = `model'
matrix b = nullmat(b), tmp
ereturn post b
eststo `name'
. esttab, se mtitle noobs compress nonumb
---------------------------------------------------------------------------
---------------------------------------------------------------------------
---------------------------------------------------------------------------
Standard errors in parentheses
* p&0.05, ** p&0.01, *** p&0.001
. eststo clear
Tabulating results from an r-class program
Many Stata commands and user programs return results in r(). To tabulate such
results in estout or esttab you can collect them in a matrix
and tabulate the matrix (Approach 1) or post the results as one or more vectors
in e() and tabulate them from there (Approach 2). Approach 2 is more flexible
than Approach 1.
Approach 1: collect results in a matrix and tabulate the matrix
In the following example
the ineqrbd command by Carlo V. Fiorio and Stephen P. Jenkins is used (see
ineqrbd happens to return results in a series of r()-macros.
We can construct a matrix from these macros (and also compute some additional
results using the formulas provided in ineqrbd's output) and then tabulate
the matrix as follows:
. capture which ineqrbd
// check whether -ineqrbd- is installed
. if _rc ssc install ineqrbd // and get it if not
checking ineqrbd consistency and verifying not already installed...
installing into /Users/jann/Library/Application Support/Stata/Stata 14/ado/plus
installation complete.
. sysuse auto
(1978 Automobile Data)
. ineqrbd price trunk weight length foreign, noregression
Regression-based decomposition of inequality in
---------------------------------------------------------------------------
CV_f/CV(total)
---------+-----------------------------------------------------------------
residual |
---------+-----------------------------------------------------------------
---------------------------------------------------------------------------
Note: proportionate contribution of composite var f to inequality of Total,
s_f = rho_f*sd(f)/sd(Total). S_f = s_f*CV(Total).
m_f = mean(f). sd(f) = std.dev. of f. CV_f = sd(f)/m_f.
Total = price
. return list
r(sf_Z4) : ".6729"
r(cv_Z4) : "1.336"
r(sd_Z4) : "76796"
r(mean_Z4) : "63328"
r(sf_Z3) : "-.1964"
r(cv_Z3) : "-.2781"
r(sd_Z3) : "28214"
r(mean_Z3) : "-4508"
r(sf_Z2) : ".0759"
r(cv_Z2) : ".5026"
r(sd_Z2) : "95487"
r(mean_Z2) : "94493"
r(sf_Z1) : "-.882"
r(cv_Z1) : "-.2151"
r(sd_Z1) : "43.75"
r(mean_Z1) : "-141.4"
r(sf_Z0) : ".3296"
r(cv_Z0) : "3059"
r(sd_Z0) : "2313"
r(mean_Z0) : "1.e-12"
r(cv_tot) : ".0566"
r(sd_tot) : "68919"
r(mean_tot) : "56757"
r(total) : " price"
r(xvars) : "trunk weight length foreign"
r(yvar) : "price"
r(varlist) : "price trunk weight length foreign"
. // Step 1: collect results from r(sf_Z#), r(mean_Z#), and r(cv_Z#)
. local xvars "`r(xvars)'"
. local nx : list sizeof xvars
. foreach s in sf mean cv {
tempname `s'
matrix ``s'' = J(`nx'+2, 1, .z)
matrix rownames ``s'' = residual `r(xvars)' Total
forv i = 0/`nx' {
matrix ``s''[`i'+1, 1] = `r(`s'_Z`i')'
. matrix `sf'[rowsof(`sf'), 1]
. matrix `mean'[rowsof(`mean'), 1] = `r(mean_tot)'
. matrix `cv'[rowsof(`sf'), 1]
= `r(cv_tot)'
. // Step 2: build matrix that mirrors -ineqrbd-'s output
. matrix ineqrbd = ///
`sf' * 100 ,
/// column 1: 100*s_f
`sf' * `r(cv_tot)' ,
/// column 2: S_f
`mean' / `r(mean_tot)' * 100,
/// column 3: 100*m_f/m
/// column 4: CV_f
`cv' / `r(cv_tot)'
column 5: CV_f/CV(total)
. matrix colnames ineqrbd = 100*s_f S_f 100*m_f/m CV_f CV_f/CV(total)
. // Step 3: tabulate the matrix
. esttab matrix(ineqrbd)
-----------------------------------------------------------------------------
CV_f CV_f/CV(to~)
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
Approach 2: post results as vectors in e()
Instead of directly
tabulating the matrix you can post the matrix columns as vectors in e() and
then tabulate these vectors. This gives you some additional flexibility for formatting
the columns. Here is an example (Stata 9 is required):
. capture which ineqrbd
// check whether -ineqrbd- is installed
. if _rc ssc install ineqrbd // and get it if not
. sysuse auto
(1978 Automobile Data)
. ineqrbd price trunk weight length foreign, noregression
Regression-based decomposition of inequality in
---------------------------------------------------------------------------
CV_f/CV(total)
---------+-----------------------------------------------------------------
residual |
---------+-----------------------------------------------------------------
---------------------------------------------------------------------------
Note: proportionate contribution of composite var f to inequality of Total,
s_f = rho_f*sd(f)/sd(Total). S_f = s_f*CV(Total).
m_f = mean(f). sd(f) = std.dev. of f. CV_f = sd(f)/m_f.
Total = price
. // Step 1: collect results from r(sf_Z#), r(mean_Z#), and r(cv_Z#)
. local xvars "`r(xvars)'"
. local nx : list sizeof xvars
. foreach s in sf mean cv {
tempname `s'
matrix ``s'' = J(`nx'+2, 1, .z)
matrix rownames ``s'' = residual `r(xvars)' Total
forv i = 0/`nx' {
matrix ``s''[`i'+1, 1] = `r(`s'_Z`i')'
. matrix `sf'[rowsof(`sf'), 1]
. matrix `mean'[rowsof(`mean'), 1] = `r(mean_tot)'
. matrix `cv'[rowsof(`sf'), 1]
= `r(cv_tot)'
. // Step 2: build matrix that mirrors -ineqrbd-'s output
. matrix ineqrbd = ///
`sf' * 100 ,
/// column 1: 100*s_f
`sf' * `r(cv_tot)' ,
/// column 2: S_f
`mean' / `r(mean_tot)' * 100,
/// column 3: 100*m_f/m
/// column 4: CV_f
`cv' / `r(cv_tot)'
column 5: CV_f/CV(total)
. matrix colnames ineqrbd = 100*s_f S_f 100*m_f/m CV_f CV_f/CV(total)
. // Step 3: post matrix columns in e()
. ereturn post
. tempname tmp
. local i 0
. foreach col in s_f100 S_f m_f100 CV_f CV_ftot {
matrix `tmp' = ineqrbd[1...,`i']'
quietly estadd matrix `col' = `tmp'
. ereturn list
e(CV_ftot) :
e(m_f100) :
e(s_f100) :
. // Step 4: tabulate
. esttab, cell("s_f100 S_f m_f100 CV_f CV_ftot") noobs
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
. esttab, cell((S_f s_f100(fmt(1) par("" "%")))) noobs
--------------------------------------
--------------------------------------
--------------------------------------
Including a column containing bivariate effects (stack models)
estout cannot stack models. A solution is to stack the models in
advance and save the result in e(). Here is an example where the goal
is to include a column containing the bivariate effects of the regressors:
. capt prog drop appendmodels
. *! version 1.0.0
. program appendmodels, eclass
// using first equation of model
syntax namelist
tempname b V tmp
foreach name of local namelist {
qui est restore `name'
mat `tmp' = e(b)
local eq1: coleq `tmp'
gettoken eq1 : eq1
mat `tmp' = `tmp'[1,"`eq1':"]
local cons = colnumb(`tmp',"_cons")
if `cons'&. & `cons'&1 {
mat `tmp' = `tmp'[1,1..`cons'-1]
mat `b' = nullmat(`b') , `tmp'
mat `tmp' = e(V)
mat `tmp' = `tmp'["`eq1':","`eq1':"]
if `cons'&. & `cons'&1 {
mat `tmp' = `tmp'[1..`cons'-1,1..`cons'-1]
capt confirm matrix `V'
mat `V' = `tmp'
mat `V' = ///
( `V' , J(rowsof(`V'),colsof(`tmp'),0) ) \ ///
( J(rowsof(`tmp'),colsof(`V'),0) , `tmp' )
local names: colfullnames `b'
mat coln `V' = `names'
mat rown `V' = `names'
eret post `b' `V'
eret local cmd "whatever"
. sysuse auto
(1978 Automobile Data)
. eststo b1: quietly regress price weight
. eststo b2: quietly regress price mpg
. eststo b3: quietly regress price foreign
. eststo bivar: appendmodels b1 b2 b3
. eststo multi: quietly regress price weight mpg foreign
. esttab b1 b2 b3 bivar, mtitles
----------------------------------------------------------------------------
----------------------------------------------------------------------------
11253.1***
----------------------------------------------------------------------------
----------------------------------------------------------------------------
t statistics in parentheses
* p&0.05, ** p&0.01, *** p&0.001
. esttab multi bivar, mtitles
--------------------------------------------
--------------------------------------------
--------------------------------------------
--------------------------------------------
t statistics in parentheses
* p&0.05, ** p&0.01, *** p&0.001
. eststo clear
Displaying group sizes for categorical regressors
Assume you are including a categorical variable in a regression model (e.g. using
command) and want to report the group sizes.
You could proceed as follows:
. sysuse auto
(1978 Automobile Data)
. xi: reg price weight mpg i.rep
_Irep78_1-5
( _Irep78_1 omitted)
Number of obs
-------------+----------------------------------
Residual |
-------------+----------------------------------
Adj R-squared
------------------------------------------------------------------------------
[95% Conf. Interval]
-------------+----------------------------------------------------------------
_Irep78_2 |
_Irep78_3 |
_Irep78_4 |
_Irep78_5 |
------------------------------------------------------------------------------
. capt matrix drop nobs
. foreach cat of varlist _Irep* {
count if `cat'==1 & e(sample)
matrix nobs = nullmat(nobs), r(N)
local collab "`collab'`cat' "
. matrix colname nobs = `collab'
. estadd matrix nobs
added matrix:
. esttab, cells("b(fmt(a3)) t(fmt(2)) nobs") nogap
---------------------------------------------------
---------------------------------------------------
---------------------------------------------------
---------------------------------------------------
Tabulating results from stci
[ supersedes this example.
under "".]
command to compute confidence intervals
for survival time estimates returns its results in r(), or not at all if used with the by() option.
The following example therefore provides a wrapper for stci that collects the results
and posts them in e(), so that
they can be tabulated using estout or esttab:
. capt prog drop e_stci
. *! version 1.0.0
. prog e_stci, eclass
version 9.2
syntax [if] [in] [ , by(varname) Median Rmean Emean p(str) * ]
local stat "p50"
if `"`p'"'!=""
local stat `"p`p'"'
else if "`rmean'"!=""
local stat "rmean"
else if "`emean'"!=""
local stat "emean"
tempname b V N_sub lb ub
marksample touse
if "`by'"!="" {
markout `touse' `by', strok
qui levelsof `by' if `touse', local(levels)
local levels `"`levels' "total""'
gettoken l rest : levels, quotes
while (`"`l'"'!="") {
if `"`rest'"'=="" local lcond
local lcond `" & `by'==`l'"'
qui stci if `touse'`lcond', `median' `rmean' `emean' `p' `options'
mat `b' = nullmat(`b'), r(`stat')
mat `V' = nullmat(`V'), r(se)^2
mat `N_sub' = nullmat(`N_sub'), r(N_sub)
mat `lb' = nullmat(`lb'), r(lb)
mat `ub' = nullmat(`ub'), r(ub)
gettoken l rest : rest
foreach m in b V N_sub lb ub {
mat coln ``m'' = `levels'
if matmissing(`V') {
mat `V' = `b'' * `b' * 0
// set V to zero
mat `V' = diag(`V')
eret post `b' `V'
eret matrix N_sub = `N_sub'
eret matrix lb = `lb'
eret matrix ub = `ub'
eret local cmd "e_stci"
. webuse page2
. stci, by(group)
failure _d:
analysis time _t:
[95% Conf. Interval]
-------------+-------------------------------------------------------------
-------------+-------------------------------------------------------------
. e_stci, by(group)
. ereturn list
e(cmd) : "e_stci"
e(properties) : "b V"
e(N_sub) :
. estout, cell("N_sub b(label(50%)) se lb ub")
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------}

我要回帖

更多关于 sd卡根目录是什么意思 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信