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

# Re: st: Query

 From John Luke Gallup To statalist@hsphsun2.harvard.edu Subject Re: st: Query Date Wed, 18 Apr 2012 16:24:19 -0700

```Mark,

You cannot use -outreg-, -outreg2-, or -estout- to format the statistics from -corrgram- directly, because it is not an estimation command.  In particular, it does not save results in the e(b) matrix.  Instead it saves results in r() matrices.

You can create a formatted table of -corrgram- statistics with the following commands using the program -frmttable-, which is the backend of -outreg-.  It takes a Stata matrix and creates a formatted table in Word or TeX.

webuse air2, clear
corrgram air, lags(20)
mat lags = J(r(lags),1,0)
mat probQ = lags
mat Q = r(Q)'

forvalues r=1/`r(lags)' {
mat lags[`r',1] = `r'
mat probQ[`r',1] = chi2tail(`r',Q[`r',1])
}
mat stat = lags,r(AC)',r(PAC)',Q,probQ
frmttable using corrgram.doc, statmat(stat) ctitle("Lag","AC","PAC","Q","Prob>Q") ///
sdec(0,4) replace

The reason for the matrix commands above is to calculate the "Prob>Q" p-values which are not saved in r() values after the -corrgram- command.

John

On Apr 17, 2012, at 12:46 PM, Mark Bailie wrote:

> How can I outreg2 the statistics from a corrgram?
>
> KR,
>
> Mark
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```

• Follow-Ups:
• References:
• st: Query
• From: Mark Bailie <mbailie05@qub.ac.uk>