Hi Skip,

This is not an elegant version but should do the job. 

mean=: +/%#

acor=: 3 : 0
:
(+/(((-y)}.x)-mean x)*(y}.x)-mean x)%+/*:(x-mean x)
)

Here is an example data set and output of the first 10 autocorrelations:

http://www.itl.nist.gov/div898/handbook/eda/section4/eda4251.htm
http://www.itl.nist.gov/div898/handbook/eda/section3/eda35c.htm

$lev=.,0".'m' freads 'h:/data/j/lev.dat'
200
   lev acor "(_ 0) i.10
1 _0.307305 _0.74035 0.774689 0.205155 _0.898156 0.376064 0.632847 _0.769256 
_0.124871

Best Regards,

Esa   
-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Skip Cave
Sent: 29. heinäkuuta 2013 1:34
To: [email protected]
Subject: [Jprogramming] Autocorrelation

Looking over the J Software site, I can't seem to find any discussions or
code on autocorrelation. I see a correlation function in statfns.ijs, but
no autocorrelation, where the data is correlated with itself using a
sliding window. I want to make autocorrelation plots on certain integer
data files, and I don't want to re-invent the wheel, if possible.

Skip
-- 
Skip Cave
Cave Consulting LLC
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to