# Re: st: Can we collect the R^2 (R-squared) of a OLS regressionwith statsby?

 From Justin Smith To statalist@hsphsun2.harvard.edu Subject Re: st: Can we collect the R^2 (R-squared) of a OLS regressionwith statsby? Date Sun, 06 Aug 2006 12:30:04 -0400

```Try this...

statsby _b _se r2 = e(r2_a), by (x1) saving(my_rg): regress x2 x3 x4

where e(r2_a) is the saved r2 from the regression.  You could also do
this with the many other saved results.

Justin Smith

On Sun, 6 Aug 2006 23:59:16 +0800
?? <rereach@sohu.com> wrote:
JS>Hi,
JS>
JS>I use stata 9 intercool to regress a panel data. And I can collect
JS>the
JS>coefficients and standard errors for every regression like this:
JS>    statsby _b _se, by (x1) saving(my_rg): regress x2 x3 x4
JS>
JS>But how can I collect the R^2 (R-squared) with statsby? And the
JS>R-squared"?
JS>
JS>Thanks a lot.
JS>
JS>Alex
JS>
JS>
JS>
JS>*
JS>*   For searches and help try:
JS>*   http://www.stata.com/support/faqs/res/findit.html
JS>*   http://www.stata.com/support/statalist/faq
JS>*   http://www.ats.ucla.edu/stat/stata/

Justin Smith
PhD Candidate
Department of Economics
McMaster University
Phone: (905) 962-0353
E-mail: smithjd5@mcmaster.ca
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```