This will take the data you input into the X column of the stats table and it will calculate the autocorrelation for different delays up to the maximum delay (max lag) that you give it.
https://en.wikipedia...Autocorrelation
For example if you type 2,0,0,0,2,0,1,0,2,0,1,5,2,0,1,7,2,0,1,8 into the stats table (the digits of full years and you run the program with max lag 5, you will notice that there is a peak in correlation ("C=") for LAG=4, that's because every 4 digits you start a new number, there is some repeating cycle every four digits that it is detecting.
It is useful for figuring out if a series of errors are random errors because of noise or if the errors are systemic (in this case you'll probably see higher correlation for LAG=1, while for white noise there should be practically no correlation at all for any LAG value).
FreqOff n➔N FreqOn "MAX LAG"?M M>N-3⇒N-3➔M N+M➔DimZ For 1➔I To N List X[I]➔Z[I+M] N-I+1≤M⇒Z[I+M]➔Z[I-N+M] Z[I+M]➔List Y[I] Next -1➔T:-1➔W For 1➔L To M For 1➔I To N Z[I+M-L]➔List X[I] I>L➔List Freq[I] Next LinearReg Cls Locate 1,1,"LAG=" Locate 5,1,L Locate 1,2,"C=" Abs(r)➔R If R>T:Then R➔T:L➔W IfEnd Locate 3,2,R Locate 1,3,"A=" Locate 3,3,a Locate 1,4,"B=" Locate 3,4,b◢ Next Cls Locate 1,1,"BEST LAG=" Locate 10,1,W Locate 3,2,T◢ For 1➔I To N Z[I+M]➔List X[I] 1➔List Freq[I] Next Cls Lbl 1 "DONE."
Edited by Tritonio, 22 October 2019 - 05:01 PM.