help estaddalso see:esttab,estout,eststo,estposthttp://repec.org/bocode/e/estout -------------------------------------------------------------------------------

Title

estadd-- Add results to (stored) estimates

Syntax

estaddsubcommand[,options] [:namelist]

where

namelistis_all|*|name[name...]

subcommandsdescription ---------------------------------------------------------------- Elementarylocalname ...add a macroscalarname=expadd a scalarmatrixname=matadd a matrixr(name)add contents ofr(name)(matrix or scalar)Statistics for each coefficient

betastandardized coefficientsvifvariance inflation factors (afterregress)pcorrpartial (and semi-partial) correlationsexpbexponentiated coefficientsebsdstandardized factor change coefficientsmeanmeans of regressorssdstandard deviations of regressorssummvarious descriptives of the regressorsSummary statistics

coxsnellCox & Snell's pseudo R-squarednagelkerkeNagelkerke's pseudo R-squaredlrtestmodellikelihood-ratio testysummdescriptives of the dependent variableOther

marginsadd results frommargins(Stata 11)SPost

brantadd results frombrant(if installed)fitstatadd results fromfitstat(if installed)listcoefadd results fromlistcoef(if installed)mlogtestadd results frommlogtest(if installed)prchangeadd results fromprchange(if installed)prvalueadd results fromprvalue(if installed)asprvalueadd results fromasprvalue(if installed) ----------------------------------------------------------------

optionsdescription ----------------------------------------------------------------replacepermit overwriting existinge()'sprefix(string)specify prefix for names of added resultsquietlysuppress output from subcommand (if any)subcmdoptssubcommand specific options ----------------------------------------------------------------

Description

estaddadds additional results to thee()-returns of an estimation command (see help estcom, helpereturn). If nonamelistis 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, ifnamelistis provided after the colon, results are added to all indicated sets of stored estimates (see helpestimates storeor helpeststo). You may use the*and?wildcards innamelist. Execution is silent ifnamelistis provided.Adding additional results to the

e()-returns is useful, for example, if the estimates be tabulated by commands such asestoutoresttab. See the Examples section below for illustration of the usage ofestadd.Technical note: Some of the subcommands below make use of the information contained in

e(sample)to determine estimation sample. These subcommands return error if the estimates do not containe(sample).

Subcommands+------------+ ----+ Elementary +-------------------------------------------------------

estaddlocalname ...adds in macro

e(name)the specified contents (also see helpereturn).

estaddscalarname=expadds in scalar

e(name)the evaluation ofexp(also see helpereturn).

estaddscalarr(name)adds in scalar

e(name)the value of scalarr(name).

estaddscalarnameadds in scalar

e(name)the the value of scalarname.

estaddmatrixname=matrix_expressionadds in matrix

e(name)the evaluation ofmatrix_expression(also see helpmatrix define).

estaddmatrixr(name)adds in matrix

e(name)a copy of matrixr(name).

estaddmatrixnameadds in matrix

e(name)a copy of matrixname.

estaddr(name)adds in

e(name)the value of scalarr(name)or a copy of matrixr(name), depending on the nature ofr(name).

+---------------------------------+ ----+ Statistics for each coefficient +----------------------------------

estaddbetaadds in

e(beta)the standardized beta coefficients.

estaddvif[,tolerancesqrvif]adds in

e(vif)the variance inflation factors (VIFs) for the regressors (see helpvif). Note thatvifonly works with estimates produced byregress.toleranceadditionally adds the tolerances (1/VIF) ine(tolerance).sqrvifadditionally adds the square roots of the VIFs ine(sqrvif).

estaddpcorr[, semi]adds the partial correlations (see help

pcorr) and, optionally, the semi-partial correlations between the dependent variable and the individual regressors (see, e.g., thepcorr2package 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 ine(pcorr)and, ifsemiis specified, the semi-partial correlations will be returned ine(spcorr).

estaddexpb[,noconstant]adds in

e(expb)the exponentiated coefficients (see the helpeform_option).noconstantexcludes the constant from the added results.

estaddebsdadds in

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).

estaddmeanadds in

e(mean)the means of the regressors.

estaddsd[,nobinary]adds in

e(sd)the standard deviations of the regressors.nobinarysuppresses the computation of the standard deviation for 0/1 variables.

estaddsumm[,stats]adds vectors of the regressors' descriptive statistics to the estimates. The following

statsare available:

statsdescription -----------------------------------------------------------meanmeansumsumminminimummaxmaximumrangerange = max - minsdstandard deviationvarvariancecvcoefficient of variation (sd/mean)semeanstandard error of mean = sd/sqrt(n)skewnessskewnesskurtosiskurtosisp11st percentilep55th percentilep1010th percentilep2525th percentilep5050th percentilep7575th percentilep9090th percentilep9595th percentilep9999th percentileiqrinterquartile range = p75 - p25allall of the abovemedianequivalent to specifying "p50"qequivalent to specifying "p25 p50 p75" -----------------------------------------------------------The default is

mean sd min max. Alternatively, indicate the desired statistics. For example, to add information on the regressors' skewness and kurtosis, type. estadd summ, skewness kurtosis

The statistics names are used as the names for the returned

e()matrices. For example,estadd summ, meanwill store the means of the regressors ine(mean).

+--------------------+ ----+ Summary statistics +-----------------------------------------------

estaddcoxsnelladds in

e(coxsnell)the Cox & Snell pseudo R-squared, which is defined asr2_coxsnell = 1 - ( L0 / L1 )^(2/N)

where L0 is the likelihood of the model without regressors, L1 the likelihood of the full model, and N is the sample size.

estaddnagelkerkeadds in

e(nagelkerke)the Nagelkerke pseudo R-squared (or Cragg & Uhler pseudo R-squared), which is defined asr2_nagelkerke = r2_coxsnell / (1 - L0^(2/N))

estaddlrtestmodel[,name(string)lrtest_options]adds the results from a likelihood-ratio test, where

modelis the comparison model (see helplrtest). Added aree(lrtest_chi2),e(lrtest_df), ande(lrtest_p). The names may be modified using thename()option. Specifyname(myname)to adde(mynamechi2),e(mynamedf), ande(mynamep). See helplrtestfor thelrtest_options.

estaddysumm[,stats]adds descriptive statistics of the dependent variable. See the

summsubcommand above for a list of the availablestats. The default ismean sd min max. The default prefix for the names of the added scalars isy(e.g. the mean of the dependent variable will be returned ine(ymean)). Useestadd'sprefix()option to change the prefix. If a model has multiple dependent variables, results for the first variable will be added.+-------+ ----+ Other +------------------------------------------------------------

estaddmargins[marginlist] [if] [in] [weight] [,options]adds results from the

marginscommand, which was introduced in Stata 11. See helpmarginsfor options. All results returned bymarginsexcepte(V)are added using "margins_" as a default prefix. For example, the margins are added ine(margins_b). The standard errors are added ine(margins_se). Use theprefix()option to change the default prefix.+-------+ ----+ SPost +------------------------------------------------------------

The following subcommands are wrappers for commands from Long and Freese's

SPostpackage (see http://www.indiana.edu/~jslsoc/spost.htm). Type. net from http://www.indiana.edu/~jslsoc/stata

to obtain the latest

SPostversion (spost9_ado).SPostfor Stata 8 (spostado) is not supported.For examples on using the subcommands see http://repec.org/bocode/e/estout/spost.html.

estadd brant[,brant_options]applies

brantfrom Long and Freese'sSPostpackage and adds the returned results toe(). You may specifybrant_optionsas described in helpbrant. The following results are added:

e(...)Contents ------------------------------------------------------------ Scalarsbrant_chi2Chi-squared of overall Brant testbrant_dfDegrees of freedom of overall Brant testbrant_pP-value of overall Brant testMatrix

brantTest results for individual regressors (rows: chi2, p<chi2) ------------------------------------------------------------To address the rows of

e(brant)inestout'scells()option typebrant[chi2]andbrant[p<chi2].

estadd fitstat[,fitstat_options]applies

fitstatfrom Long and Freese'sSPostpackage and adds the returned scalars toe(). You may specifyfitstat_optionsas described in helpfitstat. Depending on model and options, a selection of the following scalar statistics is added:

e(...)Contents ------------------------------------------------------------devDeviance (D)dev_dfDegrees of freedom of Dlrx2LR or Wald X2lrx2_dfDegrees of freedom of X2lrx2_pProb > LR or Wald X2r2_adjAdjusted R2r2_mfMcFadden's R2r2_mfadjMcFadden's Adj R2r2_mlML (Cox-Snell) R2r2_cuCragg-Uhler(Nagelkerke) R2r2_mzMcKelvey & Zavoina's R2r2_efEfron's R2v_ystarVariance of y*v_errorVariance of errorr2_ctCount R2r2_ctadjAdj Count R2aic0AICaic_nAIC*nbic0BICbic_pBIC'statabicBIC used by StatastataaicAIC used by Statan_rhsNumber of rhs variablesn_parmNumber of parameters ------------------------------------------------------------

estadd listcoef[varlist] [,nosdlistcoef_options]applies

listcoeffrom Long and Freese'sSPostpackage and adds the returned results toe(). You may specifylistcoef_optionsas described in helplistcoef. Furthermore, optionnosdsuppresses adding the standard deviations of the variables ine(b_sdx).Depending on the estimation command and options, several of the following matrices are added:

e(...)Contents ------------------------------------------------------------b_xsx-standardized coefficientsb_ysy-standardized coefficientsb_stdFully standardized coefficientsb_factFactor change coefficientsb_factsStandardized factor change coefficientsb_pctPercent change coefficientsb_pctsStandardized percent change coefficientsb_sdxStandard deviation of the Xs ------------------------------------------------------------For nominal models (

mlogit,mprobit) the original parametrization ofe(b)may not match the contrasts computed bylistcoef. 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:

e(...)Contents ------------------------------------------------------------b_rawraw coefficientsb_sestandard errors of raw coefficientsb_zz statisticsb_pp-values ------------------------------------------------------------

estadd mlogtest[varlist] [,mlogtest_options]applies

mlogtestfrom Long and Freese'sSPostpackage and adds the returned results toe(). You may specifymlogtest_optionsas described in helpmlogtest.Depending on the specified options, a selection of the following returns are added:

e(...)Contents ------------------------------------------------------------ Scalarshausman_set#_chi2Hausman IIA tests usinghausmanhausman_set#_dfhausman_set#_p

suest_set#_chi2Hausman IIA tests usingsuestsuest_set#_dfsuest_set#_p

smhsiao_set#_chi2Small-Hsiao IIA testssmhsiao_set#_dfsmhsiao_set#_p

combine_#1_#2_chi2Wald tests for combination of outcomescombine_#1_#2_dfcombine_#1_#2_p

lrcomb_#1_#2_chi2LR tests for combination of outcomeslrcomb_#1_#2_dflrcomb_#1_#2_p

wald_set#_chi2Wald tests for sets of independentwald_set#_dfvariableswald_set#_p

lrtest_set#_chi2LR tests for sets of independentlrtest_set#_dfvariableslrtest_set#_pMatrices

waldWald tests for individual variables (rows: chi2, df, p)lrtestLR tests for individual variables (rows: chi2, df, p) ------------------------------------------------------------To address the rows of

e(wald)ande(lrtest)inestout'scells()option type the row names in brackets, for example,wald[p]orlrtest[chi2].

estadd prchange[varlist] [ifexp] [inrange] [,pattern(typepattern)binary(type)continuous(type)[no]avgsplit[(prefix)]prchange_options]applies

prchangefrom Long and Freese'sSPostpackage and adds the returned results toe(). You may specifyprchange_optionsas described in helpprchange. In particular, theoutcome()option may be used with models for count, ordered, or nominal outcomes to request results for a specific outcome. Further options are:

pattern(typepattern),binary(type), andcontinuous(type)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. Usebinary(type)andcontinuous(type)to change these defaults. Available types are:

typeDescription ------------------------------------------------minmaxminimum to maximum change effect010 to 1 change effectdeltadelta()change effectsdstandard deviation change effectmargefctmarginal effect (some models only) ------------------------------------------------Use

pattern(typepattern)if you want to determine the type of the added effects individually for each regressor. For example,pattern(minmax sd delta)would addminmaxfor the first regressor,sdfor the second, anddeltafor the third, and then proceed using the defaults for the remaining variables.

avgto request that only the average results over all outcomes are added if applied to ordered or nominal models (ologit,oprobit,slogit,mlogit,mprobit). The default is to add the average results as well as the individual results for the different outcomes (unlessprchange'soutcome()option is specified, in which case only results for the indicated outcome are added). Furthermore, specifynoavgto suppress the average results and only add the outcome-specific results.avgcannot be combined withsplitoroutcome().

split[(prefix)] to save each outcome's results in a separate estimation set if applied to ordered or nominal models (ologit,oprobit,slogit,mlogit,mprobit). The estimation sets are namedprefix#, where#is the value of the outcome at hand. If noprefixis 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.ologit_). The estimation sets stored by thesplitoption are intended for tabulation only and should not be used with other post-estimation commands.Depending on model and options, several of the following matrices and scalars are added:

e(...)Contents ------------------------------------------------------------ Scalarscentered1if effects are centered,0elsedeltaValue ofdelta()predval[#] Prediction(s) at the base valuesoutcomeOutcome value (outcome()/splitonly)Matrices

dcDiscrete change effects (rows: main, minmax, 01, delta, sd [, margefct])patternTypes of effects in the main row ofe(dc)XBase values and descriptive statistics (rows: X, SD, Min, Max) ------------------------------------------------------------The

e(dc)ande(X)matrices have multiple rows. Thee(dc)matrix contains the main results as determined bypattern(),binary(), andcontinuous()in the first row. The second and following rows contain the separate results for each type of effect using the labels provided byprchangeas row names. Typedc[#]ordc[rowname]to address the rows inestout'scells()option, where#is the row number orrownameis the row name. For example, typedc[-+sd/2]to address the centered standard deviation change effects. To tabulate the main results (1st row), simply typedc.e(pattern)indicates the types of effects contained in the main row ofe(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 thedelta()change effect, 4 for the standard deviation change effect, and 5 for the marginal effect.e(X)has four rows containing the base values, standard deviations, minimums, and maximums. If thefromtooption is specified, two additional matrices,e(dcfrom)ande(dcto)are added.

estadd prvalue[ifexp] [inrange] [,label(string)prvalue_options]

estadd prvaluepost[name] [,title(string)swap]applies

prvaluefrom Long and Freese'sSPostpackage and adds the returned results toe(). The procedure is to first collect a series of predictions by repeated calls toestadd prvalueand then applyestadd prvalue postto prepare the results for tabulation as in the following example:. 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

You may specify

prvalue_optionswithestadd prvalueas described in helpprvalue. For example, usex()andrest()to set the values of the independent variables. Uselabel()to label the single calls. "pred#" is used as label iflabel()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 (:,.,") will be replaced by underscore. The results from the single calls are collected in matrixe(_estadd_prvalue)(predictions) and matrixe(_estadd_prvalue_x)(x-values). Specifyreplaceto drop results from previous calls.

estadd prvalue postposts the collected predictions ine(b)so that they can be tabulated. The following results are saved:

e(...)Contents ------------------------------------------------------------ ScalarsNnumber of observationsMacros

depvarname of dependent variablecmdestadd_prvaluemodelmodel estimation commandpropertiesbMatrices

bpredictionssestandard errorsLBlower confidence interval boundsUBupper confidence interval boundsCategoryoutcome valuesCondconditional predictions (some models only)Xvalues of predictors (for each prediction)X2second equation predictors (some models only) ------------------------------------------------------------

estadd prvalue postreplaces the current model unlessnameis specified, in which case the results are stored undernameand 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 asmodel1, thenestadd prvaluepoststores its results undermodel1name. Usetitle()to specify a title for the stored results.The default for

estadd prvalue postis to arrangee(b)in a way so that predictions are grouped by outcome (i.e. outcome labels are used as equations). Alternatively, specifyswapto group predictions byprvaluecalls (i.e. to use the prediction labels as equations).

e(X)contains one row for each independent variable. To address the rows inestout'scells()option typeX[varname], wherevarnameis the name of the variable of interest.e(X2), if provided, is analogous toe(X).

estadd asprvalue[,label(string)asprvalue_options]

estadd asprvaluepost[name] [,title(string)swap]applies

asprvaluefrom Long and Freese'sSPostpackage and adds the returned results toe(). The procedure is to first collect a series of predictions by repeated calls toestadd asprvalueand then applyestadd asprvalue postto prepare the results for tabulation as in the following example:. 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

You may specify

asprvalue_optionswithestadd asprvalueas described in helpasprvalue. For example, usex()andrest()to set the values of the independent variables. Uselabel()to label the single calls. "pred#" is used as label iflabel()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 (:,.,") will be replaced by underscore. The results from the single calls are collected in matricese(_estadd_asprval)(predictions),e(_estadd_asprval_asv)(values of alternative-specific variables), ande(_estadd_asprval_csv)(values of case-specific variables). Specifyreplaceto drop results from previous calls.

estadd asprvalue postposts the collected predictions ine(b)so that they can be tabulated. The following results are saved:

e(...)Contents ------------------------------------------------------------ ScalarsNnumber of observationsMacros

depvarname of dependent variablecmdestadd_asprvaluemodelmodel estimation commandpropertiesbMatrices

bpredictionsasvalternative-specific variables (if available)csvcase-specific variables (if available) ------------------------------------------------------------

estadd asprvalue postreplaces the current model unlessnameis specified, in which case the results are stored undernameand 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 asmodel1, thenestadd asprvaluepoststores its results undermodel1name. Usetitle()to specify a title for the stored results.The default for

estadd asprvalue postis to arrangee(b)in a way so that predictions are grouped by outcome (i.e. outcome labels are used as equations). Alternatively, specifyswapto group predictions byprvaluecalls (i.e. to use the prediction labels as equations).

e(asv)ande(csv)contain one row for each variable. To address the rows inestout'scells()option typeasv[varname]orcsv[varname], wherevarnameis the name of the variable of interest.

Options

replacepermitsestaddto overwrite existinge()macros, scalars, or matrices.

prefix(string)denotes a prefix for the names of the added results. The default prefix is an empty string. For example, ifprefix(string)is specified, thebetasubcommand will return the matrixe(stringbeta).

quietlysuppresses the output from the called subcommand and displays only the list of added results. Note that many ofestadd's subcommands do not generate output, in which casequietlyhas no effect.

subcmdoptsare subcommand specific options. See the descriptions of the subcommands above.

ExamplesExample 1: Add

r()-returns from other programs to the current estimates. sysuse auto (1978 Automobile Data)

. quietly regress price mpg weight . test mpg=weight

( 1) mpg - weight = 0

F( 1, 71) = 0.36 Prob > F = 0.5514 . estadd scalar p_diff = r(p)

added scalar: e(p_diff) = .55138216 . estout, stats(p_diff) ------------------------- b ------------------------- mpg -49.51222 weight 1.746559 _cons 1946.069 ------------------------- p_diff .5513822 -------------------------

Example 2: Add means and standard deviations of the model's regressors to the current estimates

. quietly logit foreign price mpg . estadd summ, mean sd

added matrices: e(sd) : 1 x 3 e(mean) : 1 x 3 . estout, cells("mean sd") drop(_cons) -------------------------------------- mean sd -------------------------------------- price 6165.257 2949.496 mpg 21.2973 5.785503 --------------------------------------

Example 3: Add standardized beta coefficients to stored estimates

. eststo: quietly regress price mpg (est1 stored)

. eststo: quietly regress price mpg foreign (est2 stored)

. estadd beta: * . estout, cells(beta) drop(_cons) -------------------------------------- est1 est2 beta beta -------------------------------------- mpg -.4685967 -.5770712 foreign .2757378 --------------------------------------

See http://repec.org/bocode/e/estout for additional examples.

Writing one's own subcommandsA program providing a new

estaddsubcommand should be calledestadd_mysubcommand(see helpprogramfor advice on defining programs).mysubcommandwill be available toestaddas a newsubcommandafter the program definition has been executed or saved to a file called "estadd_mysubcommand.ado" in either the current directory or somewhere else in theadopath(see helpsysdir).Use the subcommands provided within "estadd.ado" as a starting point for writing new subcommands. See http://repec.org/bocode/e/estout/estadd.html#estadd007 for an example.

AuthorBen Jann, ETH Zurich, jannb@ethz.ch

Also seeManual:

[R] estimatesOnline: help for

estimates,ereturn,program,esttab,estout,eststo,estpost