已知单项式m n满足t=-144lg(1-n/100),当n=90时,t=

estout - Making Regression Tables in Stata
Examples for estpost
Basic syntax and usage
esttab and estout tabulate the e()-returns
of a command, but not all commands return their results in e().
estpost is a tool make results from some of the most popular
of these non-"e-class" commands available for tabulation. It collects
results and posts them in an appropriate form in e().
The basic syntax of estpost is:
estpost command [ arguments ] [, options ]
See the help file for a .
For example, to post and then results from summarize
you could type:
. sysuse auto
(1978 Automobile Data)
. estpost summarize price weight rep78 mpg
-------------+-------------------------------------------------------
-------------+---------------------------------
. esttab, cells("count mean sd min max") noobs
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
Applications
Post summary statistics (summarize)
Example for :
. sysuse auto
(1978 Automobile Data)
. estpost summarize price mpg rep78 foreign, listwise
-------------+-------------------------------------------------------
-------------+---------------------------------
. esttab, cells("mean sd min max") nomtitle nonumber
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
Post summary statistics (tabstat)
Summary statistics can also be posted by
Use columns(variables) and columns(statistics) to determine
whether to display variables or statistics in the columns. The default is
columns(variables):
. sysuse auto
(1978 Automobile Data)
. estpost tabstat price mpg rep78, listwise ///
statistics(mean sd)
Summary statistics: mean sd
for variables: price mpg rep78
-------------+---------------------------------
. esttab, cells("price mpg rep78") nomtitle nonumber
---------------------------------------------------
---------------------------------------------------
---------------------------------------------------
---------------------------------------------------
Type columns(statistics) to print statistics in columns:
. sysuse auto
(1978 Automobile Data)
. estpost tabstat price mpg rep78, listwise ///
statistics(mean sd) columns(statistics)
Summary statistics: mean sd
for variables: price mpg rep78
-------------+----------------------
. esttab, cells("mean sd") nomtitle nonumber
--------------------------------------
--------------------------------------
--------------------------------------
--------------------------------------
Post summary statistics by subgroups (summarize)
A table of summary statistics by subgroups can easily be produced using
in connection with eststo and by:
. sysuse auto
(1978 Automobile Data)
. by foreign: eststo: quietly estpost summarize price mpg rep78, listwise
-------------------------------------------------------------------------------
-& Domestic
(est1 stored)
-------------------------------------------------------------------------------
-& Foreign
(est2 stored)
. esttab, cells("mean sd") label nodepvar
------------------------------------------------------------------------
------------------------------------------------------------------------
Mileage (mpg)
Repair Record 1978
------------------------------------------------------------------------
Observations
------------------------------------------------------------------------
. eststo clear
Alternatively, you can also use
(see next example).
Post summary statistics by subgroups (tabstat)
with the by() option
to post summary statistics by subgroups:
. sysuse auto
(1978 Automobile Data)
. estpost tabstat price mpg rep78, by(foreign) ///
statistics(mean sd) columns(statistics) listwise
Summary statistics: mean sd
for variables: price mpg rep78
by categories of: foreign
-------------+----------------------
-------------+----------------------
-------------+----------------------
. esttab, main(mean) aux(sd) nostar unstack ///
noobs nonote nomtitle nonumber
---------------------------------------------------
---------------------------------------------------
---------------------------------------------------
If the labels of the categories are too long or contain unsuitable characters,
they are stored in macro e(labels). Type varlabels(`e(labels)')
or, depending on context, eqlabels(`e(labels)') to use
these labels:
. sysuse auto
(1978 Automobile Data)
. estpost tabstat price in 1/15, by(make)
Summary statistics: mean
for variables: price
by categories of: make
-------------+-----------
-------------+-----------
category labels saved in macro e(labels)
. esttab, cells(mean) noobs nomtitle nonumber ///
varlabels(`e(labels)') varwidth(20)
---------------------------------
---------------------------------
AMC Concord
AMC Spirit
Buick Century
Buick Electra
Buick LeSabre
Buick Opel
Buick Regal
Buick Riviera
Buick Skylark
Cad. Deville
Cad. Eldorado
Cad. Seville
Chev. Chevette
Chev. Impala
---------------------------------
. lab def origin 0 "Car type: domestic" 1 "Car type: foreign", modify
. estpost tabstat price weight, statistics(mean sd) by(foreign)
Summary statistics: mean sd
for variables: price weight
by categories of: foreign
-------------+----------------------
-------------+----------------------
-------------+----------------------
category labels saved in macro e(labels)
. esttab, cells("price weight") noobs nomtitle nonumber ///
eqlabels(`e(labels)') varwidth(20)
----------------------------------------------
----------------------------------------------
Car type: domestic
----------------------------------------------
Car type: foreign
----------------------------------------------
----------------------------------------------
Post results from two-sample mean-comparison tests (ttest)
Example for :
. sysuse auto
(1978 Automobile Data)
. estpost ttest price mpg headroom trunk, by(foreign)
-------------+-------------------------------------------------------
price | -312.2587
mpg | -4.945804
headroom |
-------------+-------------------------------------------------------
headroom |
-------------+----------------------
headroom |
. esttab, wide nonumber mtitle("diff.")
-----------------------------------------
-----------------------------------------
-----------------------------------------
-----------------------------------------
t statistics in parentheses
* p&0.05, ** p&0.01, *** p&0.001
Post results from two-group tests of proportions (prtest)
Example for :
. webuse cure2
. gen noise = uniform()&.5
. estpost prtest cure noise, by(sex)
-------------+-------------------------------------------------------
cure | -.0729167
-------------+-------------------------------------------------------
-------------+----------------------
. esttab, cell("b se0 z p") nomtitle nonumber
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
Post a one-way frequency table (tabulate)
Example for posting a one-way frequency table using
. sysuse auto
(1978 Automobile Data)
. estpost tabulate foreign
-------------+---------------------------------
Domestic |
-------------+---------------------------------
. esttab, cells("b(label(freq)) pct(fmt(2)) cumpct(fmt(2))") ///
varlabels(, blist(Total "{hline @width}{break}"))
nonumber nomtitle noobs
---------------------------------------------------
---------------------------------------------------
---------------------------------------------------
---------------------------------------------------
If the value labels are too long or contain unsuitable characters,
they are stored in macro e(labels). Type varlabels(`e(labels)')
to use the labels in esttab or estout in this case:
. sysuse auto
(1978 Automobile Data)
. lab def origin 0 "Car type: domestic" 1 "Car type: foreign", modify
. estpost tabulate foreign
-------------+---------------------------------
-------------+---------------------------------
row labels saved in macro e(labels)
. esttab, cells("b(label(freq)) pct(fmt(2)) cumpct(fmt(2))")
varlabels(`e(labels)', blist(Total "{hline @width}{break}")) ///
varwidth(20) nonumber nomtitle noobs
-----------------------------------------------------------
-----------------------------------------------------------
Car type: domestic
Car type: foreign
-----------------------------------------------------------
-----------------------------------------------------------
Post a two-way frequency table (tabulate)
stores the columns of a two-way table in separate equations.
Use the unstack option in esttab or estout to
print these equations beside one another:
. sysuse auto
(1978 Automobile Data)
. estpost tabulate rep78 foreign
-------------+--------------------------------------------
-------------+--------------------------------------------
-------------+--------------------------------------------
. esttab, cell(colpct(fmt(2))) unstack noobs
---------------------------------------------------
---------------------------------------------------
---------------------------------------------------
. esttab, cell(colpct(fmt(2)) b(fmt(g) par keep(Total))) ///
collabels(none) unstack noobs nonumber nomtitle
eqlabels(, lhs("Repair Rec."))
varlabels(, blist(Total "{hline @width}{break}"))
---------------------------------------------------
Repair Rec.
---------------------------------------------------
---------------------------------------------------
---------------------------------------------------
If the value labels are too long or contain unsuitable characters,
they are stored in macros e(labels) (row labels) and e(eqlabels)
(column labels). Type varlabels(`e(labels)') and
eqlabels(`e(eqlabels)') to use these labels in esttab or estout:
. sysuse auto
(1978 Automobile Data)
. lab def origin 0 "Type: domestic" 1 "Type: foreign", modify
. lab def rep78 1 "Rep. rec. 1" 2 "Rep. rec. 2" 3 "Rep. rec. 3" 4 "Rep. rec. 4"
5 "Rep. rec. 5"
. lab val rep78 rep78
. estpost tabulate rep78 foreign
-------------+--------------------------------------------
-------------+--------------------------------------------
-------------+--------------------------------------------
row labels saved in macro e(labels)
column labels saved in macro e(eqlabels)
. esttab, cell(colpct(fmt(2))) unstack noobs modelwidth(15) ///
varlabels(`e(labels)') eqlabels(`e(eqlabels)')
------------------------------------------------------------
Type: domestic
Type: foreign
------------------------------------------------------------
Rep. rec. 1
Rep. rec. 2
Rep. rec. 3
Rep. rec. 4
Rep. rec. 5
------------------------------------------------------------
Post a one-way frequency table for complex survey data (svy: tabulate)
Example for posting a one-way frequency table for complex survey data using
. webuse nhanes2b, clear
. svyset psuid [pweight=finalwgt], strata(stratid)
pweight: finalwgt
VCE: linearized
Single unit: missing
Strata 1: stratid
SU 1: psuid
FPC 1: &zero&
. estpost svy: tabulate race
(running tabulate on estimation sample)
Number of strata
Number of obs
Number of PSUs
Population size
-----------------------
| proportions
----------+------------
-----------------------
proportions
cell proportions
saved vectors:
cell proportions
standard errors of cell proportions
lower 95% confidence bounds for cell proportions
upper 95% confidence bounds for cell proportions
deff for variances of cell proportions
deft for variances of cell proportions
cell proportions
e(count) =
weighted counts
number of observations
. esttab, cell("b(f(4)) se lb ub deft")
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
If the value labels are too long or contain unsuitable characters,
they are stored in macro e(labels). Type varlabels(`e(labels)')
in this case:
. label define race 1 "Race: White" 2 "Race: Black" 3 "Race: Other", modify
. estpost svy: tabulate race
(running tabulate on estimation sample)
Number of strata
Number of obs
Number of PSUs
Population size
-----------------------
| proportions
----------+------------
-----------------------
proportions
cell proportions
saved vectors:
cell proportions
standard errors of cell proportions
lower 95% confidence bounds for cell proportions
upper 95% confidence bounds for cell proportions
deff for variances of cell proportions
deft for variances of cell proportions
cell proportions
e(count) =
weighted counts
number of observations
row labels saved in macro e(labels)
. esttab, cell("b(f(4)) se lb ub deft") varlabels(`e(labels)')
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
Race: White
Race: Black
Race: Other
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
Post a two-way frequency table for complex survey data (svy: tabulate)
stores the columns of a two-way table in separate equations.
Use the unstack option in esttab or estout to
print these equations beside one another:
. webuse nhanes2b, clear
. svyset psuid [pweight=finalwgt], strata(stratid)
pweight: finalwgt
VCE: linearized
Single unit: missing
Strata 1: stratid
SU 1: psuid
FPC 1: &zero&
. estpost svy: tabulate race diabetes, row percent
(running tabulate on estimation sample)
Number of strata
Number of obs
Number of PSUs
Population size
-------------------------------
diabetes, 1=yes,
----------+--------------------
Other | 97.97
Total | 96.58
-------------------------------
row percentages
Uncorrected
Design-based
F(1.52, 47.26)
P = 0.0000
saved vectors:
row percentages
standard errors of row percentages
lower 95% confidence bounds for row percentages
upper 95% confidence bounds for row percentages
deff for variances of row percentages
deft for variances of row percentages
cell percentages
row percentages
column percentages
e(count) =
weighted counts
number of observations
. esttab ., se nostar nostar unstack
---------------------------------------------------
---------------------------------------------------
---------------------------------------------------
---------------------------------------------------
Standard errors in parentheses
If the value labels are too long or contain unsuitable characters,
they are stored in macros e(labels) (row labels) and e(eqlabels)
(column labels). Type varlabels(`e(labels)') and
eqlabels(`e(eqlabels)') to use these labels in esttab or estout:
. label define race 1 "Race: White" 2 "Race: Black" 3 "Race: Other", modify
. label define diabetes 0 "no diab." 1 "diabetes"
. label values diabetes diabetes
. estpost svy: tabulate race diabetes, row percent
(running tabulate on estimation sample)
Number of strata
Number of obs
Number of PSUs
Population size
----------------------------------------
diabetes, 1=yes, 0=no
| no diab,
----------+-----------------------------
----------------------------------------
row percentages
Uncorrected
Design-based
F(1.52, 47.26)
P = 0.0000
saved vectors:
row percentages
standard errors of row percentages
lower 95% confidence bounds for row percentages
upper 95% confidence bounds for row percentages
deff for variances of row percentages
deft for variances of row percentages
cell percentages
row percentages
column percentages
e(count) =
weighted counts
number of observations
row labels saved in macro e(labels)
column labels saved in macro e(eqlabels)
. esttab ., se nostar nostar unstack ///
varlabels(`e(labels)') eqlabels(`e(eqlabels)')
---------------------------------------------------
---------------------------------------------------
Race: White
Race: Black
Race: Other
---------------------------------------------------
---------------------------------------------------
Standard errors in parentheses
Post correlation coefficients (correlate)
By default,
posts a vector of correlations between
the first specified variable and the remaining variables. Example:
. sysuse auto
(1978 Automobile Data)
. estpost correlate price turn foreign rep78
-------------+--------------------------------------------
. esttab, cell("rho p count") noobs
---------------------------------------------------
---------------------------------------------------
---------------------------------------------------
Alternatively, specify the matrix option to post a correlation matrix. The columns
of the matrix are stored in separate equations. Hence, use the unstack option
in esttab or estout to print the matrix:
. sysuse auto
(1978 Automobile Data)
. estpost correlate price turn foreign rep78, matrix listwise
-------------+--------------------------------------------
foreign | -.0173639
rep78 | -.4961308
. esttab, unstack not noobs compress
--------------------------------------------------------------
--------------------------------------------------------------
--------------------------------------------------------------
* p&0.05, ** p&0.01, *** p&0.001
(Also see ""
under "".)
Post confidence intervals for means, proportions, or counts (ci)
posts standard errors and confidence intervals for means,
proportions or counts. Example:
. sysuse auto
(1978 Automobile Data)
. estpost ci price mpg rep78, listwise
(confidence level is 95%)
-------------+-------------------------------------------------------
. esttab, cells("b se lb ub") label
------------------------------------------------------------------------
------------------------------------------------------------------------
Mileage (mpg)
Repair Record 1978
------------------------------------------------------------------------
Observations
------------------------------------------------------------------------
e(lb) and e(ub) contain the the lower and upper bounds of the
confidence intervals. The default confidence level is 95% or as set by
To post confidence intervals using another level, apply the level() option:
. sysuse auto
(1978 Automobile Data)
. estpost ci price mpg rep78, listwise level(90)
(confidence level is 90%)
-------------+-------------------------------------------------------
. esttab, cells("b se lb ub") label scalars(level)
------------------------------------------------------------------------
------------------------------------------------------------------------
Mileage (mpg)
Repair Record 1978
------------------------------------------------------------------------
Observations
------------------------------------------------------------------------
Example with confidence intervals for proportions:
. sysuse auto
(1978 Automobile Data)
. eststo exact: estpost ci foreign, binomial exact
(confidence level is 95%)
-------------+-------------------------------------------------------
. eststo agresti: estpost ci foreign, binomial agresti
(confidence level is 95%)
-------------+-------------------------------------------------------
. esttab, cells(lb ub) mtitles
--------------------------------------
--------------------------------------
--------------------------------------
--------------------------------------
. eststo clear
Post confidence intervals for survival time (stci)
posts confidence intervals for means and percentiles
of survival time. The default is to use the median (50% percentile). Example:
. webuse page2
. estpost stci
(confidence level is 95%)
-------------+-------------------------------------------------------
. esttab, cell("count p50 se lb ub") noobs compress
------------------------------------------------------------
------------------------------------------------------------
------------------------------------------------------------
To compute the statistics by subgroups, apply the by() option:
. webuse page2
. estpost stci, by(group)
(confidence level is 95%)
-------------+-------------------------------------------------------
-------------+-------------------------------------------------------
. esttab, cell("count p50 se lb ub") noobs compress ///
varlabels(, blist(total "{hline @width}{break}"))
------------------------------------------------------------
------------------------------------------------------------
------------------------------------------------------------
------------------------------------------------------------
Post results from margins
posts results from the
command. The following example illustrates how to plot logit coefficients
along with average marginal effects:
. sysuse auto, clear
(1978 Automobile Data)
. logit foreign turn weight mpg, nolog
Logistic regression
Number of obs
LR chi2(3)
Prob & chi2
Log likelihood = -23.535653
------------------------------------------------------------------------------
[95% Conf. Interval]
-------------+----------------------------------------------------------------
------------------------------------------------------------------------------
. eststo logodds
. estpost margins, dydx(*)
Warning: cannot perform check for estimable functions.
Average marginal effects
Number of obs
Expression
: Pr(foreign), predict()
dy/dx w.r.t. : turn weight mpg
------------------------------------------------------------------------------
Delta-method
[95% Conf. Interval]
-------------+----------------------------------------------------------------
------------------------------------------------------------------------------
. eststo AMEs
. esttab logodds AMEs, mtitles
--------------------------------------------
--------------------------------------------
-0.000238*
--------------------------------------------
--------------------------------------------
t statistics in parentheses
* p&0.05, ** p&0.01, *** p&0.001
Note that in many cases estpost margins is not needed as you
can specify margins with the post option to store results
from margins in e():
. sysuse auto, clear
(1978 Automobile Data)
. logit foreign turn weight mpg, nolog
Logistic regression
Number of obs
LR chi2(3)
Prob & chi2
Log likelihood = -23.535653
------------------------------------------------------------------------------
[95% Conf. Interval]
-------------+----------------------------------------------------------------
------------------------------------------------------------------------------
. eststo logodds
. margins, dydx(*) post
Warning: cannot perform check for estimable functions.
Average marginal effects
Number of obs
Expression
: Pr(foreign), predict()
dy/dx w.r.t. : turn weight mpg
------------------------------------------------------------------------------
Delta-method
[95% Conf. Interval]
-------------+----------------------------------------------------------------
------------------------------------------------------------------------------
. eststo AMEs
. esttab logodds AMEs, mtitles
--------------------------------------------
--------------------------------------------
-0.000238*
--------------------------------------------
--------------------------------------------
t statistics in parentheses
* p&0.05, ** p&0.01, *** p&0.001
Furthermore, see
if you want
to add results from
to an existing
model without replacing the original coefficients.

我要回帖

更多关于 已知 m n 2 8 的文章

 

随机推荐