Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: How to include postestimation results (matrix form) in a regression table created by outreg2?

From   Nick Cox <>
To   "''" <>
Subject   RE: st: How to include postestimation results (matrix form) in a regression table created by outreg2?
Date   Thu, 14 Jun 2012 11:35:52 +0100

Glad you solved your problem. 

Pedantic would be my middle name if it were not John already, but it really is best _not_ to think of -outreg- and -outreg2- as different versions of the same program. That's been incorrect for some years now. They are now quite different programs with broadly similar aims but radically different implementation. 


Martin Stürmer

Dear Nick,

thank you for this information, especially with respect to the different
versions of outreg.

I have just found a solution by first extracting the matrix, then transform
it to scalars and finally adding them to the table by addstat:

estat bgodfrey, lags(2)
matrix x=r(p)
scalar x1=x[1,1]
scalar x2=x[1,2]
outreg2 using myfile, tex addstat(B-G-test of serial autocorrelation of
order 1,x1,order 2,x2)
scalar drop _all

Nick Cox

You may get a detailed reply from a user of -outreg2- (SSC, as you are asked
to explain). Otherwise the generic advice about support on
-outreg2- given in (for example)

still stands. In addition, it may help to be aware that -outreg2- has not
been updated since 2010. That in itself certainly does not rule out there
being a solution for your problem. But it does imply that the discussion in
the documentation of -outreg2- of the quite different program -outreg- is
now seriously out-of-date.

-outreg2- (author Roy Wada) was originally made public as an extension of
-outreg- (SJ, SSC; John Gallup) at a time when it appeared that
-outreg- was not being developed further. But since then John has
extensively rewritten -outreg- and is actively maintaining it.
Evidently neither author wishes to change their program's name.


On Thu, Jun 14, 2012 at 8:19 AM, Martin Stürmer
<> wrote:

> sorry for reposting. I would be very grateful, if somebody could help 
> me. I would like to include a matrix of post-estimation results in a 
> table created by outreg2.
> In more detail, I run a regression of the type:
> regress x l.x y l.y
> I than run a Breusch-Godfrey Test of serial correlation of order 1 and 2:
> estat bgodfrey, lags(2)
> I would like to add the two sided p-values of this test to a 
> regression table using outreg2. These values are saved in the 1x2 matrix
> Using
> outreg2 using myfile, tex addstat(BG-test p-value, r(p)) I obtain the 
> error "type mismatch" due to the fact that r(p) is a 1x2 matrix
> How to add this matrix to the regression table?

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index