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: RE: rolling correlation help
From
Scott Merryman <[email protected]>
To
[email protected]
Subject
Re: st: RE: rolling correlation help
Date
Wed, 16 Feb 2011 12:51:31 -0600
Another way is to roll your own:
sysuse auto,clear
gen rho = .
forv j = 10/74 {
local i = `j' -9
qui corr price mpg in `i'/`j'
qui replace rho = r(rho) in `j'
}
Scott
On Wed, Feb 16, 2011 at 12:32 PM, Nick Cox <[email protected]> wrote:
> I think you'll need to -merge- it back with the original dataset then.
>
> Nick
> [email protected]
>
> Emma Wetten
>
> I am very new to Stata and am struggling to do a rolling correlation.
> I am not sure how to keep the results along with the data I already
> have.
>
> Using clear, as below, seems to remove my data and replace it with the
> rolling correlation results. I want to keep the resulting
> correlation, but along with the data already in use. Does that make
> sense?
> rolling, window(65) clear: correlate var1 var2
>
*
* 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/