# (Integrated) autocorrelation time

#1

I could not find any (integrated) autocorrelation time estimator in the basic statistics packages*, so I made a crude implementation myself based on `StatsBase.autocor` and the tips given in http://www.stat.unc.edu/faculty/cji/Sokal.pdf. At the moment my implementation is just part of another package (under construction), but I realized that calculating autocorrelation times is of more general importance, so this functionality should maybe be moved somewhere else… (like to `StatsBase`?)

Of course, a more rigorous and less heuristic implementation/algorithm would be advantageous, if anyone is aware of that…

*Except apparently somewhere in this package, which seems to have been abandoned.

#2

Very nice @Sleort, thanks for putting a package together and for adopting the `evaluate` interface we discussed in another thread

I would like to share with you something that has great overlap, which is the concept of variograms. A variogram is basically a constant (the sill) minus the autocorrelation, but it is more general in the sense that we can still use them to create models that aren’t necessarily stationary. There is also an efficient procedure to calculate variograms in more than one dimension, not only time series. I have implementations of variograms in GeoStats.jl, this Jupyter notebook illustrates more or less the modeling: http://nbviewer.jupyter.org/github/juliohm/GeoStats.jl/blob/master/examples/VariogramModeling.ipynb

Feel free to play with them, compare results, and suggest improvements. Good to have more people involved with autocorrelation-related work.

#3

I have a (relatively well tested) effective sample size implementation in

#4

@juliohm You’re welcome. And thank you for useful feedback/opinions

The concept of variograms is new to me. I’m not sure it will be of use for me at the moment though, but I’ll keep it in mind!

@Tamas_Papp Great! That’s basically what I need! … but you haven’t registered it as a package (as far as I can see). Is there a reason for this? Is the intention that one should manually copy the file to ones own package?

#5

You can just `Pkg.clone` it. I added a note to the README.

It is not registered because I am still working on the API of my MCMC toolkit. In particular, see the documentation of DynamicHMC.jl which now has an example of how to use them together.

If you find it useful, open an issue and I will register it.

#6

I think it would be useful to register `MCMCDiagnostics.jl`, as its content is quite general and important for any MCMC simulation (and beyond?)…

Also, it has to be registered in order for other packages to depend on it (added to REQUIRE)… (At least until `Pkg3.jl` is out, if my understanding is correct.)

I’ll open an issue…

#7

@Sleort I want to clarity it further, and repeat that variogram and autocorrelation are basically the same thing (one is minus the other). You can compute variogram with time series exactly as you do with autocorrelation.

The main difference from a modeling perspective is that we have variograms for which there is no covariance, correlation, correlogram… counterpart. Other than that, they can be seen as equivalent.