Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Re: how to create "R2" as a variable


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Re: how to create "R2" as a variable
Date   Wed, 16 Nov 2005 02:06:50 -0000

Look at -statsby-. Alternatively, 

gen rsq = . 

egen group = group(firm) 
su group, meanonly 

qui forval i = 1/`r(max)' { 
	regress <whatever> if group == `i' 
	replace rsq = e(r2) if group == `i' 
} 

Nick 
n.j.cox@durham.ac.uk 

mindy.nitkin@simmons.edu
 
> I am trying to construct an earnings quality metric based on 
> the R2 from firm
> specific regressions of returns on accounting values. I know 
> how to run the
> firm specific regressions. I am wondering if it possible to 
> create a variable

*
*   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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index