I've been looking for fortran code for computing the autocorrelation function like R's acf function. The code I have found so far uses some parameter called the dimension of correlation. I am used to seeing autocorrelation in terms of lag. What is the relationship between the dimension and the lag? Or am I mixing up two different types/concepts of autocorrelation?

UPDATE So it does just look like an issue of semantics---at least, for this implementation. I got thrown off by this implementation, which seems to be doing something entirely different.

  • $\begingroup$ Programmers can call their variables anything they like, subject to the lexical requirements of the language. $\endgroup$
    – whuber
    Nov 5, 2016 at 21:48
  • $\begingroup$ Thanks @whuber---so you suspect it's just semantics? Have you seen the term "dimension" used to refer to lag? $\endgroup$
    – mikeck
    Nov 6, 2016 at 1:47
  • $\begingroup$ Experience has taught me to infer little from the names programmers give to their variables. Sometimes they can be misleading. Using "dimension" for lag would be strange--and it would be awful in a Fortran program, too, because of the special role of that word in the language. Fortunately, I don't see anything in either of your links that calls any variable "dimension". I really can't tell what you might be referring to by this word. $\endgroup$
    – whuber
    Nov 6, 2016 at 15:38
  • $\begingroup$ @whuber, in the first link the author describes the variable M as the "dimension" in the post text. In the second link, my exploration of the context for the variable nmolecules (which I assumed was a shortcut to allow autocorrelation for multiple variables, rather than having to call the function multiple times) which led me to discussions of autocorrelation between molecular spins and the term correlation dimension was used. I still don't understand what the code in the second link is doing, but the first link matches results in R. $\endgroup$
    – mikeck
    Nov 6, 2016 at 19:11
  • $\begingroup$ The second link appears to compute the autocorrelation function, or "acf." $\endgroup$
    – whuber
    Nov 6, 2016 at 20:36


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.