Computing effective sample size in R

Hi all,

is there a method, perhaps in RStan, to compute the effective sample size for a Markov chain (or 4 Markov chains)? The chains are not produced by Stan.

I’m aware of Stan’s C++ code. I could run it directly, or perhaps with RCpp, though a direct solution in R would be easier. There are R packages that compute n_\mathrm{eff} but I’m not convinced they use the right method, especially because I have anti-correlation in my chain.

Call the monitor function on an array that is draws x chains x parameters.

1 Like

See also https://github.com/jgabry/posterior (no need to install RStan if the chains are not produced by Stan). I can guarantee that that package uses the right method.

6 Likes