File restructure #1

This commit is contained in:
2024-04-19 16:46:33 +02:00
parent a8a94ddc10
commit ecac05b9c4
703 changed files with 10 additions and 272568 deletions

View File

@ -1,81 +0,0 @@
/* elapse.ado 10/24/97 */
program define elapse /* start_time name_of_operation (optional)*/
version 5.0
local hdiff = real(substr("$S_TIME",1,2)) - real(substr("`1'",1,2))
local mdiff = real(substr("$S_TIME",4,2)) - real(substr("`1'",4,2))
local sdiff = real(substr("$S_TIME",7,2)) - real(substr("`1'",7,2))
if `sdiff' < 0 {
local sdiff = `sdiff' + 60
local mdiff = `mdiff' -1
}
if `mdiff' < 0 {
local mdiff = `mdiff' + 60
local hdiff = `hdiff' -1
}
if `hdiff' < 0 {
local hdiff = `hdiff' + 24
}
local selap = 10000 * `hdiff' + 100 * `mdiff' + `sdiff'
global S_elap = `selap'
local hdiff = string(`hdiff')
local mdiff = string(`mdiff')
local sdiff = string(`sdiff')
if "`2'" == "" {
if `hdiff' > 0 {
di in ye "Elapsed time was " in wh "`hdiff'" _c
if `hdiff' > 1 {di in ye " hours, " _c}
else { di in ye " hour, " _c}
di in wh "`mdiff'" _c
if `mdiff' > 1 {di in ye " minutes, " _c}
else {di in ye " minute, " _c}
di in wh "`sdiff'" _c
if `sdiff' > 1 {di in ye " seconds."}
else {di in ye " second."}
}
else if `mdiff' > 0 {
di in ye "Elapsed time was " in wh "`mdiff'" _c
if `mdiff' > 1 {di in ye " minutes, " _c}
else {di in ye " minute, " _c}
di in wh "`sdiff'" _c
if `sdiff' > 1 {di in ye " seconds."}
else {di in ye " second."}
}
else {
di in ye "Elapsed time was " in wh "`sdiff'" _c
if `sdiff' > 1 {di in ye " seconds."}
else {di in ye " second."}
}
}
else {
if `hdiff' > 0 {
di in ye "`2' took " in wh "`hdiff'" _c
if `hdiff' > 1 {di in ye " hours, " _c}
else { di in ye " hour, " _c}
di in wh "`mdiff'" _c
if `mdiff' > 1 {di in ye " minutes, " _c}
else {di in ye " minute, " _c}
di in wh "`sdiff'" _c
if `sdiff' > 1 {di in ye " seconds."}
else {di in ye " second."}
}
else if `mdiff' > 0 {
di in ye "`2' took " in wh "`mdiff'" _c
if `mdiff' > 1 {di in ye " minutes, " _c}
else {di in ye " minute, " _c}
di in wh "`sdiff'" _c
if `sdiff' > 1 {di in ye " seconds."}
else {di in ye " second."}
}
else {
di in ye "`2' took " in wh "`sdiff'" _c
if `sdiff' > 1 {di in ye " seconds."}
else {di in ye " second."}
}
}
end

View File

@ -1,68 +0,0 @@
..-
help for ^elapse^
..-
Timing portions of a program
- ----------------------------
^elapse^ start_time [name_of_operation]
Where start_time is a previously defined macro equal to
the global system macro S_TIME at some earlier point, and
name_of_operation is a string.
Description
- -----------
^Elapse^ displays a string with the name of the operation,
if specified, and the time elapsed between start_time and
current time.
Options
- -------
name_of_operation is a user-defined string.
Remarks
- -------
^Elapse^ automates the procedure of timing a piece of code
or an entire program. It is accurate over midnight, but not
over several days. It also creates a global S_elap, which is
a numerical macro of the form hhmmss, where hh is the number
of hours, mm the number of minutes, and ss the number of seconds.
Examples
- --------
^local st = "$S_TIME"^
^...^
^local oper "Maximum likelihood estimation"^
^elapse "`st'" "`oper'"^
- Maximum likelihood estimation took 7 minutes, 15 seconds.
^elapse `st'^
- Elapsed time was 1 hour, 10 minutes, 32 seconds.
^quietly elapse `st'^
^if $S_elap > 4500 { mat xx = startxx }^
Saved Results
- -------------
S_elap (see above).
Author
- ------
Frederic Zimmerman
Food Research Institute
Stanford University

View File

@ -1,81 +0,0 @@
.-
help for ^eq^
.-
Define and list equations
-------------------------
^eq^ [^define^] eqtn
^eq^ [^define^] eqname ^:^ [eqtn]
^eq dir^ [^_all^ | eqname [eqname ..]]
^eq list^ [^_all^ | eqname [eqname ..]]
^eq drop^ {^_all^ | eqname [eqname ..]}
Description
-----------
^eq define^ is used to define equations in ^gllamm^. In Stata 5 and earlier this
was also used by Stata's own multivariate estimation commands. The command
continues to work in Stata 8 but is no longer documented.
^eq dir^ and ^eq list^ are used to review equations that
have been defined. ^eq drop^ is used to eliminate previously defined equations.
^gllamm^ has options ^eqs(eqnames)^ ^geqs(eqnames)^ ^peqs(eqname)^ and ^s(eqname)^
where eqnames is a list of equation names and eqname is an equation name.
You first define equations using ^eq^ and then estimate the model.
Equations are named and usually define a variable list. For instance,
to estimate a factor model in ^gllamm^, an equation of the following
kind must be defined:
. ^eq load: d1 d2 d3^
where d1, d2 and d3 are dummy variables for three variables or items
loading on one of the factors. You can abbreviate variable names and
take all the other shortcuts you would when specifying a varlist in a
command:
. ^eq load: d1-d3^
When you do not specify the equation name followed by a colon, the first name
is taken both as the equation name and as part of the contents of the equation.
There is one exception to this rule. You may not type
. ^eq price^
You must type instead
. ^eq price: price^
(Such nearly empty equations are not silly; it could mean that price is to
be estimated by an intercept-only equation.) One can also define completely
empty equations in this way:
. ^eq price: ^
Note the distinction: "^eq price: price^" defines equation price to contain
"price"; "^eq price:^" defines price to contain nothing.
Equations can be dropped,
. ^eq drop load^
. ^eq load: d1 d2 d3^
or you can redefine equations without bothering to drop them first.
Equations may be listed for review:
. ^eq list load^
. ^eq list load1 load2^
. ^eq list^
You can list just the equation names using ^eq dir^:
. ^eq dir^

View File

@ -1,64 +0,0 @@
program def eqlist, rclass
*! NJC 1.1.0 23 January 2001
* NJC 1.0.0 5 January 2001
version 6.0
gettoken lists 0 : 0, parse(",")
if "`lists'" == "" | "`lists'" == "," { /* no \ */
di in r "incorrect syntax: no separator"
exit 198
}
tokenize "`lists'", parse("\")
if "`4'" != "" {
di in r "incorrect syntax: too much stuff"
exit 198
}
if "`1'" == "\" { /* list1 empty */
if "`2'" == "\" {
di in r "incorrect syntax: one \ only"
exit 198
}
local list2 "`2'" /* might be empty */
}
else if "`2'" == "\" {
local list1 "`1'"
local list2 "`3'" /* might be empty */
}
else {
di in r "incorrect syntax: what to compare?"
exit 198
}
syntax [ , Global(str) Noisily ]
if length("`global'") > 8 {
di in r "global name must be <=8 characters"
exit 198
}
local n1 : word count `list1'
tokenize `list1'
local n2 : word count `list2'
if `n1' != `n2' {
local iseq = 0
}
else {
local iseq = 1
local i = 1
while `i' <= `n1' & `iseq' {
local word : word `i' of `list2'
if length("``i''") > 80 | length("`word'") > 80 {
di in r "cannot handle word length > 80"
exit 498
}
if "`word'" != "``i''" { local iseq 0 }
local i = `i' + 1
}
}
if "`noisily'" != "" { di `iseq' }
if "`global'" != "" { global `global' = `iseq' }
return local iseq = `iseq'
end

View File

@ -1,2 +0,0 @@
.h listutil

View File

@ -1,128 +0,0 @@
*! version 1.0 Alfonso Miranda-Caso-Luengo, November 26 2002 (SJ4-1: st0057)
*! FIML endogenous-switch Poisson Regression
program define espoisson, eclass
version 6
if replay() {
if "`e(cmd)'" != "espoisson" { error 301 }
else espDisplay `0'
}
else espEstimate `0'
end
program define espEstimate, eclass
syntax varlist [if] [in] , EDummy(varname) /*
*/ [Switch(varlist) Quadrature(integer 6) /*
*/ SIGMA0(real 1) RHO0(real 0.1) /*
*/ EXS *]
/* Obtaining dependent variable and explanatory variables */
gettoken endgv exogv : varlist, parse("")
/* Selecting sample */
marksample touse
markout `touse' `varlist'
/* defining some globals */
global S_quad "`quadrature'"
global S_edum "`edummy'"
/* Diverting to exsp if EXS option active */
if "`exs'"!="" {
#delimit ;
exspoisson `endgv' `exogv' `if' `in', edummy(`edummy')
s(`switch') q(`quadrature')
sigma0(`sigma0') ;
#delimit cr
exit
}
/* Get points and weights for Gaussian-Hermite quadrature. */
tempvar x w
qui gen double `x' = 0
qui gen double `w' = 0
ghquad `x' `w', n(`quadrature')
local j = `quadrature'
while `j' >0 {
scalar x`j' = `x'[`j']
local j = `j' -1
}
local j = `quadrature'
while `j' >0 {
scalar w`j' = `w'[`j']
local j = `j' - 1
}
/* GETTING INITIAL VALUES */
di _skip(3)
qui probit `edummy' `switch' if `touse'
tempname b b1 b2 ch cr b0 bi
mat `b'=e(b)
xcolnames `b', head(switch)
di as txt "Getting Initial Values:"
qui poisson `endgv' `exogv' if `touse'
mat `b1' = e(b)
mat `b2' = (`b1',`b')
matrix `ch' = ln(`sigma0')
matrix colnames `ch' = lnsigma:_cons
matrix `cr' = `rho0'
matrix colnames `cr' = rho:_cons
matrix `b0' = (`b2',`ch',`cr')
ml model d0 espoisson_ll ("`endgv'": `endgv' = `exogv') /*
*/ (switch:`switch')(lnsigma:)(rho:) /*
*/ if `touse', init(`b0')
qui ml search rho: 14 -14
mat `cr' = ML_b[1,"rho:_cons"]
mat `bi' = (`b2',`ch',`cr')
/* FITTING FULL MODEL */
di _skip(3)
di in gr "Fitting Full model:"
ml model d0 espoisson_ll ("`endgv'": `endgv' = `exogv') /*
*/ (switch:`switch')(lnsigma:)(rho:)/*
*/ if `touse', init(`bi', skip) max `options' search(off)
estimates local cmd "espoisson"
estimates local edummy "`edummy'"
est local predict "espoisson_p"
est local quad "`quadrature'"
/* Display Results */
espDisplay
end
program define espDisplay
di _skip(12)
di _n as txt /*
*/ "Endogenous-Switch Poisson Regression"
di as text "(`e(quad)' quadrature points)"
ml di, neq(2)plus
_diparm lnsigma, exp pr label("sigma")
_diparm rho, f((exp(2*@)-1)/(exp(2*@)+1)) /*
*/ d(4*exp(2*@)/(exp(2*@)+1)^2) label("rho") pr
di in gre in smcl "{hline 13}{c BT}{hline 64}"
end

View File

@ -1,84 +0,0 @@
{smcl}
{hline}
help for {hi:espoisson} {right:(SJ4-1: st0057)}
{hline}
{title:FIML endogenous switching Poisson model}
{p 8 13 2}{cmd:espoisson}{space 2}{it:depvar} [{it:varlist}]
[{cmd:if} {it:exp}] [{cmd:in} {it:range}] {cmd:,}
{cmdab:ed:ummy(}{it:varname}{cmd:)} [ {cmdab:s:witch(}{it:varlist}{cmd:)}
{cmdab:q:uadrature(}{it:#}{cmd:)} {cmd:rho0(}{it:#}{cmd:)}
{cmd:sigma0(}{it:#}{cmd:)} {cmd:exs} {it:maximize_options}]
{p 8 8 2}Note: the vector {it:varlist} should include the switch variable
(endogenous dummy) as one of its elements.{p_end}
{p 4 4 2} The syntax of {help predict} after {cmd:espoisson} is
{p 8 16 2}{cmd:predict} {it:newvar} [{cmd:if} {it:exp}]
[{cmd:in} {it:range}] [{cmd:,} n ]
{p 4 4 2}where,
{p 8 21 2}{cmd:n}{space 9}predicted number of events (default){p_end}
{title:Description}
{p 4 4 2}{cmd:espoisson} fits a FIML endogenous switching Poisson model.
An endogenous dummy variable is present in the vector of explanatory
variables, and there is unobserved individual heterogeneity. The endogenous
dummy variable indicates the realization of two different regimes. The
endogenous switching model corrects for the simultaneous equation bias that
the presence of the endogenous dummy may induce in a standard exogenous-switch
count model.
{p 4 4 2}This program uses {cmd:ml d0} method.
{title:Options}
{p 4 8 2}{cmd:edummy(}{it:varname}{cmd:)} (required) specifies the endogenous
dummy variable.
{p 4 8 2} {cmd:switch(}{it:varlist}{cmd:)} specifies explanatory variables for
the index function governing the endogenous dummy. If {cmd:switch()} is
unspecified then a constant-only model is fitted.
{p 4 8 2}{cmd:quadrature(}{it:#}{cmd:)} specifies the number of quadrature
points for the Gauss-Hermite integral. Six points are used by default.
{p 4 8 2}{cmd:rho0(}{it:#}{cmd:)} specifies initial value for rho. If
unspecified, {cmd:rho0()}=0.01.
{p 4 8 2}{cmdab:sigma0(}{it:#}{cmdab:)} specifies initial value for sigma. If
unspecified, {cmd:sigma0()}=1.0.
{p 4 8 2}{cmdab:exs} causes the program to fit an exogenous switching
model.
{title:Examples}
{p 8 12 2}{cmd:. espoisson y x1 x2, ed(x2) s(x1) q(16)}{p_end}
{p 8 12 2}{cmd:. predict yhat, n}{p_end}
{p 8 12 2}{cmd:. espoisson y x1 x2, ed(x2) s(x1) q(16) exs}{p_end}
{p 8 12 2}{cmd:. predict yhat, n}{p_end}
{title:Author}
{p 4 8 2}{bf: Alfonso Miranda}{p_end}
{p 4 8 2} Economics Department, Warwick University, CV4 7AL, UK.{p_end}
{p 4 8 2}E-mail: Alfonso.Miranda-Caso-Luengo@warwick.ac.uk{p_end}
{title:Also see}
{p 4 14 2}Manual: {hi:[U] 23 Estimation and post-estimation commands},{p_end}
{p 13 13 2}{hi:[U] 29 Overview of model estimation in Stata},{p_end}
{p 13 13 2}{hi:[R] poisson}
{p 4 13 2}Online: help for {help ml}, {help glm}, {help nbreg}, {help svypois},
{help xtpois}, {help zip}

View File

@ -1,74 +0,0 @@
*! Alfonso Miranda Caso Luengo (SJ4-1: st0057)
*! Version 1.0 November 21 2002
program define espoisson_ll
args todo b f
tempname lnsigma kappa delta
tempvar xb zb
local y "$ML_y1"
local d "$S_edum"
mleval `xb' = `b', eq(1)
mleval `zb' = `b', eq(2)
mleval `lnsigma' = `b', eq(3) scalar
mleval `kappa' = `b', eq(4) scalar
scalar `lnsigma' = cond(`lnsigma'<-20,-20,`lnsigma')
if `kappa' <-14 {
scalar `kappa' = -14
}
if `kappa' > 14 {
scalar `kappa' = 14
}
tempname sma u rho
scalar `sma' = exp(`lnsigma')
scalar `rho' = (exp(2*`kappa')-1)/(exp(2*`kappa')+1)
tempvar F p r1 r2 r3 r4 r5 r6
qui {
gen double `F' = . if $ML_samp
gen double `p' = 0 if $ML_samp
gen double `r1' = 0 if $ML_samp
gen double `r2' = 0 if $ML_samp
gen double `r3' = 0 if $ML_samp
gen double `r4' = 0 if $ML_samp
gen double `r5' = 0 if $ML_samp
gen double `r6' = 0 if $ML_samp
local m = 1
while `m' <= $S_quad {
scalar `u' = sqrt(2)*`sma'*scalar(x`m')
replace `r1' = `xb' + `u' if $ML_samp
replace `r2' = exp(`r1')^(`y')*exp(-exp(`r1')) if $ML_samp
replace `r3' = `r2'/exp(lngamma(`y'+1)) if $ML_samp
replace `r4' = `zb' + sqrt(2)*`rho'*scalar(x`m') if $ML_samp
replace `r5' = `r4'/(sqrt(1-`rho'^2)) if $ML_samp
replace `r6' = `d'*norm(`r5') + /*
*/ (1-`d')*norm(-`r5') if $ML_samp
replace `F' = `r3'*`r6' if $ML_samp
replace `p' = `p' + scalar(w`m')*`F' if $ML_samp
local m = `m' + 1
}
replace `p'= (1/sqrt(_pi))*`p' if $ML_samp
replace `F' = log(`p') if $ML_samp
mlsum `f' = `F' if $ML_samp
}
end
exit

View File

@ -1,50 +0,0 @@
*! version 1.0 Alfonso Miranda-Caso-Luengo, June 2003 (SJ4-1: st0057)
program define espoisson_p, sort
version 7
local myopts "n"
_pred_se "`myopts'" `0'
if `s(done)' { exit }
local vtyp `s(typ)'
local varn `s(varn)'
local 0 `"`s(rest)'"'
syntax [if] [in] [, `myopts' noOFFset]
local type "`n'"
marksample touse
if "`type'"=="n" | "`type'"=="" {
tempname mu zu lnsigma kappa
qui _predict double `mu' if `touse', xb `offset' eq(#1)
qui _predict double `zu' if `touse', xb `offset' eq(#2)
qui _predict double `lnsigma' if `touse', xb eq(#3)
qui _predict double `kappa' if `touse', xb eq(#4)
local d "`e(edummy)'"
tempvar sma u rho
gen double `sma' = exp(`lnsigma')
gen double `rho' = (exp(2*`kappa')-1)/(exp(2*`kappa')+1)
tempvar p eta
gen double `p'=0 if `touse'
gen double `eta'=0 if `touse'
qui replace `mu'=exp(`mu'-0.5*`sma'^2) if `touse'
#delimit ;
qui replace `eta' = `d'*(norm(`zu' +`rho'*`sma')/norm(`zu'))
+ (1-`d')*(norm(-(`zu'+`rho'*`sma'))/norm(-(`zu'))) if `touse' ;
#delimit cr
qui replace `p'=`mu'*`eta' if `touse'
qui gen `vtyp' `varn'=`p' if `touse'
label var `varn' "predicted number of events of `e(depvar)'"
exit
}
end

File diff suppressed because it is too large Load Diff

View File

@ -1,935 +0,0 @@
{smcl}
{* 08oct2009}{...}
{hi:help estadd}{right:also see: {helpb esttab}, {helpb estout}, {helpb eststo}, {helpb estpost}}
{right: {browse "http://repec.org/bocode/e/estout"}}
{hline}
{title:Title}
{p 4 4 2}{hi:estadd} {hline 2} Add results to (stored) estimates
{title:Syntax}
{p 8 15 2}
{cmd:estadd} {it:{help estadd##subcommands:subcommand}} [{cmd:,}
{it:{help estadd##opts:options}} ] [ {cmd::} {it:namelist} ]
where {it:namelist} is {cmd:_all} | {cmd:*} | {it:name} [{it:name} ...]
{marker subcommands}
{it:subcommands}{col 26}description
{hline 64}
Elementary
{helpb estadd##local:{ul:loc}al} {it:name ...}{col 26}{...}
add a macro
{helpb estadd##scalar:{ul:sca}lar} {it:name} {cmd:=} {it:exp}{col 26}{...}
add a scalar
{helpb estadd##matrix:{ul:mat}rix} {it:name} {cmd:=} {it:mat}{col 26}{...}
add a matrix
{helpb estadd##rreturn:r({it:name})}{col 26}{...}
add contents of {cmd:r(}{it:name}{cmd:)} (matrix or scalar)
Statistics for each
coefficient
{helpb estadd##beta:beta}{col 26}{...}
standardized coefficients
{helpb estadd##vif:vif}{col 26}{...}
variance inflation factors (after {cmd:regress})
{helpb estadd##pcorr:pcorr}{col 26}{...}
partial (and semi-partial) correlations
{helpb estadd##expb:expb}{col 26}{...}
exponentiated coefficients
{helpb estadd##ebsd:ebsd}{col 26}{...}
standardized factor change coefficients
{helpb estadd##mean:mean}{col 26}{...}
means of regressors
{helpb estadd##sd:sd}{col 26}{...}
standard deviations of regressors
{helpb estadd##summ:summ}{col 26}{...}
various descriptives of the regressors
Summary statistics
{helpb estadd##coxsnell:coxsnell}{col 26}{...}
Cox & Snell's pseudo R-squared
{helpb estadd##nagelkerke:nagelkerke}{col 26}{...}
Nagelkerke's pseudo R-squared
{helpb estadd##lrtest:lrtest} {it:model}{col 26}{...}
likelihood-ratio test
{helpb estadd##ysumm:ysumm}{col 26}{...}
descriptives of the dependent variable
Other
{helpb estadd##margins:margins}{col 26}{...}
add results from {cmd:margins} (Stata 11)
{help estadd##spost:SPost}
{helpb estadd##brant:brant}{col 26}{...}
add results from {cmd:brant} (if installed)
{helpb estadd##fitstat:fitstat}{col 26}{...}
add results from {cmd:fitstat} (if installed)
{helpb estadd##listcoef:listcoef}{col 26}{...}
add results from {cmd:listcoef} (if installed)
{helpb estadd##mlogtest:mlogtest}{col 26}{...}
add results from {cmd:mlogtest} (if installed)
{helpb estadd##prchange:prchange}{col 26}{...}
add results from {cmd:prchange} (if installed)
{helpb estadd##prvalue:prvalue}{col 26}{...}
add results from {cmd:prvalue} (if installed)
{helpb estadd##asprvalue:asprvalue}{col 26}{...}
add results from {cmd:asprvalue} (if installed)
{hline 64}
{marker opts}
{it:{help estadd##options:options}}{col 26}description
{hline 64}
{cmdab:r:eplace}{col 26}{...}
permit overwriting existing {cmd:e()}'s
{cmdab:p:refix(}{it:string}{cmd:)}{col 26}{...}
specify prefix for names of added results
{cmdab:q:uietly}{col 26}{...}
suppress output from subcommand (if any)
{it:subcmdopts}{col 26}{...}
subcommand specific options
{hline 64}
{title:Description}
{p 4 4 2}
{cmd:estadd} adds additional results to the {cmd:e()}-returns of an
estimation command (see help {help estcom}, help {helpb ereturn}). If no
{it:namelist} is provided, then the results are added to the
currently active estimates (i.e. the model fit last). If these
estimates have been previously stored, the stored copy of the
estimates will also be modified. Alternatively, if {it:namelist} is
provided after the colon, results are added to all indicated sets of
stored estimates (see help {helpb estimates store} or help
{helpb eststo}). You may use the {cmd:*} and {cmd:?}
wildcards in {it:namelist}. Execution is silent if {it:namelist} is
provided.
{p 4 4 2}
Adding additional results to the {cmd:e()}-returns is useful, for example,
if the estimates be tabulated by commands such as {helpb estout}
or {helpb esttab}. See the {help estadd##examples:Examples} section below for
illustration of the usage of {cmd:estadd}.
{p 4 4 2}Technical note: Some of the subcommands below make use of the
information contained in {cmd:e(sample)} to determine estimation sample.
These subcommands return error if the estimates do not contain
{cmd:e(sample)}.
{title:Subcommands}
{dlgtab:Elementary}
{marker local}
{p 4 8 2}
{cmd:estadd} {cmdab:loc:al} {it:name ...}
{p 8 8 2}
adds in macro {cmd:e(}{it:name}{cmd:)} the specified contents (also
see help {helpb ereturn}).
{marker scalar}
{p 4 8 2}
{cmd:estadd} {cmdab:sca:lar} {it:name} {cmd:=} {it:exp}
{p 8 8 2}
adds in scalar {cmd:e(}{it:name}{cmd:)} the evaluation of {it:exp}
(also see help {helpb ereturn}).
{p 4 8 2}
{cmd:estadd} {cmdab:sca:lar} {cmd:r(}{it:name}{cmd:)}
{p 8 8 2}
adds in scalar {cmd:e(}{it:name}{cmd:)} the value of scalar {cmd:r(}{it:name}{cmd:)}.
{p 4 8 2}
{cmd:estadd} {cmdab:sca:lar} {it:name}
{p 8 8 2}
adds in scalar {cmd:e(}{it:name}{cmd:)} the the value of scalar {it:name}.
{marker matrix}
{p 4 8 2}
{cmd:estadd} {cmdab:mat:rix} {it:name} {cmd:=} {it:matrix_expression}
{p 8 8 2}
adds in matrix {cmd:e(}{it:name}{cmd:)} the evaluation of {it:matrix_expression}
(also see help {helpb matrix define}).
{p 4 8 2}
{cmd:estadd} {cmdab:mat:rix} {cmd:r(}{it:name}{cmd:)}
{p 8 8 2}
adds in matrix {cmd:e(}{it:name}{cmd:)} a copy of matrix {cmd:r(}{it:name}{cmd:)}.
{p 4 8 2}
{cmd:estadd} {cmdab:mat:rix} {it:name}
{p 8 8 2}
adds in matrix {cmd:e(}{it:name}{cmd:)} a copy of matrix {it:name}.
{marker rreturn}
{p 4 8 2}
{cmd:estadd} {cmd:r(}{it:name}{cmd:)}
{p 8 8 2}
adds in {cmd:e(}{it:name}{cmd:)} the value of scalar {cmd:r(}{it:name}{cmd:)}
or a copy of matrix {cmd:r(}{it:name}{cmd:)}, depending on the nature of
{cmd:r(}{it:name}{cmd:)}.
{dlgtab:Statistics for each coefficient}
{marker beta}
{p 4 8 2}
{cmd:estadd} {cmd:beta}
{p 8 8 2}
adds in {cmd:e(beta)} the standardized beta coefficients.
{marker vif}
{p 4 8 2}
{cmd:estadd} {cmd:vif} [{cmd:,} {cmdab:tol:erance} {cmdab:sqr:vif} ]
{p 8 8 2}
adds in {cmd:e(vif)} the variance inflation factors (VIFs) for the
regressors (see help {helpb vif}). Note that {cmd:vif} only works
with estimates produced by {helpb regress}. {cmd:tolerance}
additionally adds the tolerances (1/VIF) in {cmd:e(tolerance)}.
{cmd:sqrvif} additionally adds the square roots of the VIFs in
{cmd:e(sqrvif)}.
{marker pcorr}
{p 4 8 2}
{cmd:estadd} {cmd:pcorr} [{cmd:, semi} ]
{p 8 8 2}
adds the partial correlations (see help {helpb pcorr}) and,
optionally, the semi-partial correlations between the dependent
variable and the individual regressors (see, e.g., the {cmd:pcorr2}
package from the SSC Archive). In the case of multiple-equations
models, the results are computed for the first equation only. The
partial correlations will be returned in {cmd:e(pcorr)} and, if
{cmd:semi} is specified, the semi-partial correlations will be
returned in {cmd:e(spcorr)}.
{marker expb}
{p 4 8 2}
{cmd:estadd} {cmd:expb} [{cmd:,} {cmdab:nocons:tant} ]
{p 8 8 2}
adds in {cmd:e(expb)} the exponentiated coefficients (see the help
{it:{help eform_option}}). {cmd:noconstant} excludes the constant
from the added results.
{marker ebsd}
{p 4 8 2}
{cmd:estadd} {cmd:ebsd}
{p 8 8 2}
adds in {cmd:e(ebsd)} the standardized factor change coefficients,
i.e. exp(b_jS_j), where b_j is the raw coefficient and S_j is the
standard deviation of regressor j, that are sometimes reported for
logistic regression (see Long 1997).
{marker mean}
{p 4 8 2}
{cmd:estadd} {cmd:mean}
{p 8 8 2}
adds in {cmd:e(mean)} the means of the regressors.
{marker sd}
{p 4 8 2}
{cmd:estadd} {cmd:sd} [{cmd:,} {cmdab:nob:inary} ]
{p 8 8 2}
adds in {cmd:e(sd)} the standard deviations of the regressors.
{cmd:nobinary} suppresses the computation of the standard deviation
for 0/1 variables.
{marker summ}
{p 4 8 2}
{cmd:estadd} {cmd:summ} [{cmd:,} {it:stats} ]
{p 8 8 2}
adds vectors of the regressors' descriptive statistics to the
estimates. The following {it:stats} are available:
{p_end}
{marker stats}
{it:stats}{col 26}description
{hline 59}
{cmdab:me:an}{col 26}mean
{cmdab:su:m}{col 26}sum
{cmdab:mi:n}{col 26}minimum
{cmdab:ma:x}{col 26}maximum
{cmdab:ra:nge}{col 26}range = max - min
{cmd:sd}{col 26}standard deviation
{cmdab:v:ar}{col 26}variance
{cmd:cv}{col 26}coefficient of variation (sd/mean)
{cmdab:sem:ean}{col 26}standard error of mean = sd/sqrt(n)
{cmdab:sk:ewness}{col 26}skewness
{cmdab:k:urtosis}{col 26}kurtosis
{cmd:p1}{col 26}1st percentile
{cmd:p5}{col 26}5th percentile
{cmd:p10}{col 26}10th percentile
{cmd:p25}{col 26}25th percentile
{cmd:p50}{col 26}50th percentile
{cmd:p75}{col 26}75th percentile
{cmd:p90}{col 26}90th percentile
{cmd:p95}{col 26}95th percentile
{cmd:p99}{col 26}99th percentile
{cmd:iqr}{col 26}interquartile range = p75 - p25
{cmd:all}{col 26}all of the above
{cmdab:med:ian}{col 26}equivalent to specifying "{cmd:p50}"
{cmd:q}{col 26}equivalent to specifying "{cmd:p25 p50 p75}"
{hline 59}
{p 8 8 2}
The default is {cmd:mean sd min max}. Alternatively, indicate the
desired statistics. For example, to add information on the
regressors' skewness and kurtosis, type
{inp:. estadd summ, skewness kurtosis}
{p 8 8 2}
The statistics names are used as the names for the returned {cmd:e()}
matrices. For example, {cmd:estadd summ, mean} will store the means
of the regressors in {cmd:e(mean)}.
{dlgtab:Summary statistics}
{marker coxsnell}
{p 4 8 2}
{cmd:estadd} {cmd:coxsnell}
{p 8 8 2}
adds in {cmd:e(coxsnell)} the Cox & Snell pseudo R-squared, which is
defined as
{p 12 12 2}
r2_coxsnell = 1 - ( L0 / L1 )^(2/N)
{p 8 8 2}
where L0 is the likelihood of the model without regressors, L1 the
likelihood of the full model, and N is the sample size.
{marker nagelkerke}
{p 4 8 2}
{cmd:estadd} {cmd:nagelkerke}
{p 8 8 2}
adds in {cmd:e(nagelkerke)} the Nagelkerke pseudo R-squared (or Cragg
& Uhler pseudo R-squared), which is defined as
{p 12 12 2}
r2_nagelkerke = r2_coxsnell / (1 - L0^(2/N))
{marker lrtest}
{p 4 8 2}
{cmd:estadd} {cmd:lrtest} {it:model} [{cmd:,} {cmdab:n:ame:(}{it:string}{cmd:)}
{it:{help lrtest:lrtest_options}} ]
{p 8 8 2}
adds the results from a likelihood-ratio test, where {it:model} is
the comparison model (see help {helpb lrtest}). Added are
{cmd:e(lrtest_chi2)}, {cmd:e(lrtest_df)}, and {cmd:e(lrtest_p)}. The
names may be modified using the {cmd:name()} option. Specify
{cmd:name(}{it:myname}{cmd:)} to add {cmd:e(}{it:myname}{cmd:chi2)},
{cmd:e(}{it:myname}{cmd:df)}, and {cmd:e(}{it:myname}{cmd:p)}. See
help {helpb lrtest} for the {it:lrtest_options}.
{marker ysumm}
{p 4 8 2}
{cmd:estadd} {cmd:ysumm} [{cmd:,} {it:stats} ]
{p 8 8 2}
adds descriptive statistics of the dependent variable. See the
{helpb estadd##summ:summ} subcommand above for a list of the available
{it:stats}. The default is {cmd:mean sd min max}. The default prefix
for the names of the added scalars is {cmd:y} (e.g. the mean of the
dependent variable will be returned in {cmd:e(ymean)}). Use
{cmd:estadd}'s {cmd:prefix()} option to change the prefix. If a model
has multiple dependent variables, results for the first variable will
be added.
{dlgtab:Other}
{marker margins}
{p 4 8 2}
{cmd:estadd} {cmd:margins} [{it:marginlist}] [{it:if}] [{it:in}] [{it:weight}] [, {it:options} ]
{p 8 8 2}
adds results from the {cmd:margins} command, which was introduced
in Stata 11. See help {helpb margins} for options. All results returned by
{cmd:margins} except {cmd:e(V)} are added using "{cmd:margins_}" as a default
prefix. For example, the margins are added in {cmd:e(margins_b)}. The
standard errors are added in {cmd:e(margins_se)}. Use the {helpb estadd##opts:prefix()}
option to change the default prefix.
{marker spost}
{dlgtab:SPost}
{p 4 4 2} The following subcommands are wrappers for
commands from Long and Freese's {helpb SPost} package (see
{browse "http://www.indiana.edu/~jslsoc/spost.htm":http://www.indiana.edu/~jslsoc/spost.htm}). Type
. {net "from http://www.indiana.edu/~jslsoc/stata":net from http://www.indiana.edu/~jslsoc/stata}
{p 4 4 2}
to obtain the latest {cmd:SPost} version (spost9_ado). {cmd:SPost} for Stata 8 (spostado) is not
supported.
{p 4 4 2}For examples on using the subcommands see
{browse "http://repec.org/bocode/e/estout/spost.html":http://repec.org/bocode/e/estout/spost.html}.
{marker brant}
{p 4 8 2}
{cmd:estadd brant} [{cmd:,} {it:{help brant:brant_options}} ]
{p 8 8 2}
applies {helpb brant} from Long and
Freese's {helpb SPost} package and adds the returned results to
{cmd:e()}. You may specify {it:brant_options} as described in
help {helpb brant}. The following results are added:
{cmd:e(}{it:...}{cmd:)} Contents
{hline 60}
Scalars
{cmd:brant_chi2} Chi-squared of overall Brant test
{cmd:brant_df} Degrees of freedom of overall Brant test
{cmd:brant_p} P-value of overall Brant test
Matrix
{cmd:brant} Test results for individual regressors
(rows: chi2, p<chi2)
{hline 60}
{p 4 4 2}To address the rows of {cmd:e(brant)} in {helpb estout}'s {cmd:cells()}
option type {cmd:brant[chi2]} and {cmd:brant[p<chi2]}.
{marker fitstat}
{p 4 8 2}
{cmd:estadd fitstat} [{cmd:,} {it:{help fitstat:fitstat_options}} ]
{p 8 8 2}
applies {helpb fitstat} from Long and
Freese's {helpb SPost} package and adds the returned scalars to
{cmd:e()}. You may specify {it:fitstat_options} as described in
help {helpb fitstat}. Depending on model
and options, a selection of the following scalar statistics is added:
{cmd:e(}{it:...}{cmd:)} Contents
{hline 60}
{cmd:dev} Deviance (D)
{cmd:dev_df} Degrees of freedom of D
{cmd:lrx2} LR or Wald X2
{cmd:lrx2_df} Degrees of freedom of X2
{cmd:lrx2_p} Prob > LR or Wald X2
{cmd:r2_adj} Adjusted R2
{cmd:r2_mf} McFadden's R2
{cmd:r2_mfadj} McFadden's Adj R2
{cmd:r2_ml} ML (Cox-Snell) R2
{cmd:r2_cu} Cragg-Uhler(Nagelkerke) R2
{cmd:r2_mz} McKelvey & Zavoina's R2
{cmd:r2_ef} Efron's R2
{cmd:v_ystar} Variance of y*
{cmd:v_error} Variance of error
{cmd:r2_ct} Count R2
{cmd:r2_ctadj} Adj Count R2
{cmd:aic0} AIC
{cmd:aic_n} AIC*n
{cmd:bic0} BIC
{cmd:bic_p} BIC'
{cmd:statabic} BIC used by Stata
{cmd:stataaic} AIC used by Stata
{cmd:n_rhs} Number of rhs variables
{cmd:n_parm} Number of parameters
{hline 60}
{marker listcoef}
{p 4 8 2}
{cmd:estadd listcoef} [{it:varlist}] [{cmd:,} {cmd:nosd} {it:{help listcoef:listcoef_options}} ]
{p 8 8 2}
applies {helpb listcoef} from Long and
Freese's {helpb SPost} package and adds the returned results to
{cmd:e()}. You may specify {it:listcoef_options} as described in
help {helpb listcoef}. Furthermore, option {cmd:nosd} suppresses
adding the standard deviations of the variables in {cmd:e(b_sdx)}.
{p 8 8 2}Depending on the estimation command and options, several of the
following matrices are added:
{cmd:e(}{it:...}{cmd:)} Contents
{hline 60}
{cmd:b_xs} x-standardized coefficients
{cmd:b_ys} y-standardized coefficients
{cmd:b_std} Fully standardized coefficients
{cmd:b_fact} Factor change coefficients
{cmd:b_facts} Standardized factor change coefficients
{cmd:b_pct} Percent change coefficients
{cmd:b_pcts} Standardized percent change coefficients
{cmd:b_sdx} Standard deviation of the Xs
{hline 60}
{p 8 8 2}For nominal models ({helpb mlogit}, {helpb mprobit}) the
original parametrization of {cmd:e(b)} may not match the contrasts
computed by {cmd:listcoef}. To be able to tabulate standardized
coefficients along with the raw coefficients for the requested
contrasts, the following additional matrices are added for
these models:
{cmd:e(}{it:...}{cmd:)} Contents
{hline 60}
{cmd:b_raw} raw coefficients
{cmd:b_se} standard errors of raw coefficients
{cmd:b_z} z statistics
{cmd:b_p} p-values
{hline 60}
{marker mlogtest}
{p 4 8 2}
{cmd:estadd mlogtest} [{it:varlist}] [{cmd:,} {it:{help mlogtest:mlogtest_options}} ]
{p 8 8 2}
applies {helpb mlogtest} from Long and
Freese's {helpb SPost} package and adds the returned results to
{cmd:e()}. You may specify {it:mlogtest_options} as described in
help {helpb mlogtest}.
{p 8 8 2}Depending on the specified options, a selection of the following
returns are added:
{cmd:e(}{it:...}{cmd:)} Contents
{hline 60}
Scalars
{cmd:hausman_set}{it:#}{cmd:_chi2} Hausman IIA tests using {helpb hausman}
{cmd:hausman_set}{it:#}{cmd:_df}
{cmd:hausman_set}{it:#}{cmd:_p}
{cmd:suest_set}{it:#}{cmd:_chi2} Hausman IIA tests using {helpb suest}
{cmd:suest_set}{it:#}{cmd:_df}
{cmd:suest_set}{it:#}{cmd:_p}
{cmd:smhsiao_set}{it:#}{cmd:_chi2} Small-Hsiao IIA tests
{cmd:smhsiao_set}{it:#}{cmd:_df}
{cmd:smhsiao_set}{it:#}{cmd:_p}
{cmd:combine_}{it:#1}{cmd:_}{it:#2}{cmd:_chi2} Wald tests for combination of outcomes
{cmd:combine_}{it:#1}{cmd:_}{it:#2}{cmd:_df}
{cmd:combine_}{it:#1}{cmd:_}{it:#2}{cmd:_p}
{cmd:lrcomb_}{it:#1}{cmd:_}{it:#2}{cmd:_chi2} LR tests for combination of outcomes
{cmd:lrcomb_}{it:#1}{cmd:_}{it:#2}{cmd:_df}
{cmd:lrcomb_}{it:#1}{cmd:_}{it:#2}{cmd:_p}
{cmd:wald_set}{it:#}{cmd:_chi2} Wald tests for sets of independent
{cmd:wald_set}{it:#}{cmd:_df} variables
{cmd:wald_set}{it:#}{cmd:_p}
{cmd:lrtest_set}{it:#}{cmd:_chi2} LR tests for sets of independent
{cmd:lrtest_set}{it:#}{cmd:_df} variables
{cmd:lrtest_set}{it:#}{cmd:_p}
Matrices
{cmd:wald} Wald tests for individual variables
(rows: chi2, df, p)
{cmd:lrtest} LR tests for individual variables
(rows: chi2, df, p)
{hline 60}
{p 4 4 2}To address the rows of {cmd:e(wald)} and {cmd:e(lrtest)} in {helpb estout}'s
{cmd:cells()} option type the row names in brackets, for example, {cmd:wald[p]} or
{cmd:lrtest[chi2]}.
{marker prchange}
{p 4 8 2}
{cmd:estadd prchange} [{it:varlist}] [{cmd:if} {it:exp}] [{cmd:in} {it:range}] [{cmd:,}
{cmdab:pa:ttern(}{it:typepattern}{cmd:)} {cmdab:b:inary(}{it:type}{cmd:)} {cmdab:c:ontinuous(}{it:type}{cmd:)}
[{cmd:no}]{cmdab:a:vg} {cmd:split}[{cmd:(}{it:prefix}{cmd:)}] {it:{help prchange:prchange_options}} ]
{p 8 8 2}
applies {helpb prchange} from Long and
Freese's {helpb SPost} package and adds the returned results to
{cmd:e()}. You may specify {it:prchange_options} as described in
help {helpb prchange}. In particular, the {cmd:outcome()} option may be
used with models for count, ordered, or nominal outcomes
to request results for a specific outcome. Further options are:
{p 8 12 2}{cmd:pattern(}{it:typepattern}{cmd:)}, {cmd:binary(}{it:type}{cmd:)}, and
{cmd:continuous(}{it:type}{cmd:)} to determine which types of discrete change
effects are added as the main results. The default is to add the 0 to 1
change effect for binary variables and the standard deviation change effect
for continuous variables. Use {cmd:binary(}{it:type}{cmd:)} and
{cmd:continuous(}{it:type}{cmd:)} to change these defaults. Available
types are:
{it:type} Description
{hline 48}
{cmdab:mi:nmax} minimum to maximum change effect
{cmdab:0:1} 0 to 1 change effect
{cmdab:d:elta} {cmd:delta()} change effect
{cmdab:s:d} standard deviation change effect
{cmdab:m:argefct} marginal effect (some models only)
{hline 48}
{p 12 12 2}Use {cmd:pattern(}{it:typepattern}{cmd:)} if you want to determine the
type of the added effects individually for each regressor. For example,
{bind:{cmd:pattern(minmax sd delta)}} would add {cmd:minmax} for the first regressor,
{cmd:sd} for the second, and {cmd:delta} for the third, and then proceed
using the defaults for the remaining variables.
{p 8 12 2}{cmd:avg} to request that only the average results over
all outcomes are added if applied to ordered
or nominal models ({helpb ologit}, {helpb oprobit}, {helpb slogit}, {helpb mlogit}, {helpb mprobit}). The
default is to add the average results as well as the individual results for
the different outcomes (unless {helpb prchange}'s {cmd:outcome()} option is
specified, in which case only results for the indicated outcome are
added). Furthermore, specify {cmd:noavg} to suppress the average results
and only add the outcome-specific results. {cmd:avg} cannot be combined with {cmd:split}
or {cmd:outcome()}.
{p 8 12 2}{cmd:split}[{cmd:(}{it:prefix}{cmd:)}] to save
each outcome's results in a separate estimation set if applied to ordered
or nominal models ({helpb ologit}, {helpb oprobit}, {helpb slogit}, {helpb mlogit},
{helpb mprobit}). The estimation sets are named
{it:prefix}{it:#}, where {it:#} is the value of the outcome at hand. If no
{it:prefix} is provided, the name of the estimation set followed by an
underscore is used as the prefix. If the estimation set has no name
(because it has not been stored yet) the name of the estimation command
followed by an underscore is used as the prefix (e.g. {cmd:ologit_}). The
estimation sets stored by the {cmd:split} option are intended for
tabulation only and should not be used with other post-estimation
commands.
{p 8 8 2}Depending on model and options, several of the following matrices
and scalars are added:
{cmd:e(}{it:...}{cmd:)} Contents
{hline 60}
Scalars
{cmd:centered} {cmd:1} if effects are centered, {cmd:0} else
{cmd:delta} Value of {cmd:delta()}
{cmd:predval}[{it:#}] Prediction(s) at the base values
{cmd:outcome} Outcome value ({cmd:outcome()}/{cmd:split} only)
Matrices
{cmd:dc} Discrete change effects (rows: main, minmax,
01, delta, sd [, margefct])
{cmd:pattern} Types of effects in the main row of {cmd:e(dc)}
{cmd:X} Base values and descriptive statistics
(rows: X, SD, Min, Max)
{hline 60}
{p 8 8 2}The {cmd:e(dc)} and {cmd:e(X)} matrices have multiple rows. The
{cmd:e(dc)} matrix contains the main results as determined by
{cmd:pattern()}, {cmd:binary()}, and {cmd:continuous()} in the first row.
The second and following rows contain the separate results for each type of
effect using the labels provided by {cmd:prchange} as row names. Type
{cmd:dc[}{it:#}{cmd:]} or {cmd:dc[}{it:rowname}{cmd:]} to address the rows
in {helpb estout}'s {cmd:cells()} option, where {it:#} is the row number
or {it:rowname} is the
row name. For example, type {cmd:dc[-+sd/2]} to address the centered
standard deviation change effects. To tabulate the main results (1st row),
simply type {cmd:dc}. {cmd:e(pattern)} indicates the types of effects
contained in the main row of {cmd:e(dc)} using numeric codes. The codes are 1
for the minimum to maximum change effect, 2 for the 0 to 1 change effect, 3
for the {cmd:delta()} change effect, 4 for the standard deviation change
effect, and 5 for the marginal effect. {cmd:e(X)} has four rows
containing the base values, standard deviations, minimums, and maximums. If
the {cmd:fromto} option is specified, two additional matrices,
{cmd:e(dcfrom)} and {cmd:e(dcto)} are added.
{marker prvalue}
{p 4 8 2}
{cmd:estadd prvalue} [{cmd:if} {it:exp}] [{cmd:in} {it:range}] [{cmd:,} {cmdab:lab:el:(}{it:string}{cmd:)}
{it:{help prvalue:prvalue_options}} ]
{p 4 8 2}
{cmd:estadd prvalue} {cmd:post} [{it:name}] [{cmd:,} {cmdab:t:itle:(}{it:string}{cmd:)} {cmd:swap} ]
{p 8 8 2} applies {helpb prvalue} from Long and Freese's {helpb SPost}
package and adds the returned results to {cmd:e()}. The procedure is to
first collect a series of predictions by repeated calls to
{cmd:estadd prvalue} and then apply {cmd:estadd prvalue post} to prepare the results
for tabulation as in the following example:
{com}. logit lfp k5 k618 age wc hc lwg inc
. estadd prvalue, x(inc 10) label(low inc)
. estadd prvalue, x(inc 20) label(med inc)
. estadd prvalue, x(inc 30) label(high inc)
. estadd prvalue post
. estout{txt}
{p 8 8 2} You may specify {it:prvalue_options} with {cmd:estadd prvalue} as
described in help {helpb prvalue}. For example, use {cmd:x()} and
{cmd:rest()} to set the values of the independent variables. Use
{cmd:label()} to label the single calls. "pred#" is used as label if
{cmd:label()} is omitted, where # is the number of the call. Labels may
contain spaces but they will be trimmed to a maximum
length of 30 characters and some characters ({cmd::},
{cmd:.}, {cmd:"}) will be replaced by underscore. The results
from the single calls are collected in matrix {cmd:e(_estadd_prvalue)}
(predictions) and matrix {cmd:e(_estadd_prvalue_x)} (x-values). Specify
{cmd:replace} to drop results from previous calls.
{p 8 8 2}
{cmd:estadd prvalue post} posts the collected predictions in {cmd:e(b)}
so that they can be tabulated. The following results are saved:
{cmd:e(}{it:...}{cmd:)} Contents
{hline 60}
Scalars
{cmd:N} number of observations
Macros
{cmd:depvar} name of dependent variable
{cmd:cmd} {cmd:estadd_prvalue}
{cmd:model} model estimation command
{cmd:properties} {cmd:b}
Matrices
{cmd:b} predictions
{cmd:se} standard errors
{cmd:LB} lower confidence interval bounds
{cmd:UB} upper confidence interval bounds
{cmd:Category} outcome values
{cmd:Cond} conditional predictions (some models only)
{cmd:X} values of predictors (for each prediction)
{cmd:X2} second equation predictors (some models only)
{hline 60}
{p 8 8 2} {cmd:estadd prvalue post} replaces the current model unless
{it:name} is specified, in which case the results are stored under {it:name} and the model
remains active. However, if the model has a name
(because it has been stored), the name of the model is used as a prefix.
If, for example, the model has been stored as {cmd:model1}, then
{cmd:estadd prvalue post} stores its results under {cmd:model1}{it:name}.
Use {cmd:title()} to specify a title for the stored results.
{p 8 8 2}The default for {cmd:estadd prvalue post} is to arrange
{cmd:e(b)} in a way so that predictions are grouped by outcome (i.e. outcome labels are used
as equations). Alternatively, specify {cmd:swap} to group predictions by
{cmd:prvalue} calls (i.e. to use the prediction labels as equations).
{p 8 8 2}{cmd:e(X)} contains one row for each independent variable. To address the rows in
{helpb estout}'s {cmd:cells()} option type {cmd:X[}{it:varname}{cmd:]}, where {it:varname} is
the name of the variable of interest. {cmd:e(X2)}, if provided, is analogous to {cmd:e(X)}.
{marker asprvalue}
{p 4 8 2}
{cmd:estadd asprvalue} [{cmd:,} {cmdab:lab:el:(}{it:string}{cmd:)}
{it:{help asprvalue:asprvalue_options}} ]
{p 4 8 2}
{cmd:estadd asprvalue} {cmd:post} [{it:name}] [{cmd:,} {cmdab:t:itle:(}{it:string}{cmd:)} {cmd:swap} ]
{p 8 8 2} applies {helpb asprvalue} from Long and Freese's {helpb SPost}
package and adds the returned results to {cmd:e()}. The procedure is to
first collect a series of predictions by repeated calls to
{cmd:estadd asprvalue} and then apply {cmd:estadd asprvalue post} to prepare the results
for tabulation as in the following example:
{com}. clogit choice train bus time invc, group(id)
. estadd asprvalue, cat(train bus) label(at means)
. estadd asprvalue, cat(train bus) rest(asmean) label(at asmeans)
. estadd asprvalue post
. estout{txt}
{p 8 8 2} You may specify {it:asprvalue_options} with {cmd:estadd asprvalue} as
described in help {helpb asprvalue}. For example, use {cmd:x()} and
{cmd:rest()} to set the values of the independent variables. Use
{cmd:label()} to label the single calls. "pred#" is used as label if
{cmd:label()} is omitted, where # is the number of the call. Labels may
contain spaces but they will be trimmed to a maximum
length of 30 characters and some characters ({cmd::},
{cmd:.}, {cmd:"}) will be replaced by underscore. The results
from the single calls are collected in matrices {cmd:e(_estadd_asprval)}
(predictions), {cmd:e(_estadd_asprval_asv)} (values of alternative-specific
variables), and {cmd:e(_estadd_asprval_csv)} (values of case-specific
variables). Specify {cmd:replace} to drop results from previous calls.
{p 8 8 2}
{cmd:estadd asprvalue post} posts the collected predictions in {cmd:e(b)}
so that they can be tabulated. The following results are saved:
{cmd:e(}{it:...}{cmd:)} Contents
{hline 60}
Scalars
{cmd:N} number of observations
Macros
{cmd:depvar} name of dependent variable
{cmd:cmd} {cmd:estadd_asprvalue}
{cmd:model} model estimation command
{cmd:properties} {cmd:b}
Matrices
{cmd:b} predictions
{cmd:asv} alternative-specific variables (if available)
{cmd:csv} case-specific variables (if available)
{hline 60}
{p 8 8 2} {cmd:estadd asprvalue post} replaces the current model unless
{it:name} is specified, in which case the results are stored under
{it:name} and the model remains active. However, if the model has a name
(because it has been stored), the name of the model is used as a prefix.
If, for example, the model has been stored as {cmd:model1}, then
{cmd:estadd asprvalue post} stores its results under {cmd:model1}{it:name}.
Use {cmd:title()} to specify a title for the stored results.
{p 8 8 2}The default for {cmd:estadd asprvalue post} is to arrange
{cmd:e(b)} in a way so that predictions are grouped by outcome (i.e. outcome labels are used
as equations). Alternatively, specify {cmd:swap} to group predictions by
{cmd:prvalue} calls (i.e. to use the prediction labels as equations).
{p 8 8 2}{cmd:e(asv)} and {cmd:e(csv)} contain one row for each variable.
To address the rows in {helpb estout}'s {cmd:cells()} option type
{cmd:asv[}{it:varname}{cmd:]} or {cmd:csv[}{it:varname}{cmd:]}, where
{it:varname} is the name of the variable of interest.
{marker options}
{title:Options}
{p 4 8 2}
{cmd:replace} permits {cmd:estadd} to overwrite existing {cmd:e()}
macros, scalars, or matrices.
{p 4 8 2}
{cmd:prefix(}{it:string}{cmd:)} denotes a prefix for the names of the
added results. The default prefix is an empty string. For example, if
{cmd:prefix(}{it:string}{cmd:)} is specified, the {cmd:beta}
subcommand will return the matrix {cmd:e(}{it:string}{cmd:beta)}.
{p 4 8 2}{cmd:quietly} suppresses the output from the called subcommand and displays only
the list of added results. Note that many of {cmd:estadd}'s subcommands do not generate
output, in which case {cmd:quietly} has no effect.
{p 4 8 2}
{it:subcmdopts} are subcommand specific options. See the descriptions
of the subcommands above.
{marker examples}
{title:Examples}
{p 4 4 2}Example 1: Add {cmd:r()}-returns from other programs to the
current estimates
{com}. sysuse auto
{txt}(1978 Automobile Data)
{com}. quietly regress price mpg weight
{txt}
{com}. test mpg=weight
{txt} ( 1) {res}mpg - weight = 0
{txt} F( 1, 71) ={res} 0.36
{txt}{col 13}Prob > F ={res} 0.5514
{txt}
{com}. estadd scalar p_diff = r(p)
{txt}added scalar:
e(p_diff) = {res}.55138216
{txt}
{com}. estout, stats(p_diff)
{res}
{txt}{hline 25}
{txt} b
{txt}{hline 25}
{txt}mpg {res} -49.51222{txt}
{txt}weight {res} 1.746559{txt}
{txt}_cons {res} 1946.069{txt}
{txt}{hline 25}
{txt}p_diff {res} .5513822{txt}
{txt}{hline 25}
{p 4 4 2}Example 2: Add means and standard deviations of the model's regressors
to the current estimates
{com}. quietly logit foreign price mpg
{txt}
{com}. estadd summ, mean sd
{txt}added matrices:
e(sd) : {res}1 x 3
{txt}e(mean) : {res}1 x 3
{txt}
{com}. estout, cells("mean sd") drop(_cons)
{res}
{txt}{hline 38}
{txt} mean sd
{txt}{hline 38}
{txt}price {res} 6165.257 2949.496{txt}
{txt}mpg {res} 21.2973 5.785503{txt}
{txt}{hline 38}
{p 4 4 2}
Example 3: Add standardized beta coefficients to stored estimates
{com}. eststo: quietly regress price mpg
{txt}({res}est1{txt} stored)
{com}. eststo: quietly regress price mpg foreign
{txt}({res}est2{txt} stored)
{com}. estadd beta: *
{txt}
{com}. estout, cells(beta) drop(_cons)
{res}
{txt}{hline 38}
{txt} est1 est2
{txt} beta beta
{txt}{hline 38}
{txt}mpg {res} -.4685967 -.5770712{txt}
{txt}foreign {res} .2757378{txt}
{txt}{hline 38}
{p 4 4 2}See
{browse "http://repec.org/bocode/e/estout":http://repec.org/bocode/e/estout}
for additional examples.
{title:Writing one's own subcommands}
{p 4 4 2}
A program providing a new {cmd:estadd} subcommand should be called
{cmd:estadd_}{it:mysubcommand} (see help {helpb program} for advice
on defining programs). {it:mysubcommand} will be available to {cmd:estadd} as a new
{it:subcommand} after the program definition has been executed or
saved to a file called "estadd_{it:mysubcommand}.ado" in either the
current directory or somewhere else in the {cmd:adopath}
(see help {helpb sysdir}).
{p 4 4 2}
Use the subcommands provided within "estadd.ado" as a starting
point for writing new subcommands. See
{browse "http://repec.org/bocode/e/estout/estadd.html#estadd007":http://repec.org/bocode/e/estout/estadd.html#estadd007}
for an example.
{title:Author}
{p 4 4 2} Ben Jann, ETH Zurich, jannb@ethz.ch
{title:Also see}
Manual: {hi:[R] estimates}
{p 4 13 2}Online: help for
{helpb estimates},
{helpb ereturn},
{helpb program},
{helpb esttab},
{helpb estout},
{helpb eststo},
{helpb estpost}
{p_end}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,343 +0,0 @@
*! version 1.1.0 05nov2008 Ben Jann
program define eststo, byable(onecall)
version 8.2
local caller : di _caller()
// --- eststo clear ---
if `"`1'"'=="clear" {
if `"`0'"'!="clear" {
di as err "invalid syntax"
exit 198
}
if "`_byvars'"!="" error 190
_eststo_clear
exit
}
// --- update globals ---
_eststo_cleanglobal
// --- eststo dir ---
if `"`1'"'=="dir" {
if `"`0'"'!="dir" {
di as err "invalid syntax"
exit 198
}
if "`_byvars'"!="" error 190
_eststo_dir
exit
}
// --- eststo drop ---
if `"`1'"'=="drop" {
if "`_byvars'"!="" error 190
_eststo_`0'
exit
}
// --- eststo store (no by) ---
if "`_byvars'"=="" {
version `caller': _eststo_store `0'
exit
}
// --- eststo store (by) ---
// - check sorting
local sortedby : sortedby
local i 0
foreach byvar of local _byvars {
local sortedbyi : word `++i' of `sortedby'
if "`byvar'"!="`sortedbyi'" error 5
}
// - parse command on if qualified
capt _on_colon_parse `0'
if _rc error 190
if `"`s(after)'"'=="" error 190
local estcom `"`s(after)'"'
local 0 `"`s(before)'"'
if substr(trim(`"`estcom'"'),1,3)=="svy" {
di as err "svy commands not allowed with by ...: eststo:"
exit 190
}
AddBygrpToIfqualifier `estcom'
// - parse syntax of _eststo_store call in order to determine
// whether title() or missing was specified (note that
// -estimates change- cannot be used to set the titles since
// it does not work with -noesample-)
TitleAndMissing `0'
// - generate byindex
tempname _byindex
qui egen long `_byindex' = group(`_byvars'), label `missing'
qui su `_byindex', meanonly
if r(N)==0 error 2000
local Nby = r(max)
// - loop over bygroups
forv i = 1/`Nby' {
local ibylab: label (`_byindex') `i'
di as txt _n "{hline}"
di as txt `"-> `ibylab'"' // could be improved
if `titleopt'==0 local ibytitle
else if `titleopt'==1 local ibytitle `" title(`ibylab')"'
else if `titleopt'==2 local ibytitle `", title(`ibylab')"'
capture noisily {
version `caller': _eststo_store `0'`ibytitle' : `estcmd'
}
if _rc {
if "`_byrc0'"=="" error _rc
}
}
end
prog TitleAndMissing
capt syntax [anything] , Title(string) [ MISsing * ]
if _rc==0 {
c_local titleopt 0
c_local missing "`missing'"
}
else {
syntax [anything] [ , MISsing * ]
if `"`missing'`options'"'!="" c_local titleopt 1
else c_local titleopt 2
c_local missing "`missing'"
}
end
program AddBygrpToIfqualifier
syntax anything(equalok) [if/] [in] [using] [fw aw pw iw] [, * ]
local estcom `"`macval(anything)' if (\`_byindex'==\`i')"'
if `"`macval(if)'"'!="" {
local estcom `"`macval(estcom)' & (`macval(if)')"'
}
if `"`macval(in)'"'!="" {
local estcom `"`macval(estcom)' `macval(in)'"'
}
if `"`macval(using)'"'!="" {
local estcom `"`macval(estcom)' `macval(using)'"'
}
if `"`macval(weight)'"'!="" {
local estcom `"`macval(estcom)' [`macval(weight)'`macval(exp)']"'
}
if `"`macval(options)'"'!="" {
local estcom `"`macval(estcom)', `macval(options)'"'
}
c_local estcmd `"`macval(estcom)'"'
end
program define _eststo_clear
local names $eststo
foreach name of local names {
capt estimates drop `name'
}
global eststo
global eststo_counter
end
program define _eststo_dir
if `"$eststo"'!="" {
estimates dir $eststo
}
end
program define _eststo_cleanglobal
local enames $eststo
if `"`enames'"'!="" {
tempname hcurrent
_return hold `hcurrent'
qui _estimates dir
local snames `r(names)'
_return restore `hcurrent'
}
local names: list enames & snames
global eststo `names'
if "`names'"=="" global eststo_counter
end
program define _eststo_drop
local droplist `0'
if `"`droplist'"'=="" {
di as error "someting required"
exit 198
}
local names $eststo
foreach item of local droplist {
capt confirm integer number `item'
if _rc {
local dropname `item'
}
else {
if `item'<1 {
di as error "`item' not allowed"
exit 198
}
local dropname est`item'
}
local found 0
foreach name in `names' {
if match("`name'",`"`dropname'"') {
local found 1
estimates drop `name'
local names: list names - name
di as txt "(" as res "`name'" as txt " dropped)"
}
}
if `found'==0 {
di as txt "(no matches found for " as res `"`dropname'"' as txt ")"
}
}
global eststo `names'
end
program define _eststo_store, eclass
local caller : di _caller()
capt _on_colon_parse `0'
if !_rc {
local command `"`s(after)'"'
local 0 `"`s(before)'"'
}
syntax [name] [, ///
Title(passthru) ///
Prefix(name) ///
Refresh Refresh2(numlist integer max=1 >0) ///
ADDscalars(string asis) ///
noEsample ///
noCopy ///
MISsing svy /// doesn't do anything
]
if `"`prefix'"'=="" local prefix "est"
// get previous eststo names and counter
local names $eststo
local counter $eststo_counter
if `"`counter'"'=="" local counter 0
// if name provided; set refresh on if name already in list
if "`namelist'"!="" {
if "`refresh2'"!="" {
di as error "refresh() not allowed"
exit 198
}
local name `namelist'
if `:list name in names' local refresh refresh
else {
if "`refresh'"!="" {
di as txt "(" as res "`name'" as txt " not found)"
}
local refresh
}
if "`refresh'"=="" local ++counter
}
// if no name provided
else {
if "`refresh2'"!="" local refresh refresh
if "`refresh'"!="" {
// refresh2 not provided => refresh last (if available)
if "`refresh2'"=="" {
if "`names'"=="" {
di as txt "(nothing to refresh)"
local refresh
}
else local name: word `:list sizeof names' of `names'
}
// refresh2 provided => check availability
else {
if `:list posof "`prefix'`refresh2'" in names' {
local name `prefix'`refresh2'
}
else {
di as txt "(" as res "`prefix'`refresh2'" as txt " not found)"
local refresh
}
}
}
if "`refresh'"=="" local ++counter
// set default name
if "`name'"=="" local name `prefix'`counter'
}
// run estimation command if provided
if `"`command'"'!="" {
version `caller': `command'
}
// add scalars to e()
if `"`addscalars'"'!="" {
capt ParseAddscalars `addscalars'
if _rc {
di as err `"addscalars() invalid"'
exit 198
}
if "`replace'"=="" {
local elist `: e(scalars)' `: e(macros)' `: e(matrices)' `: e(functions)'
}
local forbidden b V sample
while (1) {
gettoken lhs rest: rest
if `:list lhs in forbidden' {
di as err `"`lhs' not allowed in addscalars()"'
exit 198
}
if "`replace'"=="" {
if `:list lhs in elist' {
di as err `"e(`lhs') already defined"'
exit 110
}
}
gettoken rhs rest: rest, bind
capt eret scalar `lhs' = `rhs'
if _rc {
di as err `"addscalars() invalid"'
exit 198
}
capture local result = e(`lhs')
di as txt "(e(" as res `"`lhs'"' as txt ") = " ///
as res `result' as txt " added)"
if `"`rest'"'=="" continue, break
}
}
// add e(cmd) if missing
if `"`e(cmd)'"'=="" {
if `"`: e(scalars)'`: e(macros)'`: e(matrices)'`: e(functions)'"'!="" {
eret local cmd "."
}
}
// store estimates with e(sample)
estimates store `name' , `copy' `title'
// remove e(sample) if -noesample- specified
if "`esample'"!="" {
capt confirm new var _est_`name'
if _rc {
tempname hcurrent
_est hold `hcurrent', restore estsystem nullok
qui replace _est_`name' = . in 1
_est unhold `name'
capt confirm new var _est_`name'
if _rc qui drop _est_`name'
else {
di as error "somethings wrong; please contact author of -eststo- " ///
"(see e-mail in help {help eststo})"
exit 498
}
_est hold `name', estimates varname(_est_`name')
// varname() only needed so that _est hold does not return error
// if variable `name' exists
}
}
// report
if "`refresh'"=="" {
global eststo `names' `name'
global eststo_counter `counter'
if `"`namelist'"'=="" {
di as txt "(" as res "`name'" as txt " stored)"
}
}
else {
if `"`namelist'"'=="" {
di as txt "(" as res "`name'" as txt " refreshed)"
}
}
end
program ParseAddscalars
syntax anything [ , Replace ]
c_local rest `"`anything'"'
c_local replace `replace'
end

View File

@ -1,347 +0,0 @@
{smcl}
{* 07jan2009}{...}
{hi:help eststo}{right:also see: {helpb esttab}, {helpb estout}, {helpb estadd}, {helpb estpost}}
{right: {browse "http://repec.org/bocode/e/estout"}}
{hline}
{title:Title}
{p 4 4 2}{hi:eststo} {hline 2} Store estimates
{title:Syntax}{smcl}
{p 8 15 2}
[{cmd:_}]{cmd:eststo} [{it:name}]
[{cmd:,} {it:{help eststo##options:options}} ]
[ {cmd::} {it:{help estimation_command}} ]
{p 8 15 2}
[{cmd:_}]{cmd:eststo dir}
{p 8 15 2}
[{cmd:_}]{cmd:eststo drop} {{it:#}|{it:name}} [ {{it:#}|{it:name}} ... ]
{p 8 15 2}
[{cmd:_}]{cmd:eststo clear}
{marker options}
{it:options}{col 23}description
{hline 56}
[{ul:{cmd:no}}]{cmdab:e:sample}{col 23}{...}
do not/do store {cmd:e(sample)}
{cmdab:t:itle:(}{it:string}{cmd:)}{col 23}{...}
specify a title for the stored set
{cmdab:p:refix:(}{it:prefix}{cmd:)}{col 23}{...}
specify a name prefix; default is {cmd:est}
{cmdab:add:scalars(}{it:...}{cmd:)}{col 23}{...}
add scalar statistics
{cmdab:r:efresh}[{cmd:(}{it:#}{cmd:)}]{col 23}{...}
overwrite a previously stored set
{cmdab:noc:opy}{col 23}{...}
clear {cmd:e()} after storing the set
{cmdab:mis:sing}{col 23}{...}
use missing values in the {cmd:by} groups
{hline 56}
{p 4 4 2}
{cmd:by} is allowed with {cmd:eststo} if {cmd:eststo}
is used as a prefix command, i.e. specify
{cmd:by} {it:...} {cmd::} {cmd:eststo} {it:...} {cmd::} {it:estimation_command}
{p 4 4 2}
to apply {it:estimation_command} to each {cmd:by} group and store an estimation
set for each group; see help {help by}. Note that the implementation of {cmd:by}
with {cmd:eststo} requires {it:estimation_command}
to follow {help language:standard Stata syntax} and
allow the {it:{help if}} qualifier. Do not use the
{bind:{cmd:by} {it:...}{cmd:: eststo:}} construct with
{cmd:svy} commands.
{title:Description}
{p 4 4 2}
{cmd:eststo} stores a copy of the active estimation results for later
tabulation. If {it:name} is provided, the estimation set is stored
under {it:name}. If {it:name} is not provided, the estimation set is
stored under {cmd:est}{it:#}, where {it:#} is a counter for the
number of stored estimation sets.
{p 4 4 2}
{cmd:eststo} may be used in two ways: Either after fitting a model as
in
{com}. regress y x
. eststo{txt}
{p 4 4 2}
or as a prefix command (see help {help prefix}):
{com}. eststo: regress y x{txt}
{p 4 4 2}
{cmd:_eststo} is a variant on {cmd:eststo} that, by default, does not
store the estimation sample information contained in {cmd:e(sample)}.
Essentially, {cmd:_eststo} is a shortcut to {cmd:eststo, noesample}.
{p 4 4 2}
{cmd:eststo dir} displays a list of the stored estimates.
{p 4 4 2}
{cmd:eststo drop} drops estimation sets stored by {cmd:eststo}. If {it:name} is
provided, the estimation set stored under {it:name}
is dropped (if {cmd:*} or {cmd:?} wildcards are used {it:name},
all matching sets are dropped). Alternatively, if {it:#} is provided,
the estimation set stored as {cmd:est}{it:#} is dropped.
{p 4 4 2}
{cmd:eststo clear} drops all estimation sets stored by {cmd:eststo} (and clears
{cmd:eststo}'s global macros).
{p 4 4 2}
{cmd:eststo} is an alternative to official Stata's
{helpb estimates store}. The main differences are:
{p 8 12 2}
{space 1}o{space 2}{cmd:eststo} does not require the user to specify a
name for the stored estimation set.
{p 8 12 2}
{space 1}o{space 2}{cmd:eststo} may be used as a prefix command (see
help {help prefix}).
{p 8 12 2}
{space 1}o{space 2}{cmd:eststo} provides the possibility to store
estimates without the {cmd:e(sample)} function (either specify the
{cmd:noesample} option or use the {cmd:_eststo} command). Omitting
{cmd:e(sample)} saves memory and also speeds up tabulation programs
such as {helpb estimates table}, {helpb estout} or {helpb esttab}.
{hi:Warning:} Some post-estimation commands may not work with
estimation sets that do not contain the {cmd:e(sample)}.
{p 8 12 2}
{space 1}o{space 2}{cmd:eststo} can add additional scalar statistics to
be stored with the estimation set.
{title:Options}
{marker esample}
{p 4 8 2}
{cmd:esample} causes the information in {cmd:e(sample)} to be stored
with the estimates. This is the default in {cmd:eststo}. Type
{cmd:noesample} or use the {cmd:_eststo} command to omit the
{cmd:e(sample)}. Note that some post-estimation commands may not be
working correctly with estimation sets that have been stored without
{cmd:e(sample)}.
{p 4 8 2}
{cmd:title(}{it:string}{cmd:)} specifies a title for the stored
estimation set.
{p_end}
{marker addscalars}
{p 4 8 2}
{cmd:addscalars(}{it:name exp} [{it:...}] [{cmd:,} {cmdab:r:eplace}]{cmd:)}
may be used to add additional results to the {cmd:e()}-scalars of the
estimation set before storing it. Specify the names and values of the
scalars in pairs. For example, {cmd:addscalars(one 1 two 2)} would
add {cmd:e(one)} = {cmd:1} and {cmd:e(two)} = {cmd:2}. See below for
an example. The {cmd:replace} suboption permits overwriting existing
{cmd:e()}-returns. Not allowed as names are "b", "V", or "sample".
See {helpb estadd} for a more sophisticated tool to add additional
results to {cmd:e()}-returns.
{p 4 8 2}
{cmd:prefix(}{it:prefix}{cmd:)} specifies a custom prefix for the
automatic names of the stored estimation sets. The default prefix
is {cmd:est}.
{p 4 8 2}
{cmd:refresh}[{cmd:(}{it:#}{cmd:)}] may be used to overwrite a
previously stored estimation set instead of storing the estimates
under a new name. {cmd:refresh}, specified without argument, will
overwrite the last saved set. Alternatively,
{cmd:refresh(}{it:#}{cmd:)} will overwrite the set named
{cmd:est}{it:#} if it exists. If {it:name} is provided to {cmd:eststo},
existing sets of the same name will always be overwritten whether or
not {cmd:refresh} is specified. {cmd:refresh()} with argument is not
allowed in this case.
{p 4 8 2}
{cmd:nocopy} specifies that after the estimation set has been stored,
it no longer be available as the active estimation set.
{p 4 8 2}
{cmd:missing} is for use of {cmd:eststo} with the {cmd:by} prefix command and
causes missing values to be treated like any other values in the {cmd:by}
variables. The default is to discard observations with missing values in the
{cmd:by} variables.
{title:Examples}
{p 4 4 2}
Applying {cmd:eststo} after fiting a model to store the model's results,
as in the following example:
{com}. sysuse auto
{txt}(1978 Automobile Data)
{com}. quietly regress price weight
{txt}
{com}. eststo model1
{txt}
{com}. quietly regress turn weight foreign
{txt}
{com}. eststo model2
{txt}
{com}. estout
{res}
{txt}{hline 38}
{txt} model1 model2
{txt} b b
{txt}{hline 38}
{txt}weight {res} 2.044063 .0042183{txt}
{txt}foreign {res} -1.809802{txt}
{txt}_cons {res} -6.707353 27.44963{txt}
{txt}{hline 38}
{p 4 4 2}
Applying {cmd:eststo} as a prefix commmand to fit and store a model in one step:
{com}. eststo model1: quietly regress price weight
{txt}
{com}. eststo model2: quietly regress turn weight foreign
{txt}
{com}. estout
{res}
{txt}{hline 38}
{txt} model1 model2
{txt} b b
{txt}{hline 38}
{txt}weight {res} 2.044063 .0042183{txt}
{txt}foreign {res} -1.809802{txt}
{txt}_cons {res} -6.707353 27.44963{txt}
{txt}{hline 38}
{p 4 4 2}
Using {cmd:eststo} with automatic names:
{com}. eststo clear
{txt}
{com}. eststo: quietly regress price weight
{txt}({res}est1{txt} stored)
{com}. eststo: quietly regress turn weight foreign
{txt}({res}est2{txt} stored)
{com}. estout
{res}
{txt}{hline 38}
{txt} est1 est2
{txt} b b
{txt}{hline 38}
{txt}weight {res} 2.044063 .0042183{txt}
{txt}foreign {res} -1.809802{txt}
{txt}_cons {res} -6.707353 27.44963{txt}
{txt}{hline 38}
{p 4 4 2}
Adding ancillary statistics:
{com}. eststo clear
{txt}
{com}. quietly regress price weight mpg
{txt}
{com}. test weight = mpg
{txt} ( 1) {res}weight - mpg = 0
{txt} F( 1, 71) ={res} 0.36
{txt}{col 13}Prob > F ={res} 0.5514
{txt}
{com}. eststo, add(p_diff r(p))
{txt}(e({res}p_diff{txt}) = {res}.55138216{txt} added)
({res}est1{txt} stored)
{com}. estout, stat(p_diff)
{res}
{txt}{hline 25}
{txt} est1
{txt} b
{txt}{hline 25}
{txt}weight {res} 1.746559{txt}
{txt}mpg {res} -49.51222{txt}
{txt}_cons {res} 1946.069{txt}
{txt}{hline 25}
{txt}p_diff {res} .5513822{txt}
{txt}{hline 25}
{p 4 4 2}
Using the {cmd:by} prefix to store subbroup models:
{com}. eststo clear
{txt}
{com}. quietly by foreign: eststo: quietly reg price weight mpg
{txt}
{com}. esttab, label nodepvar nonumber
{res}
{txt}{hline 52}
{txt} Domestic Foreign
{txt}{hline 52}
{txt}Weight (lbs.) {res} 4.415*** 5.156***{txt}
{res} {ralign 12:{txt:(}4.66{txt:)}} {ralign 12:{txt:(}5.85{txt:)}} {txt}
{txt}Mileage (mpg) {res} 237.7 -19.78 {txt}
{res} {ralign 12:{txt:(}1.71{txt:)}} {ralign 12:{txt:(}-0.34{txt:)}} {txt}
{txt}Constant {res} -13285.4* -5065.8 {txt}
{res} {ralign 12:{txt:(}-2.32{txt:)}} {ralign 12:{txt:(}-1.58{txt:)}} {txt}
{txt}{hline 52}
{txt}Observations {res} 52 22 {txt}
{txt}{hline 52}
{txt}t statistics in parentheses
{txt}* p<0.05, ** p<0.01, *** p<0.001
{title:Returned results}
{p 4 4 2}
The name under which an estimation set is stored, is added to the set in
{cmd:e(_estimates_name)}.
{p 4 4 2}
In addition, {cmd:eststo} maintains two global macros. {cmd:$eststo} contains a list
of the names of the stored estimation sets. {cmd:$eststo_counter}
contains the count of stored estimation sets.
{title:Acknowledgements}
{p 4 4 2}
Bill Gould suggested to make {cmd:eststo} "byable".
{title:Author}
{p 4 4 2}
Ben Jann, ETH Zurich, jannb@ethz.ch
{title:Also see}
Manual: {hi:[R] estimates}
{p 4 13 2}Online: help for
{helpb estimates},
{helpb esttab},
{helpb estout},
{helpb estadd},
{helpb estpost}
{p_end}

File diff suppressed because it is too large Load Diff

View File

@ -1,905 +0,0 @@
{smcl}
{* 08oct2009}{...}
{hi:help esttab}{right:also see: {helpb estout}, {helpb eststo}, {helpb estadd}, {helpb estpost}}
{right: {browse "http://repec.org/bocode/e/estout"}}
{hline}
{title:Title}
{p 4 4 2}{hi:esttab} {hline 2} Display formatted regression table
{title:Table of contents}
{help esttab##syn:Syntax}
{help esttab##des:Description}
{help esttab##opt:Options}
{help esttab##exa:Examples}
{help esttab##aut:Backmatter}
{marker syn}
{title:Syntax}
{p 8 15 2}
{cmd:esttab} [ {it:namelist} ] [ {cmd:using} {it:filename} ] [ {cmd:,}
{it:options} ]
{p 4 4 2}where {it:namelist} is a name, a list of names, or {cmd:_all}. The
{cmd:*} and {cmd:?} wildcards are allowed in {it:namelist}. A name may also be {cmd:.},
meaning the current (active) estimates.
{it:options}{col 26}description
{hline 70}
{help esttab##main:Main}
{cmd:b(}{it:{help esttab##fmt:fmt}}{cmd:)}{col 26}{...}
specify format for point estimates
{cmd:beta}[{cmd:(}{it:{help esttab##fmt:fmt}}{cmd:)}]{col 26}{...}
display beta coefficients instead of point est's
{cmd:main(}{it:name} [{it:{help esttab##fmt:fmt}}]{cmd:)}{col 26}{...}
display contents of {cmd:e(}{it:name}{cmd:)} instead of point e's
{cmd:t(}{it:{help esttab##fmt:fmt}}{cmd:)}{col 26}{...}
specify format for t-statistics
{cmd:abs}{col 26}{...}
use absolute value of t-statistics
{cmd:not}{col 26}{...}
suppress t-statistics
{cmd:z}[{cmd:(}{it:{help esttab##fmt:fmt}}{cmd:)}]{col 26}{...}
display z-statistics (affects label only)
{cmd:se}[{cmd:(}{it:{help esttab##fmt:fmt}}{cmd:)}]{col 26}{...}
display standard errors instead of t-statistics
{cmd:p}[{cmd:(}{it:{help esttab##fmt:fmt}}{cmd:)}]{col 26}{...}
display p-values instead of t-statistics
{cmd:ci}[{cmd:(}{it:{help esttab##fmt:fmt}}{cmd:)}]{col 26}{...}
display confidence intervals instead of t-stat's
{cmd:aux(}{it:name} [{it:{help esttab##fmt:fmt}}]{cmd:)}{col 26}{...}
display contents of {cmd:e(}{it:name}{cmd:)} instead of t-stat's
[{ul:{cmd:no}}]{cmdab:con:stant}{col 26}{...}
do not/do report the intercept
{help esttab##stars:Significance stars}
[{cmd:no}]{cmd:star}[{cmd:(}{it:list}{cmd:)}]{col 26}{...}
do not/do report significance stars
{cmd:staraux}{col 26}{...}
attach stars to t-stat's instead of point est's
{help esttab##stat:Summary statistics}
{cmd:r2}|{cmd:ar2}|{cmd:pr2}[{cmd:(}{it:{help esttab##fmt:fmt}}{cmd:)}]{col 26}{...}
display (adjusted, pseudo) R-squared
{cmd:aic}|{cmd:bic}[{cmd:(}{it:{help esttab##fmt:fmt}}{cmd:)}]{col 26}{...}
display Akaike's or Schwarz's information crit.
{cmdab:sca:lars:(}{it:list}{cmd:)}{col 26}{...}
display any other scalars contained in {cmd:e()}
{cmd:sfmt(}{it:{help esttab##fmt:fmt}} [{it:...}]{cmd:)}{col 26}{...}
set format(s) for {cmd:scalars()}
{cmd:noobs}{col 26}{...}
do not display the number of observations
{cmd:obslast}{col 26}{...}
place the number of observations last
{help esttab##layout:Layout}
{cmd:wide}{col 26}{...}
place point est's and t-stat's beside one another
{cmdab:one:cell}{col 26}{...}
combine point est's and t-stat's in a single cell
[{ul:{cmd:no}}]{cmdab:pa:rentheses}{col 26}{...}
do not/do print parentheses around t-statistics
{cmdab:br:ackets}{col 26}{...}
use brackets instead of parentheses
[{ul:{cmd:no}}]{cmdab:gap:s}{col 26}{...}
suppress/add vertical spacing
[{ul:{cmd:no}}]{cmdab:li:nes}{col 26}{...}
suppress/add horizontal lines
{cmdab:noeqli:nes}{col 26}{...}
suppress lines between equations
{cmd:compress}{col 26}{...}
reduce horizontal spacing
{cmd:plain}{col 26}{...}
produce a minimally formatted table
{help esttab##label:Labeling}
{cmdab:l:abel}{col 26}{...}
make use of variable labels
{cmdab:ti:tle:(}{it:string}{cmd:)}{col 26}{...}
specify a title for the table
{cmdab:mti:tles}[{cmd:(}{it:list}{cmd:)}]{col 26}{...}
specify model titles to appear in table header
{cmdab:nomti:tles}{col 26}{...}
disable model titles
[{ul:{cmd:no}}]{cmdab:dep:vars}{col 26}{...}
do not/do use dependent variables as model titles
[{ul:{cmd:no}}]{cmdab:num:bers}{col 26}{...}
do not/do print model numbers in table header
{cmdab:coef:labels:(}{it:list}{cmd:)}{col 26}{...}
specify labels for coefficients
[{ul:{cmd:no}}]{cmdab:note:s}{col 26}{...}
suppress/add notes in the table footer
{cmdab:addn:otes:(}{it:list}{cmd:)}{col 26}{...}
add lines at the end of the table
{help esttab##format:Document format}
{cmd:smcl} | {cmdab:fix:ed} | {cmd:tab} | {cmd:csv} | {cmdab:sc:sv} | {cmd:rtf} | {cmdab:htm:l} | {cmd:tex} | {cmdab:bookt:abs}
{col 26}{...}
set the document format ({cmd:smcl} is the default)
{cmdab:f:ragment}{col 26}{...}
suppress table opening and closing (LaTeX, HTML)
{cmd:page}[{cmd:(}{it:packages}{cmd:)}]{col 26}{...}
add page opening and closing (LaTeX, HTML)
{cmdab:align:ment(}{it:string}{cmd:)}{col 26}{...}
set alignment within columns (LaTeX, HTML, RTF)
{cmdab:width(}{it:string}{cmd:)}{col 26}{...}
set width of table (LaTeX, HTML)
{cmdab:long:table}{col 26}{...}
multi-page table (LaTeX)
{help esttab##output:Output}
{cmdab:r:eplace}{col 26}{...}
overwrite an existing file
{cmdab:a:ppend}{col 26}{...}
append the output to an existing file
{cmdab:ty:pe}{col 26}{...}
force prining the table in the results window
{cmdab:n:oisily}{col 26}{...}
display the executed {helpb estout} command
{help esttab##advanced:Advanced}
{cmdab:d:rop:(}{it:list}{cmd:)}{col 26}{...}
drop individual coefficients
{cmdab:k:eep:(}{it:list}{cmd:)}{col 26}{...}
keep individual coefficients
{cmdab:o:rder:(}{it:list}{cmd:)}{col 26}{...}
change order of coefficients
{cmdab:eq:uations:(}{it:list}{cmd:)}{col 26}{...}
match the models' equations
{cmd:eform}{col 26}{...}
report exponentiated coefficients
{cmdab:m:argin}{col 26}{...}
report marginal effects/elasticities
{cmdab:uns:tack}{col 26}{...}
place multiple equations in separate columns
{it:estout_options}{col 26}{...}
any other {helpb estout} options
{hline 70}
{marker des}
{title:Description}
{p 4 4 2}
{cmd:esttab} is a wrapper for {helpb estout}. It produces a
pretty-looking publication-style regression table from stored
estimates without much typing. The compiled table is displayed in the
Stata results window or, optionally, written to a text file specified
by {cmd:using} {it:filename}. If {it:filename} is specified without
suffix, a default suffix is added depending on the specified document
format (".smcl" for {cmd:smcl}, ".txt" for {cmd:fixed} and {cmd:tab}, ".csv" for {cmd:csv}
and {cmd:scsv}, ".rtf" for {cmd:rft}, ".html" for {cmd:html}, and
".tex" for {cmd:tex} and {cmd:booktabs}).
{p 4 4 2}
{it:namelist} provides the names of the stored estimation sets to be
tabulated. You may use the {cmd:*} and {cmd:?} wildcards in
{it:namelist}. If {it:namelist} is omitted, {cmd:esttab} tabulates the
estimation sets stored by {cmd:eststo} (see help {helpb eststo})
or, if no such estimates are present, the currently active
estimates (i.e. the model fit last).
{p 4 4 2}
See help {helpb estimates} for information about storing estimation
results. An alternative to the {cmd:estimates store} command is
provided by {helpb eststo}.
{p 4 4 2}
{cmd:esttab} can also be used to tabulate a Stata matrix applying syntax
{bind:{cmd:esttab} {cmdab:m:atrix:(}{it:name}{cmd:)}}, where {it:name}
is the name of the matrix. Furthermore, an {cmd:e()}-matrix or {cmd:r()}-matrix
can be tabulated specifying {cmd:esttab e(}{it:name}{cmd:)} or
{cmd:esttab r(}{it:name}{cmd:)}. Most options under the headings
'Main', 'Significance stars', and 'Summary statistics' are irrelevant
in this case. See help {helpb estout} for further details on tabulating matrices.
{marker opt}
{title:Options}
{marker main}
{dlgtab:Main}
{p 4 8 2}
{cmd:b(}{it:{help esttab##fmt:fmt}}{cmd:)} sets the numerical display format
for the point estimates. The default format is {cmd:a3}. (See
{help esttab##fmt:Numerical formats} below for details on available
formats.)
{p 4 8 2}
{cmd:beta}[{cmd:(}{it:{help esttab##fmt:fmt}}{cmd:)}] requests that
standardized beta coefficients be displayed in place of the raw point
estimates and, optionally, sets the display format (the default is to
print three decimal places). Note that {cmd:beta} causes the
intercept to be dropped from the table (unless {cmd:constant} is
specified).{p_end}
{marker main}
{p 4 8 2}
{cmd:main(}{it:name} [{it:{help esttab##fmt:fmt}}]{cmd:)} requests that
the statistics stored in {cmd:e(}{it:name}{cmd:)} be displayed in
place of the point estimates and, optionally, sets the display format
(the default is to use the display format for point estimates). For
example, {cmd:e(}{it:name}{cmd:)} may contain statistics added by
{cmd:estadd} (see help {helpb estadd}).
{p 4 8 2}
{cmd:t(}{it:{help esttab##fmt:fmt}}{cmd:)} sets the display format for
t-statistics. The default is to display two decimal places.
{p 4 8 2}
{cmd:abs} causes absolute values of t-statistics to be reported.
{p 4 8 2}
{cmd:not} suppresses the printing of t-statistics.
{p 4 8 2}
{cmd:z}[{cmd:(}{it:{help esttab##fmt:fmt}}{cmd:)}] requests that
z-statistics be displayed. z-statistics are the same as t-statistics. Hence,
specifying {cmd:z} does not change the table contents, it only changes the
label.
{p 4 8 2}
{cmd:se}[{cmd:(}{it:{help esttab##fmt:fmt}}{cmd:)}] requests that
standard errors be displayed in place of t-statistics and,
optionally, sets the display format (the default is to use the
display format for point estimates).
{p 4 8 2}
{cmd:p}[{cmd:(}{it:{help esttab##fmt:fmt}}{cmd:)}] requests that
p-values be displayed in place of t-statistics and, optionally, sets
the display format (the default is to print three decimal places)
{p 4 8 2}
{cmd:ci}[{cmd:(}{it:{help esttab##fmt:fmt}}{cmd:)}] requests that
confidence intervals be displayed in place of t-statistics and,
optionally, sets the display format (the default is to use the
display format for point estimates). {cmd:level(}{it:#}{cmd:)}
assigns the confidence level, in percent. The default is
{cmd:level(95)} or as set by {helpb set level}.{p_end}
{marker aux}
{p 4 8 2}
{cmd:aux(}{it:name} [{it:{help esttab##fmt:fmt}}]{cmd:)} requests that
the statistics stored in {cmd:e(}{it:name}{cmd:)} be displayed in
place of t-statistics and, optionally, sets the display format (the
default is to use the display format for point estimates). For
example, {cmd:e(}{it:name}{cmd:)} may contain statistics added by
{cmd:estadd} (see help {helpb estadd}, if installed).
{p 4 8 2}
{cmd:noconstant} causes the intercept be dropped from the table.
Specify {cmd:constant} to include the constant in situations where it
is dropped by default.
{marker stars}
{dlgtab:Significance stars}
{p 4 8 2}
{cmd:star}[{cmd:(}{it:symbol} {it:level} [{it:...}]{cmd:)}] causes
stars denoting the significance of the coefficients to be printed
next to the point estimates. This is the default. Type {cmd:nostar}
to suppress the stars. The default symbols and thresholds are:
{cmd:*} for p<.05, {cmd:**} for p<.01, and {cmd:***} for p<.001.
Alternatively, for example, type {bind:{cmd:star(+ 0.10 * 0.05)}} to
set the following thresholds: {cmd:+} for p<.10 and {cmd:*} for
p<.05. Note that the thresholds must lie in the (0,1] interval and
must be specified in descending order.
{p 4 8 2}
{cmd:staraux} causes the significance stars be printed next to the
t-statistics (or standard errors, etc.) instead of the point estimates.
{marker stat}
{dlgtab:Summary statistics}
{p 4 8 2}
{cmd:r2}[{cmd:(}{it:{help esttab##fmt:fmt}}{cmd:)}],
{cmd:ar2}[{cmd:(}{it:{help esttab##fmt:fmt}}{cmd:)}], and
{cmd:pr2}[{cmd:(}{it:{help esttab##fmt:fmt}}{cmd:)}]
include the R-squared, the adjusted R-squared, and the
pseudo-R-squared in the table footer and, optionally, set the
corresponding display formats (the default is to display three
decimal places).
{p 4 8 2}
{cmd:aic}[{cmd:(}{it:{help esttab##fmt:fmt}}{cmd:)}] and
{cmd:bic}[{cmd:(}{it:{help esttab##fmt:fmt}}{cmd:)}]
include Akaike's and Schwarz's information criterion in the table
footer and, optionally, set the corresponding display formats (the
default is to use the display format for point estimates).{p_end}
{marker scalars}
{p 4 8 2}
{cmd:scalars(}{it:list}{cmd:)} may be used to add other
{cmd:e()}-scalars to the table footer (type {cmd:ereturn list} to
display a list of available {cmd:e()}-scalars after fitting a model;
see help {helpb ereturn}). For example, {cmd:scalars(df_m)} would
report the model degrees of freedom for each model. {it:list} may be
a simple list of names of {cmd:e()}-scalars, e.g.
{com}. esttab, scalars(ll_0 ll chi2){txt}
{p 8 8 2}
or, alternatively, a list of quoted name-label pairs, e.g.
{com}. esttab, scalars({bind:"ll Log lik."} {bind:"chi2 Chi-squared"}){txt}
{p 4 8 2}
{cmd:sfmt(}{it:{help esttab##fmt:fmt}} [{it:...}]{cmd:)} sets the
display format(s) for the statistics specified in {cmd:scalars()}
(the default is to use the display format for point estimates). If
{cmd:sfmt()} contains less elements than {cmd:scalars()}, the last
specified format is used for the remaining scalars. That is, only one
format needs to be specified if the same format be used for all
scalars.
{p 4 8 2}
{cmd:noobs} suppresses displaying information on the number of
observations. The default is to report the number of observations for
each model in the table footer.
{p 4 8 2}
{cmd:obslast} displays the number of observations in the last row of
the table footer. The default is to use the first row.
{marker layout}
{dlgtab:Layout}
{marker wide}
{p 4 8 2}
{cmd:wide} causes point estimates and t-statistics (or standard errors,
etc.) to be printed beside one another instead of beneath one another.
{p_end}
{marker onecell}
{p 4 8 2}
{cmd:onecell} causes point estimates and t-statistics (or standard errors,
etc.) to be combined in a single table cell. This option is useful primarily
in {cmd:rtf} or {cmd:html} mode. In these modes a line break is
inserted between the two statistics. The benefit from using {cmd:onecell}
in {cmd:rtf} or {cmd:html} mode is that long coefficients labels do not
derange the table layout. The default for other modes is to insert
a blank between the statistics. Use {cmd:estout}'s
{helpb estout##incelldel:incelldelimiter()} option to change this.
{p 4 8 2}
{cmd:parentheses} encloses t-statistics (or standard errors, etc.) in
parentheses. This is the default. Specify {cmd:noparentheses} to
suppress the parentheses.
{p 4 8 2}
{cmd:brackets} uses square brackets, [], instead of parentheses. Note
that brackets are the default for confidence intervals.
{p 4 8 2}
{cmd:gaps} adds empty rows (or, more generally, additional vertical
space) between coefficients to increase readability (empty rows are
also inserted between the table's header, body, and footer, unless
{cmd:lines} is activated). This is the default unless {cmd:wide} or
{cmd:not} is specified. Type {cmd:nogaps} to suppress the extra
spacing.
{p 4 8 2}
{cmd:lines} adds horizontal lines to the table separating the table's
header, body, and footer and, in the case of multiple
equation models, the equations. This is the default. Specify {cmd:nolines}
to suppress the lines. Lines are always suppressed in the {cmd:tab}
and {cmd:csv} modes.
{p 4 8 2}
{cmd:noeqlines} suppresses the horizontal lines between equations
in the case of multiple equation models.{p_end}
{marker compress}
{p 4 8 2}
{cmd:compress} reduces the amount of horizontal spacing (so that more
models fit on screen without line breaking). The option has no effect
in the {cmd:tab} and {cmd:csv} modes. Furthermore, note that in the
TeX and HTML modes the {cmd:compress} option only changes the
arrangement the table's code, but not the look of the compiled
end-product. In {cmd:rtf}, however, {cmd:compress} changes the look
of the formatted table.{p_end}
{marker plain}
{p 4 8 2}
{cmd:plain} produces a minimally formatted table. It is a shorthand
to specifying {cmd:nostar}, {cmd:nodepvars}, {cmd:nonumbers},
{cmd:noparentheses}, {cmd:nogaps}, {cmd:nolines} and {cmd:nonotes}
and setting all formats to {cmd:%9.0g}. Note that the disabled
options can be switched on again. For example, type
{com}. esttab, plain star{txt}
{p 8 8 2}
to produce a plain table including significance stars.
{marker label}
{dlgtab:Labeling}
{p 4 8 2}
{cmd:label} specifies that variable labels be used instead of
variable names (and estimation set titles be used instead of
estimation set names). Furthermore, {cmd:label} prints "Constant"
instead of "_cons".
{p_end}
{marker title}
{p 4 8 2}
{cmd:title(}{it:string}{cmd:)} may be used to provide a title for the
table. If specified, {it:string} is printed at the top of the table.
Note that specifying a title causes the table to be set up as a
floating object in LaTeX mode. You may want to set a label for
referencing in this case. For example, if you type
{cmd:title(...\label{tab1})}, then "\ref{tab1}" could be used in the
LaTeX document to point to the table.
{p 4 8 2}
{cmd:mtitles}, without argument, specifies that for each model the title
(or, if empty, the name) of the stored estimation set be printed as the model's
title in the table header. If {cmd:mtitles} is omitted, the default is to
use name or label of the dependent variable as the model's title (see the
{cmd:depvar} option). Alternatively, use {cmd:mtitles(}{it:list}{cmd:)}
specifies a list of model titles. Enclose the titles
in double quotes if they contain spaces,
e.g. {bind:{cmd:mtitles("Model 1" "Model 2")}}.
{p 4 8 2}
{cmd:nomtitles} suppresses printing of model titles.
{p 4 8 2}
{cmd:depvars} prints the name (or label) of the (first) dependent
variable of a model as the model's title in the table header. This is
the default. Specify {cmd:nodepvars} to use the names of
the stored estimation sets as titles.
{p 4 8 2}
{cmd:numbers} includes a row containing consecutive model numbers in
the table header. This is the default. Specify {cmd:nonumbers} to
suppress printing the model numbers.
{p 4 8 2}
{cmd:coeflabels(}{it:name} {it:label} [...]{cmd:)} specifies labels
for the coefficients. Specify names and labels in pairs and, if
necessary, enclose labels in double quotes,
e.g. {cmd:coeflabels(mpg Milage rep78 {bind:"Repair Record"})}.
{p 4 8 2}
{cmd:notes} prints notes at the end of the table explaining the
significance symbols and the type of displayed statistics. This is
the default. Specify {cmd:nonotes} to suppress the notes.
{p 4 8 2}
{cmd:addnotes(}{it:list}{cmd:)} may be used to add further lines of
text at the bottom of the table. Lines containing blanks must be
enclosed in double quotes,
e.g. {cmd:addnotes({bind:"Line 1"} {bind:"Line 2"})}.
{marker format}
{dlgtab:Document format}
{p 4 8 2}
{cmd:smcl}, {cmd:fixed}, {cmd:tab}, {cmd:csv}, {cmd:scsv}, {cmd:rtf},
{cmd:html}, {cmd:tex}, and {cmd:booktabs} choose the table's basic
output format. The default format is {cmd:smcl} unless
{cmd:using} is specified, in which case the default format
depends on the filename's suffix ({cmd:smcl} for ".smcl", {cmd:csv}
for ".csv", {cmd:rtf} for ".rtf",
{cmd:html} for ".htm" or ".html", {cmd:tex} for ".tex", and {cmd:fixed}
for all other filenames).
{p 8 8 2}
{cmd:smcl} produces a {help SMCL} formatted table to be displayed in the
Stata results window or the Stata viewer.
{p 8 8 2}
{cmd:fixed} produces a fixed-format ASCII table. This is suitable,
for example, if the table be displayed in a text editor.
{p 8 8 2}
{cmd:tab} produces a tab-delimited ASCII table.
{p_end}
{marker csv}
{p 8 8 2}
{cmd:csv} produces a CSV ({ul:C}omma {ul:S}eparated {ul:V}alue
format) table for use with Microsoft Excel. Delimiter is a comma. In
order to prevent Excel from interpreting the contents of the table
cells, they are enclosed double quotes preceded by an equal sign
(i.e. ="..."). However, if the {cmd:plain} option is specified, the
table cells are enclosed in double quotes without the leading equal
sign. The first method is appropriate if you want to preserve the
table's formatting. The second method is appropriate if you want to
use the table's contents for further computations in Excel.
{p_end}
{marker scsv}
{p 8 8 2}
{cmd:scsv} is a variant on the CSV format that uses a semicolon as
the delimiter. This is appropriate for some non-English versions of
Excel (e.g. the German version).
{p_end}
{marker rtf}
{p 8 8 2}
{cmd:rtf} produces a Rich Text Format table for use with word
processors.
{p 8 8 2}
{cmd:html} produces a simple HTML formatted table.
{p 8 8 2}
{cmd:tex} produces a LaTeX formatted table.
{p_end}
{marker booktabs}
{p 8 8 2}
{cmd:booktabs} produces a LaTeX formatted table for use with LaTeX's
{it:booktabs} package.
{p_end}
{marker fragment}
{p 4 8 2}
{cmd:fragment} causes the table's opening and closing specifications
to be suppressed. This is relevant primarily in LaTeX and HTML mode.
{p 4 8 2}
{cmd:page}[{cmd:(}{it:packages}{cmd:)}] adds opening and closing code
to define a whole LaTeX or HTML document. The default is to produce a
raw table that can then be included into an existing LaTeX or HTML
document. Specifying {it:packages} in parentheses causes
{cmd:\usepackage{c -(}}{it:packages}{cmd:{c )-}} to be added to the
preamble of the LaTeX document (note that the {it:booktabs} package
is automatically loaded if {cmd:booktabs} is specified).
{p 4 8 2}
{cmd:alignment(}{it:string}{cmd:)} may be used to specify the
alignment of the models' columns in LaTeX, HTML, or RTF mode.
{p 8 8 2}
In LaTeX mode {it:string} should be a LaTeX column specifier. The
default is to center the columns. To produce right-aligned columns,
for example, type {cmd:alignment(r)}. If the table contains multiple
columns per model/equation, the alignment specification should define
all columns. For example, if the {cmd:wide} option is specified, you
could type {cmd:alignment(cr)} to, say, center the point estimates
and right-align the t-statistics. Note that more sophisticated column
definitions are often needed to produce appealing results. In
particular, LaTeX's {it:dcolumn} package proves useful to align
columns on the decimal point.
{p 8 8 2}
In HTML mode {it:string} should be a HTML alignment specifier. The
default is to omit alignment specification, which results in left
aligned columns. To center the columns in HTML, for example, specify
{cmd:alignment(center)}. Other than in LaTeX mode, the same alignment
is used for all columns if the table contains multiple columns per
model/equation in the HTML mode.
{p 8 8 2}
In RTF mode {it:string} should be one of {cmd:l}, {cmd:c}, {cmd:r},
and {cmd:j}. The default is to center the columns. To produce
right-aligned columns, for example, type {cmd:alignment(r)}. The same
alignment is used for all columns if the table contains multiple
columns per model/equation in the RTF mode.
{p 8 8 2}
Note that {cmd:alignment()} does not change the alignment of the
variable names/labels in the left stub of the table. They are always
left-aligned.
{p 4 8 2}
{cmd:width(}{it:string}{cmd:)} sets the overall width of the table in
LaTeX or HTML. {it:string} should be LaTeX or HTML literal. For
example, specify {cmd:width(\hsize)} in LaTeX or {cmd:width(100%)} in
HTML to span the whole page. The table columns will spread regularly
over the specified width. Note that in RTF mode {helpb estout}'s
{cmd:varwidth()} and {cmd:modelwidth()} options may be used to change
the width of the table columns.
{p 4 8 2}
{cmdab:longtable} causes the {it:longtable} environment to be used in
LaTeX. Use {cmdab:longtable} for tables that are too
long to fit on a single page. {cmdab:longtable} cannot be combined
with {cmd:width()}. Make sure to load the {it:longtable} package
in the LaTeX document, i.e. include {cmd:\usepackage{longtable}} in the
document's preamble.
{marker output}
{dlgtab:Output}
{p 4 8 2}
{cmd:replace} permits {cmd:esttab} to overwrite an existing file.
{p 4 8 2}
{cmd:append} specifies that the output be appended to an existing
file. It may be used even if the file does not yet exist. Specifying
{cmd:append} together with {cmd:page} in TeX or HTML mode causes the
new table to be inserted at the end of the body of an existing
document ({cmd:esttab} seeks a line reading "\end{document}" or
"</body>", respectively, and starts appending from there;
contents after this line will be overwritten). In RTF mode, existing
documents are assumed to end with a line containing a single "}".
{p 4 8 2}
{cmd:type} specifies that the assembled table be printed in the
results window and the log file. This is the default unless
{cmd:using} is specified.
{p 4 8 2}
{cmd:noisily} displays the executed {helpb estout} command.
{marker advanced}
{dlgtab:Advanced}
{p 4 8 2}
{cmd:drop(}{it:droplist}{cmd:)} identifies the coefficients to be
dropped from the table. A {it:droplist} comprises one or more
specifications, separated by white space. A specification can be
either a parameter name (e.g. {cmd:price}), an equation name followed
by a colon (e.g. {cmd:mean:}), or a full name
(e.g. {cmd:mean:price}). You may use the {cmd:*} and {cmd:?} wildcards
in equation names and parameter names. Be sure to refer to the matched
equation names, and not to the original equation names in the models,
when using the {cmd:equations()} option to match equations.
{p 4 8 2}
{cmd:keep(}{it:keeplist}{cmd:)} selects the coefficients to be
included in the table. {it:keeplist} is specified analogous to
{it:droplist} in {cmd:drop()} (see above).
{p 4 8 2}
{cmd:order(}{it:orderlist}{cmd:)} changes the order of the
coefficients and equations within the table. {it:orderlist} is
specified analogous to {it:droplist} in {cmd:drop()} (see above).
Coefficients and equations that do not appear in {it:orderlist} are
placed last (in their original order).
{p 4 8 2}
{cmd:equations(}{it:eqmatchlist}{cmd:)} specifies how the models'
equations are to be matched. This option is passed to the internal
call of {cmd:estimates table}. See help {helpb estimates} on how to
specify this option. The most common usage is {cmd:equations(1)} to
match all the first equations in the models.
{p 4 8 2}
{cmd:eform} displays the regression table in exponentiated form. The
exponent of a coefficient is displayed in lieu of the untransformed
coefficient; standard errors and confidence intervals are transformed
as well. Note that the intercept is dropped in eform-mode, unless
{cmd:constant} is specified.
{p 4 8 2}
{cmd:margin} indicates that the marginal effects or elasticities be
reported instead of the raw coefficients. A prerequisite for this
option to work correctly is that {cmd:mfx} has been applied to a
model prior to storing its results (see help {helpb mfx}). Note that
the standard errors, etc. are transformed as well. Furthermore, the
intercept is dropped, unless {cmd:constant} is specified.
{p 4 8 2}
{cmd:unstack} specifies that the individual equations from
multiple-equation models (e.g. {cmd:mlogit}, {cmd:reg3},
{cmd:heckman}) be placed in separate columns. The default is to place
the equations below one another in a single column.
{p 4 8 2}
{it:estout_options} are any other {cmd:estout} options (see help
{helpb estout}). Note that {cmd:estout} options take precedence over
{cmd:esttab} options. For example,
{p 8 20 2}
{cmd:cells()}{space 5}disables {cmd:b()}, {cmd:beta()}, {cmd:main()},
{cmd:t()}, {cmd:abs}, {cmd:not}, {cmd:se()}, {cmd:p()}, {cmd:ci()},
{cmd:aux()}, {cmd:star}, {cmd:staraux}, {cmd:wide}, {cmd:onecell},
{cmd:parentheses}, and {cmd:brackets},
{p 8 20 2}
{cmd:stats()}{space 5}disables {cmd:r2()}, {cmd:ar2()}, {cmd:pr2()},
{cmd:aic()}, {cmd:bic()}, {cmd:scalars()}, {cmd:sfmt()}, {cmd:noobs},
and {cmd:obslast}.
{p 8 8 2}
Other {cmd:estout} options that should be used with care are
{cmd:begin()}, {cmd:delimiter()}, {cmd:end()}, {cmd:prehead()},
{cmd:posthead()}, {cmd:prefoot()}, {cmd:postfoot()}, {cmd:mlabels()},
and {cmd:varlabels()}.
{marker fmt}
{dlgtab:Numerical formats}
{p 4 4 2}
Numerical display formats may be specified in {cmd:esttab} as follows:
{p 5 8 2}
1. Official Stata's display formats: You may specify formats, such as
{cmd:%9.0g} or {cmd:%8.2f}. See help {help format} for a list
of available formats. {cmd:%g} or {cmd:g} may be used as a
synonym for {cmd:%9.0g}.
{p 5 8 2}
2. Fixed format: You may specify an integer value such as {cmd:0},
{cmd:1}, {cmd:2}, etc. to request a display format with a fixed number
of decimal places. For example, {cmd:t(3)} would display t-statistics
with three decimal places.
{p 5 8 2}
3. Automatic format: You may specify {cmd:a1}, {cmd:a2}, ..., or
{cmd:a9} to cause {cmd:esttab} to choose a reasonable display format for
each number depending on the number's value. {cmd:a} may be used as a
synonym for {cmd:a3}. The {it:#} in
{cmd:a}{it:#} determines the minimum precision according to the
following rules:
{p 10 12 2}
o Absolute numbers smaller than 1 are displayed with {it:#}
significant decimal places (i.e. with {it:#} decimal places ignoring
any leading zeros after the decimal point). For example,
{cmd:0.00123456} is displayed as {cmd:0.00123} if the format is
{cmd:a3}.
{p 10 12 2}
o Absolute numbers greater than 1 are displayed with as many digits
required to retain at least one decimal place and are displayed with
a minimum of ({it:#} + 1) digits. For example, if the format is
{cmd:a3}, {cmd:1.23456} is displayed as {cmd:1.235}, {cmd:12.3456} is
displayed as {cmd:12.35}, and {cmd:1234.56} is displayed as
{cmd:1234.6}.
{p 10 12 2}
o In any case, integers are displayed with zero decimal places, and
very large or very small absolute numbers are displayed in
exponential format.
{marker exa}
{title:Examples}
{p 4 4 2}
The following examples are intended to illustrate the basic usage of
{cmd:esttab}. Additional examples can be found at
{browse "http://repec.org/bocode/e/estout"}.
{p 4 4 2} The procedure is to first fit and store some models (see {helpb eststo}) and then apply
{cmd:esttab} to these stored estimates:
{com}. eststo clear
{txt}
{com}. sysuse auto
{txt}(1978 Automobile Data)
{com}. eststo: quietly regress price weight mpg
{txt}({res}est1{txt} stored)
{com}. eststo: quietly regress price weight mpg foreign
{txt}({res}est2{txt} stored)
{com}. esttab, ar2
{res}
{txt}{hline 44}
{txt} (1) (2)
{txt} price price
{txt}{hline 44}
{txt}weight {res} 1.747** 3.465***{txt}
{res} {ralign 12:{txt:(}2.72{txt:)}} {ralign 12:{txt:(}5.49{txt:)}} {txt}
{txt}mpg {res} -49.51 21.85 {txt}
{res} {ralign 12:{txt:(}-0.57{txt:)}} {ralign 12:{txt:(}0.29{txt:)}} {txt}
{txt}foreign {res} 3673.1***{txt}
{res} {ralign 12:{txt:(}5.37{txt:)}} {txt}
{txt}_cons {res} 1946.1 -5853.7 {txt}
{res} {ralign 12:{txt:(}0.54{txt:)}} {ralign 12:{txt:(}-1.73{txt:)}} {txt}
{txt}{hline 44}
{txt}N {res} 74 74 {txt}
{txt}adj. R-sq {res} 0.273 0.478 {txt}
{txt}{hline 44}
{txt}t statistics in parentheses
{txt}* p<0.05, ** p<0.01, *** p<0.001
{p 4 4 2}
The same table using labels:
{com}. esttab, ar2 label
{res}
{txt}{hline 52}
{txt} (1) (2)
{txt} Price Price
{txt}{hline 52}
{txt}Weight (lbs.) {res} 1.747** 3.465***{txt}
{res} {ralign 12:{txt:(}2.72{txt:)}} {ralign 12:{txt:(}5.49{txt:)}} {txt}
{txt}Mileage (mpg) {res} -49.51 21.85 {txt}
{res} {ralign 12:{txt:(}-0.57{txt:)}} {ralign 12:{txt:(}0.29{txt:)}} {txt}
{txt}Car type {res} 3673.1***{txt}
{res} {ralign 12:{txt:(}5.37{txt:)}} {txt}
{txt}Constant {res} 1946.1 -5853.7 {txt}
{res} {ralign 12:{txt:(}0.54{txt:)}} {ralign 12:{txt:(}-1.73{txt:)}} {txt}
{txt}{hline 52}
{txt}Observations {res} 74 74 {txt}
{txt}Adjusted R-squared {res} 0.273 0.478 {txt}
{txt}{hline 52}
{txt}t statistics in parentheses
{txt}* p<0.05, ** p<0.01, *** p<0.001
{p 4 4 2}
Plain table:
{com}. esttab, ar2 plain
{res}
{txt} est1 est2
{txt} b/t b/t
{txt}weight {res} 1.746559 3.464706{txt}
{res} 2.723238 5.493003{txt}
{txt}mpg {res} -49.51222 21.8536{txt}
{res} -.5746808 .2944391{txt}
{txt}foreign {res} 3673.06{txt}
{res} 5.370142{txt}
{txt}_cons {res} 1946.069 -5853.696{txt}
{res} .541018 -1.733408{txt}
{txt}N {res} 74 74{txt}
{txt}adj. R-sq {res} .2734846 .4781119{txt}
{p 4 4 2}
Using standard errors in brackets and suppress significance stars:
{com}. esttab, se nostar brackets
{res}
{txt}{hline 38}
{txt} (1) (2)
{txt} price price
{txt}{hline 38}
{txt}weight {res} 1.747 3.465{txt}
{res} {ralign 12:{txt:[}0.641{txt:]}} {ralign 12:{txt:[}0.631{txt:]}}{txt}
{txt}mpg {res} -49.51 21.85{txt}
{res} {ralign 12:{txt:[}86.16{txt:]}} {ralign 12:{txt:[}74.22{txt:]}}{txt}
{txt}foreign {res} 3673.1{txt}
{res} {ralign 12:{txt:[}684.0{txt:]}}{txt}
{txt}_cons {res} 1946.1 -5853.7{txt}
{res} {ralign 12:{txt:[}3597.0{txt:]}} {ralign 12:{txt:[}3377.0{txt:]}}{txt}
{txt}{hline 38}
{txt}N {res} 74 74{txt}
{txt}{hline 38}
{txt}Standard errors in brackets
{p 4 4 2}
Printing beta coefficients:
{com}. esttab, beta
{res}
{txt}{hline 44}
{txt} (1) (2)
{txt} price price
{txt}{hline 44}
{txt}weight {res} 0.460** 0.913***{txt}
{res} {ralign 12:{txt:(}2.72{txt:)}} {ralign 12:{txt:(}5.49{txt:)}} {txt}
{txt}mpg {res} -0.097 0.043 {txt}
{res} {ralign 12:{txt:(}-0.57{txt:)}} {ralign 12:{txt:(}0.29{txt:)}} {txt}
{txt}foreign {res} 0.573***{txt}
{res} {ralign 12:{txt:(}5.37{txt:)}} {txt}
{txt}{hline 44}
{txt}N {res} 74 74 {txt}
{txt}{hline 44}
{txt}Standardized beta coefficients; t statistics in parentheses
{txt}* p<0.05, ** p<0.01, *** p<0.001
{marker aut}
{title:Author}
{p 4 4 2}
Ben Jann, ETH Zurich, jannb@ethz.ch
{marker als}
{title:Also see}
Manual: {hi:[R] estimates}
{p 4 13 2}Online: help for
{helpb estimates},
{help estcom},
{helpb estout},
{helpb eststo},
{helpb estadd},
{helpb estpost}
{p_end}

View File

@ -1,104 +0,0 @@
*! Alfonso Miranda-Caso-Luengo (SJ4-1: st0057)
*! FIML exogenous sitching Poisson
*! version 2.0 June 26 2003
program define exspoisson, eclass
version 6
if replay() {
if "`e(cmd)'" != "exspoisson" { error 301 }
else exspDisplay `0'
}
else exsEstimate `0'
end
program define exsEstimate, eclass
syntax varlist [if] [in] , EDummy(varname) /*
*/ [Switch(varlist) Quadrature(integer 6) /*
*/ SIGMA0(real 1) *]
/* Obtaining dependent variable and explanatory variables */
gettoken endgv exogv : varlist, parse("")
/* Selecting sample */
marksample touse
markout `touse' `varlist'
/* defining some globals */
global S_quad "`quadrature'"
global S_edum "`edummy'"
/* Get points and weights for Gaussian-Hermite quadrature. */
tempvar x w
qui gen double `x' = 0
qui gen double `w' = 0
ghquad `x' `w', n(`quadrature')
local j = `quadrature'
while `j' >0 {
scalar x`j' = `x'[`j']
local j = `j' -1
}
local j = `quadrature'
while `j' >0 {
scalar w`j' = `w'[`j']
local j = `j' - 1 }
/* GETTING INITIAL VALUES */
di _skip(3)
qui probit `edummy' `switch' if `touse'
tempname b b1 b2 bi ch
mat `b'=e(b)
xcolnames `b', head(switch)
di as txt "Getting Initial Values:"
qui poisson `endgv' `exogv' if `touse'
mat `b1' = e(b)
mat `b2' = (`b1',`b')
matrix `ch' = ln(`sigma0')
matrix colnames `ch' = lnsigma:_cons
matrix `bi' = (`b2',`ch')
/* FITTING FULL MODEL */
di _skip(3)
di in gr "Fitting Full model:"
ml model d0 exspoisson_ll ("`endgv'": `endgv' = `exogv') /*
*/ (switch:`switch')(lnsigma:) /*
*/ if `touse', init(`bi', skip) max difficult search(off) `options'
estimates local cmd "exspoisson"
est local predict "exspoisson_p"
est local quad "`quadrature'"
/* Display Results */
exspDisplay
end
program define exspDisplay
di _skip(12)
di _n as txt /*
*/ "Exogenous-Switch Poisson Regression"
di as text "(`e(quad)' quadrature points)"
ml di, neq(2)plus
_diparm lnsigma, exp pr label("sigma")
di in gre in smcl "{hline 13}{c BT}{hline 64}"
end
exit

View File

@ -1,58 +0,0 @@
*! Alfonso Miranda Caso Luengo (SJ4-1: st0057)
*! Version 2.0 June 26 2003
program define exspoisson_ll
args todo b f
tempname lnsigma
tempvar xb zb
local y "$ML_y1"
local d "$S_edum"
mleval `xb' = `b', eq(1)
mleval `zb' = `b', eq(2)
mleval `lnsigma' = `b', eq(3)
scalar `lnsigma' = cond(`lnsigma'<-20,-20,`lnsigma')
tempname sma u
scalar `sma' = exp(`lnsigma')
tempvar F p r1 r2 r3 r4
qui {
gen double `F' = . if $ML_samp
gen double `p' = 0 if $ML_samp
gen double `r1' = 0 if $ML_samp
gen double `r2' = 0 if $ML_samp
gen double `r3' = 0 if $ML_samp
gen double `r4' = 0 if $ML_samp
local m = 1
while `m' <= $S_quad {
scalar `u' = sqrt(2)*`sma'*scalar(x`m')
replace `r1' = `xb' + `u' if $ML_samp
replace `r2' = exp(`r1')^(`y')*exp(-exp(`r1')) if $ML_samp
replace `r3' = `r2'/exp(lngamma(`y'+1)) if $ML_samp
replace `r4' = `d'*norm(`zb') + (1-`d')*norm(-`zb')
replace `F' = `r3'*`r4' if $ML_samp
replace `p' = `p' + scalar(w`m')*`F' if $ML_samp
local m = `m' + 1
}
replace `p'= (1/sqrt(_pi))*`p' if $ML_samp
replace `F' = log(`p') if $ML_samp
mlsum `f' = `F' if $ML_samp
}
end
exit

View File

@ -1,45 +0,0 @@
*! version 1.0 Alfonso Miranda-Caso-Luengo, June 2003 (SJ4-1: st0057)
program define exspoisson_p, sort
version 7
local myopts "n"
_pred_se "`myopts'" `0'
if `s(done)' { exit }
local vtyp `s(typ)'
local varn `s(varn)'
local 0 `"`s(rest)'"'
syntax [if] [in] [, `myopts' noOFFset]
local type "`n'"
marksample touse
if "`type'"=="n" | "`type'"=="" {
tempname mu zu lnsigma kappa
qui _predict double `mu' if `touse', xb `offset' eq(#1)
qui _predict double `zu' if `touse', xb `offset' eq(#2)
qui _predict double `lnsigma' if `touse', xb eq(#3)
local d "`e(edummy)'"
tempvar sma u rho
gen double `sma' = exp(`lnsigma')
tempvar p eta
gen double `p'=0 if `touse'
gen double `eta'=0 if `touse'
qui replace `mu'=exp(`mu'-0.5*`sma'^2) if `touse'
qui replace `eta' = 1
qui replace `p'=`mu'*`eta' if `touse'
qui gen `vtyp' `varn'=`p' if `touse'
label var `varn' "predicted number of events of `e(depvar)'"
exit
}
end