-------------------------------------------------------------------------------
help for est2tex, est2vec, est2one and est2rowlbl       (contact Marc Muendler)
-------------------------------------------------------------------------------

Create LaTeX tables from estimation results

est2vec table [, replace vars(list_of_regressors) shvars(varlist) e(list_of_macro_names) r(list_of_macro_names) addto(oldtable) raddto(oldtable) name(estimation_name) force nokeep ]

est2tex table [, replace dropall preserve path(pathname) multse(list_of_integers) mark(marking_option) levels(three_levels) marktbl precision(real_number) digits(integer_number) flexible(integer_number) fancy horizontal cut label collabels(list_of_column_names) extracols(list_of_column_numbers) dots suppress plain(separator_type) ready leadzero thousep ]

est2rowlbl varlist [, replace dropall saving addto(table) path(pathname) ]

est2one table [, multse(list_of_integers) horizontal cut ]

Description

The package est2tex creates a LaTeX table from estimation results in two stages. The package allows editing within Stata and creates an output file table.tex that can be read into any LaTeX document with \input{table.tex}.

First, the command est2vec collects estimation results. For this purpose, est2vec uses auxiliary matrices: table_b, table_se and table_e (and possibly table_r). Applying est2vec after each estimation command, estimation results can be added to the table in a step-by-step manner.

Second, the command est2tex transforms the so-created matrices into a LaTeX table and saves the result to disk. The output file table.tex can be read directly into a LaTeX document with the TeX command \input{table.tex}. Under the option plain(), est2tex saves the same information in a plain ascii file that can be included in any type-setting software.

The command est2rowlbl can be used prior to est2tex to save a file table_rowlbl.dta with variable labels. Then est2tex reports the variable labels in the rows of the LaTeX table, rather than variable names.

The command est2one creates a master matrix table_tbl from the auxiliary matrices table_b, table_se and table_e (and possibly table_r).

A simple example below explains the main steps.

The package matsave must be installed for est2tex to work.

Options for est2vec

replace permits est2vec to overwrite the matrices table_b, table_se, table_e and table_r in memory. replace may not be abbreviated.

vars(list_of_regressors) Option vars(list_of_regressors) specifies that list_of_regressors be included in the auxiliary matrices table_b (coefficients) and table_se (according standard errors). If list_of_regressors contains variables that have not been regressors in the estimation, the according entries are set to -999 (missing for Stata versions prior to 8) in table_b and table_se. They will result in blanks (or dots under the option dots) in the final LaTeX table. If _cons is not in list_of_regressors, table_b and table_se will not include an estimate for the constant. In multiple equation regressions (commands such as reg3 or mlogit), option vars(list_of_regressors) recognizes regressors with colons (equation_name:variable). If vars(list_of_regressors) is not specified, est2vec includes all regressors from the most recent estimation in table_b and table_se.

shvars(varlist) can be a short-hand alternative to option vars(). shvars(varlist) specifies that varlist be included in table_b and table_se. Wildcards and dashes may be used in varlist. However, variables that are not in the current data will be ignored. Moreover, shvars(varlist) does not allow for regressors in multiple equation regressions (commands such as reg3 or mlogit); for those cases option vars() must be used. The estimate for the constant is always reported (_cons cannot be in varlist). If varlist contains variables that have not been regressors in the estimation, the according entries are set to -999 (missing for Stata versions prior to 8) in table_b and table_se. They will result in blanks (or dots under the option dots) in the final LaTeX table. Option vars() overrides shvars(varlist).

e(list_of_macro_names) specifies which e() macros beyond e(N) are included in table_e. If list_of_macro_names contains macros that have not been assigned during the estimation or if it refers to non-scalars, the according entries are set to -999 (missing for Stata versions prior to 8) in table_e. They will result in blanks (or dots under the option dots) in the final LaTeX table. Information in table_e will be reported below the coefficient estimates in the final LaTeX table.

r(list_of_macro_names) If this option is specified, est2vec exclusively assembles r() macros related to the estimation, such as test results. For this purpose, est2vec creates the auxiliary matrix table_r. If list_of_macro_names contains names that have not been assigned to r() macros, the according entries are set to -999 (missing for Stata versions prior to 8) in table_r. They will result in blanks (or dots under the option dots) in the final LaTeX table. Information in table_r will be reported below the e() entries in the final LaTeX table.

addto(oldtable) augments the matrices oldtable_b, oldtable_se and oldtable_e by a column that contains the results of the latest estimation. The matrices oldtable_b, oldtable_se and oldtable_e must have been created previously with est2vec. If the latest estimation contains coefficients that are not part of oldtable, those estimates will not be included. See option vars().

raddto(oldtable) augments the matrix oldtable_r by a column that contains the current values of the according r() macros. The matrix oldtable_r must have been created previously with est2vec. The procedure only applies to r() macros that are also part of oldtable_r.

name(estimation_name) names the newly added column in table with estimation_name. By default, the column name of a newly added column is the dependent variable in the latest estimation. However, for the command est2tex to work, column names must be unique. The option name(estimation_name) helps avoid duplicate column names. When invoking the command est2tex later, the option collabels() will allow to change the column names for the final table.

force can only be specified together with addto() or raddto(). Under the options addto(oldtable) or raddto(oldtable), est2vec adds estimates to oldtable only for those coefficients that are part of oldtable. Estimates for additional coefficients (macros) are ignored. The option force forces est2vec to add coefficient estimates (macros) to oldtable row by row, irrespective of whether they match or not. The added column must be conformable to the existing matrices oldtable_b, oldtable_se and oldtable_e (or oldtable_r if specified).

nokeep can only be specified together with addto(oldtable) or raddto(oldtable). The newly created vectors table_b, table_se and table_e (or table_r if specified) are dropped once the columns have been added to oldtable.

Options for est2tex

replace permits est2tex to overwrite the output files table.tex and table_tbl.dta if they exist. Unless the option ready is specified, replace also overwrites an existing matrix table_tbl in memory. replace may not be abbreviated.

dropall drops all variables from memory to execute est2tex. If there are data in memory and neither dropall nor preserve is specified, est2tex will result in the error "no; data in memory would be lost".

preserve preserves the current dataset in memory before dropping all variables from memory. If there are data in memory and neither dropall nor preserve is specified, est2tex will result in the error "no; data in memory would be lost".

path(pathname) supplies the path where est2tex saves table.tex and table_tbl.dta. pathname needs to be a valid string. If path() is not specified, then est2tex saves in the current Stata working directory.

multse(list_of_integers) includes a number of different standard errors below every coefficient estimate in the LaTeX table. For this purpose, according auxiliary matrices must be created first and named table_se1, table_se2, ... . The option multse(1 3 2), for instance, inserts standard errors from matrices table_se1, table_se3 and table_se2 in that order in the LaTeX table. When multse() is specified, then the option mark() must be followed by the number of the standard error table on which the marking should be based. Example: mark(it 2). multse() expects matrices between se1 and se9.

mark(marking_option) marks estimates according to their significance. When mark(stars) is specified, est2tex adds stars to the standard errors. Up to three levels of stars can be assigned with the levels() option (see below). When mark(starb) is specified, est2tex adds stars to the coefficient estimates. When mark(it) is specified, then est2tex sets a coefficient estimate in italics if it fails to be significant at the standard significance level (global macro S_level, see levels() option below). Estimators are assumed to be normally distributed.

levels(three_levels) changes significance levels for the mark() option. Default levels are based on the global Stata macro S_level. With S_level taking the standard value of 95, the default three_levels are "95 99 99.9" (for S_level 90, they are "90 95 99"; for 99 they are "99 99.9 99.99"). The default setting "95 99 99.9" has the following consequences. When mark(it) is specified, estimates are set in italics below the 95% significance level. When mark(stars) or mark(starb) is specified, estimates receive one star if they are significant at the 95% significance level, two stars at the 99% significance level and three stars at the 99.9% level. With levels(95 99 99) specified, no estimate would receive three stars. With levels(95 95 95), estimates would only receive one or no star. With levels(90 95 95), the mark(it) option results in italics below the 90% level and the mark(stars) or mark(starb) option in one star at the 90% level or above and in two stars at the 95% level or above. In general, the mark(it) option obeys the lowest of the three_levels. The mark(stars) or mark(starb) option obeys all three_levels as long as a level strictly exceeds the preceding level. Estimators are assumed to be normally distributed.

marktbl keeps an auxiliary matrix t_stars in memory. This matrix contains the information on significant and insignificant estimates.

precision(real_number). est2tex rounds figures in the LaTeX table so that they resemble the real number specified in precision(real_number). The option precision(.001), for instance, rounds all figures to three digits. precision() cannot be specified if digits() is used. precision(.001) and digits(3) are equivalent. The default for precision() is .001.

digits(integer_number). est2tex rounds figures in the LaTeX table to the number of digits specified in digits(). digits() cannot be specified if precision() is used. digits(3) and precision(.001) are equivalent. The default for digits() is 3.

flexible(integer_number) permits that figures exceed the number of specified digits. It only applies to figures that would otherwise be reported as zero. Under the option flexible(2), for instance, the figure .00005 is reported as such even though rounding under the default option digits(3) would create a zero. The default for flexible() is 2.

fancy results in a LaTeX table with additional features such as horizontal lines like in journal publications and additional intercolumn spacing to fill a predefined table width. This option is recommended if the table is to be embedded in a \begin{table} \end{table} environment in LaTeX. Otherwise, overfull or underfull boxes may result in LaTeX.

horizontal transposes the final table. The estimation results are reported in rows and the coefficient estimates are listed in columns. The option cut is automatically activated when horizontal is chosen.

cut suppresses both the e() and r() macro output in the final table.

label writes variable labels instead of variable names into the final table table.tex. If a variable is no longer in memory or if no label is set, the simple name is used. label is ignored under the options horizontal and ready. If the option fancy is simultaneously specified, common estimation or result macros such as e(N) or r(F) are reported with their according long names. If a row label file with the name table_rowlbl.dta exists in path(pathname), then the saved labels override the label option. See the command est2rowlbl below.

collabels(list_of_column_names) allows to rename the column names in the final table table.tex. Blanks must separate the column names in list_of_column_names from each other. The LaTeX symbol ~ can be used to obtain spacing within an individual column name. collabels() is ignored under the options horizontal and plain.

extracols(list_of_column_numbers) adds empty columns to a LaTeX table. The option extracols(1 3 5), for instance, adds empty columns to the LaTeX table behind columns 1, 3 and 5.

dots reports a dot instead of a blank for missing values.

suppress removes the standard errors from the LaTeX table. suppress may not be abbreviated.

plain(separator_type) produces an ascii file instead of a LaTeX table. plain(tab) saves a tabulator separated file table.txt, and plain(csv) a comma separated file table.csv. Some options producing specific LaTeX code are not active when plain is chosen.

ready produces a LaTeX table from an existing matrix table_tbl in Stata memory. The matrix table_tbl can be created using est2one. When applying ready, the option horizontal should be used only once, either with est2one or with est2tex. ready may not be abbreviated. When the mark() option is specified together with ready, est2tex expects coefficient estimates and standard errors to alternate row by row in the ready matrix table_tbl.

leadzero adds leading zeros to coefficient estimates, standard errors, and e() and r() numbers in the LaTeX table. The option leadzero requires the option fancy.

thousep inserts commas for thousands into coefficient estimates and standard errors in the LaTeX table. The option thousep requires the option fancy.

Options for est2rowlbl

replace permits est2rowlbl to overwrite an existing row label file table_rowlbl.dta in path(pathname). replace may not be abbreviated.

dropall permits est2rowlbl to drop all variables from memory to save the file table_rowlbl.dta. If neither dropall nor saving is specified, est2rowlbl will result in the error "no; data in memory would be lost".

saving forces est2rowlbl to save the data that are presently in memory and to restore the data upon completion. Setting saving does not affect a preceding preserve command. If neither dropall nor saving is specified, est2rowlbl will result in the error "no; data in memory would be lost".

addto(oldtable) specifies the table for which row labels are to be saved. The row label file receives the name table_rowlbl.dta in path(pathname).

path(pathname) supplies the path where est2rowlbl saves table_rowlbl.dta. pathname needs to be a valid string. pathname needs to be a valid string. If path() is not specified, then est2rowlbl saves in the current Stata working directory.

Options for est2one

multse(list_of_integers) includes a number of different standard errors below every coefficient estimate in the final matrix table_tbl. For this purpose, according auxiliary matrices must be created first and named table_se1, table_se2, ... . The option multse(1 3 2), for instance, inserts standard errors from matrices table_se1, table_se3 and table_se2 in that order in the LaTeX table. multse() expects matrices between se1 and se9.

horizontal transposes the final table table_tbl. The estimation results are reported in rows and the coefficient estimates are listed in columns. The option cut is automatically activated when horizontal is chosen. If horizontal is specified with est2one, it should not be specified with est2tex under the option ready.

cut suppresses both the e() and r() macro output in the final table table_tbl.

Example

We want to create a LaTeX table with regression results from ordinary least squares as in the Stata handbook (see regress). We have data on the mileage rating and weight of 74 automobiles. We wish to estimate mileage as a linear function of weight, squared weight and an indicator variable for foreign brands.

. generate weightsq = weight^2 . regress mpg weight weightsq foreign

Source | SS df MS Number of obs = > 74 -------------+------------------------------ F( 3, 70) = > 52.25 Model | 1689.15372 3 563.05124 Prob > F = > 0.0000 Residual | 754.30574 70 10.7757963 R-squared = > 0.6913 -------------+------------------------------ Adj R-squared = > 0.6781 Total | 2443.45946 73 33.4720474 Root MSE = > 3.2827 ----------------------------------------------------------------------- > ------- mpg | Coef. Std. Err. t P>|t| [95% Conf. In > terval] -------------+--------------------------------------------------------- > ------- weight | -.0165729 .0039692 -4.18 0.000 -.0244892 -. > 0086567 weightsq | 1.59e-06 6.25e-07 2.55 0.013 3.45e-07 2 > .84e-06 foreign | -2.2035 1.059246 -2.08 0.041 -4.3161 -. > 0909002 _cons | 56.53884 6.197383 9.12 0.000 44.17855 6 > 8.89913 ----------------------------------------------------------------------- > -------

We can collect information from this first regression with

. est2vec table, e(r2 F) vars(weight weightsq length domestic foreign _cons)

This command creates three auxiliary matrices table_b, table_se and table_e.

. matrix dir table_e[3,1] table_se[6,1] table_b[6,1]

Take a look at table_b, for instance.

. matrix list table_b

table_b[6,1] mpg weight -.01657294 weightsq 1.591e-06 length -999 domestic -999 foreign -2.2035002 _cons 56.538839

The auxiliary matrix table_e stores additional regression information from saved result macros:

. matrix list table_e

table_e[3,1] mpg e(N) 74 e(r2) .69129599 e(F) 52.251474

The command est2vec always stores the number of observations N in table_e. It takes this information from the saved result macro e(N). The option e(r2 F) adds R-squared and the F statistic from the macros e(r2) and e(F).

Since the variables length and domestic were not included in the regression, their coefficient estimates are reported as missing in table_b with the entry -999. The option vars(weight weightsq length domestic foreign _cons) makes sure that est2vec includes the variables length and domestic, beyond those in the regression. (The option vars() can also be used to exclude variables that are not to be reported.) If vars() is not specified, est2vec chooses all variables from the most recent regression.

No wildcards or dashes may be used in option vars(). In certain cases, the option shvars() can be a short-hand alternative to vars(). Here, we could have specified vars(weight* length foreign). The constant _cons would be included automatically. However, shvars() only works for existing variables. So, vars(weight weightsq length domestic foreign) would result in an error message until we generate the variable domestic.

An additional regression (also in the Stata handbook) includes the variables length and domestic.

. gen byte domestic=~foreign . reg weight length domestic, hascons (output suppressed)

We can collect information from this regression with

. est2vec table, addto(table)

Under the option addto(), est2vec adds results from the present regression to the previously collected matrices. Check:

. matrix list table_b

table_b[6,2] mpg weight weight -.01657294 -999 weightsq 1.591e-06 -999 length -999 31.444552 domestic -999 133.6775 foreign -2.2035002 -999 _cons 56.538839 -2983.9272

Stata sets missing values to zero in its result macros. Therefore, the estimate on _cons is zero under the hascons option and so is the standard error. Later, est2tex will produce a LaTeX table that sets both coefficients with -999 estimates and coefficients with zero standard errors to missing.

To create a LaTeX table from the assembled matrices, the command est2tex produces an auxiliary dataset in memory and then outputs the information to the file table.tex. So, the command est2tex needs an empty memory. If the present data are not removed from memory before, est2tex results in the error message "no; data in memory would be lost." Before applying est2tex, we could manually remove the current data from memory with the command drop _all. Alternatively, we can specify the option dropall to drop all variables from memory when est2tex is invoked.

We can also use the option preserve to preserve the present dataset in memory (Mark Holmes contributed the code for this option). est2tex still drops all variables. However, the data are automatically restored once est2tex has done its job (or after it encounters an error).

The command

. est2tex table, preserve path(../texdocs) mark(stars) fancy

creates a LaTeX table. It saves the files table.tex and table_tbl.dta in the directory "../texdocs/". If the Stata working directory is "c:\data\", for instance, the files will be saved in "c:\texdocs\". Upon completion, the data in memory is restored.

The option mark(stars) adds one star (two stars, three stars) to the standard error when a coefficient estimate is significant at the 95% (99%, 99.9%) level. The option fancy creates separating lines and adds spaces between columns to fit the predetermined table width in LaTeX.

Suppose we did not specify the option preserve with est2tex. Then a glance at the resulting dataset in memory shows what information goes into the LaTeX table.

. preserve . est2tex table, replace dropall path(../texdocs) mark(stars) fancy . list

_rowname mpg weight 1. weight -.0165729 -999 2. _se .0039692 -999 3. weightsq 1.59e-06 -999 4. _se 6.25e-07 -999 5. length -999 31.44455 6. _se -999 1.601234 7. domestic -999 133.6775 8. _se -999 77.47614 9. foreign -2.2035 -999 10. _se 1.059246 -999 11. _cons 56.53884 -2983.927 12. _se 6.197383 275.1041 13. e(N) 74 74 14. e(r2) .691296 .8991605 15. e(F) 52.25147 316.5447

. restore

The resulting LaTeX code in the final file table.tex is somewhat less transparent.

\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}lcc} & \multicolumn{1}{c}{mpg} & \multicolumn{1}{c}[weight] \\ \cline{2-3} & \multicolumn{1}{c}{(1)} & \multicolumn{1}{c}{(2)} \\ \hline weight & -.016 & \\ & \raisebox{.7ex}[0pt]{\scriptsize (.004)$^{***}$} & \\ weightsq & 1.59e-06 & \\ & \raisebox{.7ex}[0pt]{\scriptsize (6.25e-07)$^$} & \\ length & & 31.445 \\ & & \raisebox{.7ex}[0pt]{\scriptsize (1.601)$^{***}$} \\ domestic & & 133.678 \\ & & \raisebox{.7ex}[0pt]{\scriptsize (77.476)} \\ foreign & -2.203 & \\ & \raisebox{.7ex}[0pt]{\scriptsize (1.059)$^$} & \\ cons & 56.539 & -2983.926 \\ & \raisebox{.7ex}[0pt]{\scriptsize (6.197)$^{***}$} & \raisebox{.7ex}[0pt]{\scriptsize (275.104)$^{***}$} \\ e(N) & 74 & 74 \\ e(r2) & .691 & .899 \\ e(F) & 52.251 & 316.545 \\ \hline\hline \end{tabular*}%

The resulting LaTeX document, however, should be quite agreeable. The file table.tex can be inserted into any LaTeX document with the command sequence \begin{table} \input{table.tex} \end{table}.

The following LaTeX code produces a sample document.

\documentclass[12pt]{article} \begin{document} \title{Stata: \emph{est2tex}}% \author{\Large Help File Example}% \maketitle \thispagestyle{empty} \bigskip \noindent This is the resulting table. \begin{table}[h] \input{table.tex} \end{table} \end{document}

If we wanted to include Stata's variable labels rather than the variable names in the LaTeX table, we could specify the option label (Mark Holmes contributed code for this option). Similarly, if we wanted est2tex to override the column names from est2vec, we could specify replacements using the option collabels(). Both label and collabels() permit the inclusion of LaTeX code in the file table.tex. The option collabels() expects blanks to separate the individual column names from each other. So, for collabels() to assign labels properly, the LaTeX code must be written without any blanks (using the symbol ~ for spacing).

. label var weight "Weight ({\it lbs.})" . label var weightsq "Squared weight ({\it lbs.}$^2$)" . label var length "Length ({\it in.})" . est2tex table, replace preserve path(../texdocs) mark(stars) levels(95 99 99) fancy lab collab("Mileage~$\left(\frac{miles}{gallon}\right)$ Weight~(\emph{lbs.})")

The option levels(95 99 99) in the last command makes sure that only two levels of significance are used to mark the estimates with (zero, one or two) stars (but not with three stars).

General Remarks

When invoked after any estimation command, est2vec creates three auxiliary vectors in memory: table_b, table_se and table_e. The vector table_b contains all coefficient estimates from the most recent estimation. The vector table_se lists the according standard errors. The vector table_e contains additional information about the estimation.

By default, table_e has one row named e(N) and lists the number of observations. Additional results saved as e() scalars can be included in table_e by specifying the according e(list_of_macro_names) option. est2vec can store results from r() macros in a fourth vector table_r with option r(list_of_macro_names). This can be useful for reporting test results. Under the r() option, est2vec only forms the vectortable_r.

Generally, tables contain results from more than one estimation. The command est2vec allows to build up tables gradually. After executing any additional estimation, est2vec adds the latest estimates to the existing table with the option addto(table). Repeating this procedure, the vectors table_b, table_se and table_e (and table_r if specified) become matrices and the desired final LaTeX table can be assembled step by step. The column name in table_b, table_se and table_e (and table_r if specified) is the name of the dependent variable in the most recent estimation unless option name() specifies otherwise.

The command est2tex combines the information in the matrices table_b, table_se and table_e (and table_r if it exists) to one LaTeX table and saves the results in a file table.tex. Any LaTeX document can include that file directly with the TeX command \input{table.tex}. Various options control the style of the LaTeX table in table.tex. Apart from the file table.tex, est2tex creates an according table table_tbl as Stata matrix in memory and saves it to disk in table_tbl.dta. This table can be loaded later with the command matload (see package matsave).

Instead of creating LaTeX output immediately, the command est2one combines the information from matrices table_b, table_se and table_e (and table_r if it exists) to one large Stata matrix table_tbl. This matrix table_tbl can be edited (convenient commands for that purpose may be found in packages dm69 and dm79; also see matrix). Then, the edited matrix can be saved as a LaTeX table with the command est2tex under the option ready.

The name of table is not allowed to coincide with a variable name in memory. Missing estimates are reported as -999 in the Stata matrices and with blanks or dots (option dots) in the LaTeX tables.

Remarks on est2vec

The command "est2vec table, addto(oldtable)" creates the auxiliary vectors table_b, table_se and table_e. It also adds these vectors to the matrices oldtable_b, oldtable_se and oldtable_e. Under the option nokeep, the auxiliary vectors table_b, table_se and table_e are dropped from memory. In the example above, a slight abuse of syntax did the same: "est2vec oldtable, addto(oldtable)" is equivalent to "est2vec table, addto(oldtable) nokeep".

When assembling estimates from multiple equation regressions (reg3 or mlogit, for instance), est2vec only adds equations that have been specified initially. Consider the following regression from the same automobile dataset as before. The variable rep78 can take five values (1 through 5) that represent the repair record. The command

. mlogit rep78 price mpg foreign, base(1) (output suppressed)

estimates the probability of categories 2 through 5, relative to category 1, as a function of price, mpg and foreign. We can store the results with

. est2vec table2

All estimates are identified with their according "equation name". These equation names are the categories of rep78 in the case of mlogit:

. matrix list table2_b

table2_b[16,1] rep78 2:price .00040825 2:mpg -.02318283 2:foreign -18.15009 2:_cons -.20046453 3:price .0004733 3:mpg -.00072598 3:foreign 19.271375 3:_cons .18466295 4:price .00044831 4:mpg .03087516 4:foreign 21.364028 4:_cons -1.3762754 5:price .00064603 5:mpg .21926142 5:foreign 22.223713 5:_cons -8.2147995

If we chose category 5 as base category instead of 1, we would run

. mlogit rep78 price mpg foreign, base(5) (output suppressed)

Adding these estimates to the preceding table2 with

. est2vec table2, addto(table2) name(rep78_alt)

yields

. matrix list table2_b

table2_b[16,2] rep78 rep78_alt 2:price .00040825 -.00023778 2:mpg -.02318283 -.24244424 2:foreign -18.15009 -37.373803 2:_cons -.20046453 8.014335 3:price .0004733 -.00017272 3:mpg -.00072598 -.21998739 3:foreign 19.271375 -2.9523383 3:_cons .18466295 8.3994624 4:price .00044831 -.00019772 4:mpg .03087516 -.18838626 4:foreign 21.364028 -.85968569 4:_cons -1.3762754 6.8385241 5:price .00064603 0 5:mpg .21926142 0 5:foreign 22.223713 0 5:_cons -8.2147995 0

Since equation "5" is not independently identified in the last regression, the according estimates are set to missing in the Stata output (check table_se). On the other hand, equation "1" is left out since it was not identified before.

In some final tables, we may want to show the according estimates. est2vec provides two ways to do so.

First, we can specify the according option vars() initially. (The option shvars() is inappropriate for multiple equation regressions.)

. mlogit rep78 price mpg foreign, base(1) (output suppressed) . est2vec table3, vars(1:price 1:mpg 1:foreign 1:_cons 2:price 2:mpg 2:foreign 2:_cons 3:price 3:mpg 3:foreign 3:_cons 4:price 4:mpg 4:foreign 4:_cons 5:price 5:mpg 5:foreign 5:_cons) . mlogit rep78 price mpg foreign, base(5) (output suppressed) . est2vec table3, addto(table3) name(rep78_alt) . matrix list table3_b

yields

table3_b[20,2] rep78 rep78_alt 1:price 0 -.00064603 1:mpg 0 -.21926142 1:foreign 0 -37.223714 1:_cons 0 8.2147995 2:price .00040825 -.00023778 2:mpg -.02318283 -.24244424 2:foreign -18.15009 -37.373803 2:_cons -.20046453 8.014335 3:price .0004733 -.00017272 3:mpg -.00072598 -.21998739 3:foreign 19.271375 -2.9523383 3:_cons .18466295 8.3994624 4:price .00044831 -.00019772 4:mpg .03087516 -.18838626 4:foreign 21.364028 -.85968569 4:_cons -1.3762754 6.8385241 5:price .00064603 0 5:mpg .21926142 0 5:foreign 22.223713 0 5:_cons -8.2147995 0

Alternatively, we can specify the option force after the second regression. This forces the estimates from the second regression into the table irrespective of the equations and variables from the first step. We need to make sure that the newly added vectors conform to the previous table. This is satisfied here.

. mlogit rep78 price mpg foreign, base(1) (output suppressed) . est2vec table4 . mlogit rep78 price mpg foreign, base(5) (output suppressed) . est2vec table4, addto(table4) name(rep78_alt) force . matrix list table4_b

table4_b[16,2] rep78 rep78_alt 2:price .00040825 -.00064603 2:mpg -.02318283 -.21926142 2:foreign -18.15009 -37.223714 2:_cons -.20046453 8.2147995 3:price .0004733 -.00023778 3:mpg -.00072598 -.24244424 3:foreign 19.271375 -37.373803 3:_cons .18466295 8.014335 4:price .00044831 -.00017272 4:mpg .03087516 -.21998739 4:foreign 21.364028 -2.9523383 4:_cons -1.3762754 8.3994624 5:price .00064603 -.00019772 5:mpg .21926142 -.18838626 5:foreign 22.223713 -.85968569 5:_cons -8.2147995 6.8385241

Much care is warranted with the force option. Most importantly, the row names in the table only apply to the first but by no means to the second estimation. In fact, the equation numbers underlying the second column are exactly the equation numbers of the first column less one.

Output to type-setting software other than LaTeX

The command outreg produces output files for text editors in general. It offers a different and rich set of options. Sometimes, the combination of two steps (est2vec and est2one) in est2tex may help create tables that are hard to obtain with outreg. For such cases, est2tex offers the option plain() and allows to produce output files similar to those of outreg.

Table3 above, for instance, can be saved in a plain text file with

. est2tex table3, path(../texdocs) dropall plain(tab)

Author

Marc-Andreas Muendler, Assistant Professor, Department of Economics, University of California, San Diego. URL: http://econ.ucsd.edu/~muendler/, Email: muendler@econ.ucsd.edu. (Code for options label and preserve courtesy of Mark Holmes.)

Also see

Manual: [P] matrix utility Stata: help for matrix, mkmat, matrname