help outreg (basic options)
-------------------------------------------------------------------------------

Title

outreg - reformat and write regression tables to a document file

This is simplified help for outreg with a subset of options for a typical regression table. For complete documentation, see complete outreg.

For an explanation of the large changes to outreg since the last version, see outreg updates.

Syntax

outreg [using filename] [, options]

options Description ------------------------------------------------------------------------- Basic options se standard errors, not t stats, below coefficients bdec(numlist) decimal places for estimates b; default is bdec(3) summstat(evaluegrid) place additional summary statistics below coefficient estimates starlevels(numlist) significance levels for stars eq_merge create separate columns for each equation after a multi-equation estimation

varlabels use variable labels as row headings title(textcolumn) put title above table ctitles(textgrid) specify column headings rtitles(textgrid) specify row headings note(textcolumn) put note below table squarebrack square brackets instead of parentheses

tex write TeX file instead of default MS Word file merge merge table with a previous table replace overwrite existing file ------------------------------------------------------------------------- where the syntax of textcolumn is "string" [\"string"...] textrow is "string" [,"string"...] textgrid is "string" [,"string"...] [\ "string"[,"string"...] [\ [...]]] or a textrow or a textcolumn as a special case

"string" ["string" ...] will often work in place of a textrow or a textcolumn when the user's intent is clear, but if in doubt use the proper textrow or textcolumn syntax above.

There are many other options available; see complete outreg.

Description

outreg formats the results of Stata estimation commands in tables as they are typically presented in journal articles, rather than as they are presented in the Stata Results window. By default, t statistics appear in parentheses below the coefficient estimates with asterisks for significance levels, with the number of observations and R-squared (no pseudo R-squareds) below all the estimates. outreg automates the process of converting estimation results to standard tables by creating a Microsoft Word or TeX document containing a formatted table. Almost every aspect of the table's structure and formatting (including fonts) can be specified with options.

outreg works after any estimation command in Stata (see estimation commands for a complete list). Like predict, outreg makes use of internally saved estimation results, so it should be invoked after the estimation.

The table created by outreg is displayed in the Results window, minus the fancy font specifications, unless the nodisplay option is employed. If using filename is specified, outreg creates a Microsoft Word file by default, or a TeX file using the tex option.

Successive estimation results, which may use different variables, can be combined by outreg in a single table with the variable coefficients lined up properly using the merge option. (n.b. In previous versions of outreg, the merge option was called "append".)

Options

+-------+ ----+ Basic +------------------------------------------------------------

se specifies that standard errors rather than t statistics are reported in parentheses below the coefficient estimates. The decimal places displayed are those set by bdec.

bdec(numlist) specifies the number of decimal places reported for coefficient estimates (the b's). It also specifies the decimal places reported for standard errors if se. The default value for bdec is 3. The minimum value is 0 and the maximum value is 15. If one number is specified in bdec, it will apply to all coefficients. If multiple numbers are specified in bdec, the first number will determine the decimals reported for the first coefficient, the second number, the decimals for the second coefficient, etc. If there are fewer numbers in bdec than coefficients, the last number in bdec will apply to all the remaining coefficients.

summstat(evaluegrid) places additional summary statistics below the coefficient estimates. evaluegrid is a grid of the names of different e() return values already calculated by the estimation command. The syntax of the evaluegrid is the same as the other grids used in outreg like the textgrid. Elements within a row are separated with commas (","), and rows are separated by backslashes ("\"). The default value of summstat is summstat(r2 \ N) (when e(r2) is defined), which places the R-squared statistic e(r2) below the coefficient estimates, and the number of observations e(N) below that.

To replace the R-squared with the adjusted R-squared stored in e(r2_a), you can use the options summstat(r2_a \ N) and summtitle("Adjusted R2" \ "N"). You can also specify the decimal places for the summary statistics with the summdec option. To see a complete list of the e() macro values available after each estimation command, type ereturn list.

Statistics not included in the e() return values can be added to the table with the addrows option.

starlevels(numlist) indicates significance levels for stars in percent. By default, one star is placed next to coefficients which pass the test for significant difference from zero at the 5% level, and two stars next to coefficients that pass the test for significance at the 1% level, which is equivalent to starlevels(5 1). To place one star for the 10% level, 2 for the 5% level, and 3 for the 1% level, you would specify starlevels(10 5 1). To place one star for the 5% level, 2 for the 1% level, and 3 for the 0.1% level, you would specify starlevels(5 1 .1).

eq_merge creates separate columns for each equation after a multi-equation estimation. The entries in each column are merged according to the variable names, similarly to the merge option for combining separate estimation results. This option is useful after estimation commands like reg3, sureg, mlogit, mprobit, etc. where many of the same variables occur in different equations.

varlabels causes outreg to use variable labels (rather than variable names) as row titles for each coefficient. See little to specify row titles manually.

title(textcolumn) specifies a title or titles above the regression table. Subtitles should be separated from the primary titles by backslashes ("\"), like this: {opt title("Main Title" \ "First Sub-Title" \ "Second Sub-Title"). By default, titles are set in a larger font than the body of the table.

ctitles(textgrid) specifies the column titles above the estimates. By default if no ctitles are specified, the name of the dependent variable is displayed. A simple form of ctitles is, for example, ctitles("Variables","First Regression"). Note that the first title in ctitles goes above the variable name column and the second title goes above the estimates column. If you want no heading above the variable name column, specify ctitles("","First Regression"). Fancier titles in ctitles can have multiple rows. See ctitles for details.

rtitles(textgrid) replaces the leftmost column of the table with new row titles for the coefficient estimates. By default (with no rtitles option), the row titles are variable names. Multiple titles in rtitles should be separated by "\" since they are placed below one another (if the titles are separated with commas, they will all be placed in the first row of the estimates). An example of rtitles is rtitles("Variable 1" \ "" \ "Variable 2" \ "" \ "Constant"). The empty titles "" are to account for the t statistics below the coefficients.

note(textcolumn) specifies a note to be displayed below the outreg table. Multiple lines of a note should be separated by backslashes ("\"), like this: note("First note line."\"Second note line."\"Third note line."). Notes are centered immediately below the table. By default, they are set in a smaller font than the body of the table.

squarebrack substitutes square brackets for parentheses around the statistics placed below the first statistic. This means that square brackets, rather than parentheses, are placed around t statistics below the coefficient estimates (when using the default statistics). See brackets for more complete control of bracket symbols around statistics.

tex specifies that outreg writes a TeX output file rather than a Word file. The output is suitable for including in a TeX document (see the fragment option) or loading into a TeX typesetting program such as Scientific Word.

merge specifies that new estimation output be merged with an existing table. The coefficient estimates are lined up matching the text in the left-most columns by the appropriate variable name or rtitles, with the coefficients for new variables placed below the original variables, but above the constant term. Note that in previous versions of outreg, the merge option was called append. Users will usually want to specify ctitles when using merge.

replace specifies that it is okay to overwrite an existing file.

Remarks

For information on many other options, see complete outreg.

Examples

1. Basic usage and variable labels.

outreg is used after an estimation command because it needs the saved estimation results to construct a formatted table. Consider a regression using Stata's auto.dta dataset:

. sysuse auto, clear (1978 Automobile Data)

. reg mpg foreign weight

Source | SS df MS Number of obs = > 74 -------------+------------------------------ F( 2, 71) = > 69.75 Model | 1619.2877 2 809.643849 Prob > F = > 0.0000 Residual | 824.171761 71 11.608053 R-squared = > 0.6627 -------------+------------------------------ Adj R-squared = > 0.6532 Total | 2443.45946 73 33.4720474 Root MSE = > 3.4071

----------------------------------------------------------------------- ------- mpg | Coef. Std. Err. t P>|t| [95% Conf. In > terval] -------------+--------------------------------------------------------- ------- foreign | -1.650029 1.075994 -1.53 0.130 -3.7955 . > 4954422 weight | -.0065879 .0006371 -10.34 0.000 -.0078583 -. > 0053175 _cons | 41.6797 2.165547 19.25 0.000 37.36172 4 > 5.99768 ----------------------------------------------------------------------- -------

The simplest form of outreg displays a reformatted estimation table in the Stata Results window.

. outreg

---------------------- mpg ---------------------- foreign -1.650 (1.53) weight -0.007 (10.34)** _cons 41.680 (19.25)** R2 0.66 N 74 ---------------------- * p<0.05; ** p<0.01

The command outreg using auto creates a new Word file named auto.doc as well as displaying the table in the Results window (which can be turned off with nodisplay).

outreg can also create tables in TeX format with the tex option.

The option varlabels replaces variable names with their labels, so that the independent variable mpg listed above the column of regression coefficients uses the label "Mileage (mpg)", the variable foreign uses its label "Car type", etc. The user can change the variable labels before invoking outreg to provide the desired captions in the outreg table. Alternatively, the user can specify column and row titles directly with ctitles and rtitles.

If the file auto.doc already exists from a previous outreg using auto command, we must include the replace option as well.

. outreg using auto, varlabels replace -------------------------------- Mileage (mpg) -------------------------------- Car type -1.650 (1.53) Weight (lbs.) -0.007 (10.34)** Constant 41.680 (19.25)** R2 0.66 N 74 -------------------------------- * p<0.05; ** p<0.01

Example 2. Decimal places for coefficients and titles

The regression table in the previous example would be improved by formatting the coefficient values and adding informative titles. By default the regression coefficients are shown with three decimal places in outreg tables, but this isn't very satisfactory for the weight variable in the regression above. The weight coefficient is statistically significant, but only one non-zero digit is displayed. We could use the option bdec(5) to display 5 decimal places for all the coefficients, but we can do better. To display five decimal places of the weight coefficient only and two decimal places of the other coefficients, we use {opt bdec(2 5 2)}.

We can add a title to the table with the title option. As long as the title text contains no backspaces (which indicate multiple lines of title), no quotation marks are required, so we add the option title(What kind of cars have low mileage?). We also change the column heading of the estimates from the name of the independent variable to "Base case" with ctitle("",Base case). We need the "" to indicate that there is no ctitle in the left-most column of the table. We can get away with no quotes around "Base case" because there is no "," or "\" in the title, which are interpreted by ctitles as column and row delimiters.

. outreg using auto, bdec(2 5 2) replace /// title(What cars have low mileage?) ctitle("", Base case) What cars have low mileage? ---------------------------- Base case ---------------------------- Car type -1.65 (1.53) Weight (lbs.) -0.00659 (10.34)** Constant 41.68 (19.25)** R2 0.66 N 74 ---------------------------- * p<0.05; ** p<0.01

If you run the commands above and open the resulting file auto.doc in Word or most other word-processing software, you can see the formatted table created by outreg.

Example 3. Merging estimation tables together.

Users often want to include several related estimations in the same table. outreg automatically combines results with the merge option.

We create a new variable weightsq for the second regression.

. gen weightsq = weight^2 . label var weightsq "Weight squared"

Then we run the second regression with the quadratic weightsq term.

. regress mpg foreign weight weightsq (output omitted)

We add the second regression results to the regression table in Example 2 with the merge option. In the second regression, the weightsq term is statistically significant but very small due to the small units used for weight (pounds). We can avoid displaying a large number of decimal places by formatting the weightsq coefficient in scientific notation with the option bfmt(f f e f). We also specify the number of decimal places for each coefficient as in the first regression, and add an informative column title with the options bdec(2 5 2) and ctitle("", Quadratic mpg). Note that although there are four coefficients (counting the constant), there are only three numbers in bdec(2 5 2). The last number in bdec, 2, applies to all the remaining coefficients.

. outreg using auto, bdec(2 5 2) bfmt(f f e f) ctitle("", Quadratic mpg > ) /// varlabels merge replace What cars have low mileage? -------------------------------------------- Base case Quadratic mpg -------------------------------------------- Car type -1.65 -2.20 (1.53) (2.08)* Weight (lbs.) -0.00659 -0.01657 (10.34)** (4.18)** Weight squared 1.59e-06 (2.55)* Constant 41.68 56.54 (19.25)** (9.12)** R2 0.66 0.69 N 74 74 -------------------------------------------- * p<0.05; ** p<0.01

The coefficients and t statistics for the variables are aligned correctly in the merged table.

Note that since the first outreg table from Example 2 used varlabels, we need to use varlabels in the outreg command that merges the second regression. If not, the rtitles would differ between the original table and the new results being merged and the coefficients would not be aligned correctly. For example, the label for the first coefficient in the original table is "Car type". Without the varlabels option in the outreg commmand above merging the new results, the first coefficient of the second regression would be labeled "foreign" and would be treated as new variable instead of being aligned in the first row with "Car type".

Example 4. Standard errors, brackets, and no asterisks in a TeX table

Economics journals often prefer standard errors to t statistics and don't use asterisks to denote statistical significance. The se option replaces t statistics with standard errors, and the nostar option suppresses asterisks. We will also replace the parentheses around the standard errors with square brackets using the squarebrack option, and save the document as a TeX file with the tex option. Note that the decimal places specified by the bdec option apply to both the coefficients and the standard errors.

. regress mpg foreign weight (output omitted)

. outreg using auto, se bdec(2 5 2) squarebrack nostars replace tex /// varlabels title(No t statistics, please - we're economists) No t statistics, please - we're economists -------------------------------- Mileage (mpg) -------------------------------- Car type -1.65 [1.08] Weight (lbs.) -0.00659 [0.00064] Constant 41.68 [2.17] R2 0.66 N 74 --------------------------------

Example 5. 10% significance level and summary statistics.

The cutoff levels for stars indicating statistical significance can be modified with the starlevels option. The default levels are one star for 5% significance and two stars for 1% significance (i.e. starlevels(5 1)). To add a symbol for 10% significance, we use the option starlevels(10 5 1). This would display 1 star for 10%, 2 for 5%, and 3 for 1%. To retain the original number of stars for 5% and 1% levels, but add a cross for the 10% level, we can use the option sigsymbols(+,*,**) with the symbols corresponding to the significance levels in starlevels. The legend at the bottom of the outreg table is modified to reflect these options.

The default summary statistics are the R-squared (if it's defined) and the number of observations. Instead, we display the F statistic and the adjusted R-squared using the summstat option. The symbols used for these statistics in the estimates return values are "F" and "r2_a". All available return values after an estimation can be seen with the command ereturn list. The summstat(F \ r2_a) option is specified with a backslash separating the statistics because we want them to be on different rows in the same column (if we used a comma to separate the values, they would be on the same row in different columns, making the table one column wider). We also specify the names of the statistics in summtitle(F statistic \ Adjusted R-squared), similarly to rtitles. To give the F statistic one decimal place and the adjusted R-squared two decimal places, we use the option summdec(1 2).

. reg mpg foreign weight turn (output omitted)

. outreg using auto, bdec(2 5 3 2) varlabels replace /// starlevels(10 5 1) sigsymbols(+,*,**) summstat(F \ r2_a) /// summtitle(F statistic \ Adjusted R-squared) summdec(1 2) ------------------------------------- Mileage (mpg) ------------------------------------- Car type -2.08 (1.85)+ Weight (lbs.) -0.00560 (5.59)** Turn Circle (ft.) -0.235 (1.28) Constant 48.13 (8.78)** F statistic 47.5 Adjusted R-squared 0.66 ------------------------------------- + p<0.1; * p<0.05; ** p<0.01

For additional examples of the use of outreg, see the examples in the complete outreg documentation.

Also see