Am 17.01.2017 um 08:06 schrieb Riccardo (Jack) Lucchetti:
On Mon, 16 Jan 2017, Tomas Nilsson wrote:
> Is there an option to compute the rolling correlation between multiple
> time series? I'm seeing some mentioning on this topic in 2016 between
> Fernando and Sven but not sure what happened to it. Thanks
I re-checked, and I think what happened is that Fernando found a
solution for himself ;-)
you mean, given n series, return n*(n+1) series of covariances
computed
on a fixed observation window?
If so, try this:
Jack, sorry, but your code must look just horrible for regular gretl
users. Why wouldn't a simple loop be enough?
(untested:)
<hansl>
list X = mylist # define variable list here
N = 10 # set how many subsamples here
loop N
corr(X) # prints out the correlation matrix
smpl +1 +1 # moves the subsample forward by one
endloop
</hansl>
If you want to capture the numbers for further use, you can do that with
an array of matrices:
(untested)
<hansl>
matrices MC = array(N)
loop i = 1..N
matrix MC[i] = mcorr( {X} )
smpl +1 +1
endloop
</hansl>
HTH,
sven