[Thread Prev][Thread Next][Index]

[ferret_users] lag correlations: time-lag products for all lags



Hi Ferreters -
 
I want to construct a lag-correlation matrix, ideally without a REPEAT loop (there are thousands of points in my time series).
 
Thus I need to find the time-lagged products, including all lags within a range.
 
Suppose I have a time series of values DATA[L=1:LL], and the lag range is from L-R to L+R.
If I put the lag range on a M axis, _E=1:2*R+1, each element would be the sum of lagged products:
 
LAG[M=1] is the sum of: DATA*DATA (over all L)
 
LAG[M=2] is the sum of: DATA*DATA[L=@shf:1]
 
LAG[M=3] is the sum of: DATA*DATA[L=@shf:2]
 
...
 
LAG[M=2*R+1] is the sum of: DATA*DATA[L=@shf:2*R]   
 
For the moment, let's not worry about the ones that run off the end of the L-axis.
 
Can I do this without a massive REPEAT loop? For instance, is there a way to promote the time series DATA to 2-d where the 2nd dimension is the time-shifted terms as above?
 
Billy K
 
 
 

[Thread Prev][Thread Next][Index]