Writing a formatted regression output using -outreg-


I used to copy-paste regression results into Windows Excel spreadsheet, not only to do some formatting, but also to add asterisks to indicate significance, write notes, etc., until I learned about -outreg- (thanks to Utsav). -outreg-, written by J.L. Gallup, writes formatted regression output and saves them into a specified spreadsheet. The command is especially helpful when you want to compare a number of regression results, as we always do, to check for the robustness of our results. The table below shows an example of an -outreg- result.



How do you create this table?

reg y_var x_vars1, [robust]   /* results displayed in column (1) /
outreg x_vars using filename, [options] replace /
the replace option replaces the file filename */

reg y_var x_vars2, [robust]   /* results displayed in column (2) /
outreg x_vars using filename, [options] append /
the append option appends the result of the regression to filename /
.
.
.
reg y_var x_vars8, [robust]   /
results displayed in column (8) */
outreg x_vars using, [options] append

The options specified to create the table above are:

bdec(#)
/*specifies the number of decimal places for the reported estimates */

nor2
/* specifies that R-squared will not be reported. I wanted to show R-squared, but not in its default position. I used the addstat() option to do this. */

coefast
/* specifies that * for significance levels are appended to regression coefficients */

3aster
/* specifies 3 * for 1%, 2 * for 5%, and 1 * for 10% significance levels */

se
/* specifies that standard errors wil be displayed, not t-statistics */

nolabel
/* specifies that variable names will be reported, not variable labels */

bracket
/* specifies that [] are used, not () for t-statistics or standard errors. This is specifically helpful because, by default, Excel reads numbers in () as negative numbers. */

addstat(“text” , # [, “text”, # …])
/*specifies other statistics you want to add in the table. In this case, I added the following:
“Degrees of freedom”, e(df_r)
“R-squared”, e(r2)
“Adjusted R-squared”, e(r2_a)
*/

More options are available for -outreg-, type “help outreg”. But, first, you need to install -outreg- by typing:

net install sg97_3.pkg

Note: The results shown in the table above are from some of the tests we (with Jesus Felipe and Utsav Kumar) did for the paper “Using Capabilities to Project Growth, 2010-2030.”

2 Responses

  1. Can you please confirm my understanding of the postestimate “iccvar” command proceeding xtmixed.

    I want to assess the correlation between two continuous variables (both serum markers) over three time points in a cohort of 50 patients.

    I have used xtmixed to see if they are significantly correlated which they are but want to see how tightly ie. a correlation coefficent. I then ran the iccvar command and the output gave me a value for ICC. I am wondering if this is the correlation coefficient between the two continuous variables? IF not can you suggest how I obtain this?

    Cheers,
    Megan

Leave a Reply