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" <[email protected]>
To   <[email protected]>
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 
[email protected] 

[email protected]
 
> 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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index