Question: Offset Correlation

Is there a name for offset correlated data? 

For example

a:=[1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2]:
b:=[5,6,7,8,9,8,7,6,5,4,3,2,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,2,3,4]:

Correlation(a,b)
                            0

However there exists a correlation of -1.000 only 4 data points away, a correlation lag exists.  In cases like this does one always need to massage the data to wean out correlation?  Is there a command to find a relation between the data?

In this case we could set up a procedure to find the maximum correlation (excuse the preliminary inefficiency or any errors of spur of the moment code)

Correlationlag := proc (data1, data2, checktodepth)
local c,i:
c := table():
for i to checktodepth do
  c[i] := abs(Correlation(a[i..],b[..-i]):
end do:
max(convert(c, list))
end proc:

Correlationlag(a,b,6)
                                     1.0

 

Please Wait...