Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Looping Regression with Estimates Extraction
From
Austin Nichols <[email protected]>
To
[email protected]
Subject
Re: st: Looping Regression with Estimates Extraction
Date
Wed, 25 Apr 2012 10:10:41 -0400
Rohit <[email protected]>:
Something like this?
sysuse sp500, clear
gen double r2=.
gen double rmse=.
qui forv i=15076/15340 {
reg high volume if inrange(date,`i'-99,`i')
replace r2=e(r2) if date==`i'
replace rmse=e(rmse) if date==`i'
}
On Wed, Apr 25, 2012 at 6:44 AM, <[email protected]> wrote:
> Hello StataList,
>
> I am unfamiliar with programming in Stata, hence the need for assistance. I have a long panel dataset of daily prices of different companies from 1990 to 2010. I am trying to understand how I can run a regression of the daily stock return (y) on, say, stock index return (x) on a daily basis using only the last 1000 observations or so? I would like to loop this regression daily, while also able to extract, to a column in the data file, some estimates like the R-squared, Root MSE, etc.
>
> Any help on this would be greatly appreciated.
>
> Thanks!
> Rohit
*
* 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/