Jump to content



Photo
- - - - -

Autocorrelation [fx-5800P]

fx-5800P

  • Please log in to reply
2 replies to this topic

#1 Tritonio

Tritonio

    Casio Addict

  • Members
  • PipPipPip
  • 53 posts
  • Gender:Male

  • Calculators:
    FX-5800P, FX-991ES+, FX-991EX, HP Prime

Posted 22 October 2019 - 04:56 PM

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.


#2 kobyeongmin

kobyeongmin

    Newbie

  • Members
  • Pip
  • 2 posts

  • Calculators:
    Casio FX-5800P, Casio FX-350 ES

Posted 30 November 2019 - 12:08 PM

Thanks! FX-5800P could have included more stat-related functions...



#3 Tritonio

Tritonio

    Casio Addict

  • Members
  • PipPipPip
  • 53 posts
  • Gender:Male

  • Calculators:
    FX-5800P, FX-991ES+, FX-991EX, HP Prime

Posted 01 December 2019 - 02:32 PM

It sure could have but it's programmable so you can add a lot of what it is missing. :-)

 

One thing it is missing which is bothering me is that you cannot delete a row from the stats table. You can set the Freq to zero to simulate the row missing but if you really want to delete it, you need to copy the stats table to Z[] omitting anything you want to delete and then copy it back from Z[] to the stats table.

 

(In the code above, the I>LList Freq[I] line actually sets the frequency for some elements to zero)







Also tagged with one or more of these keywords: fx-5800P

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users