# What batch size should I use to estimate the multivariate effective sample size (multiESS) if I have virtually no autocorrelation?

I am trying to estimate the multivariate effective sample size of an MCMC posterior sample with 8 parameters. For that, I am using the function multiESS in the R package mcmcse. One of the arguments of this function is batch size, the choice of which significantly influences the estimation of the multivariate ESS.

User @Greenparker gave incredibly helpful answers to previous questions regarding multiESS. Answering a question specifically about the choice of batch size, she suggests the following:

A reasonable thing to do is to look at how many significant [autocorrelation] lags you have. If you have large lags, then choose a larger batch size, and if you have small lags choose a smaller batch size.

I have really small autocorrelation lags. In fact, I have no significant autocorrelation lag at all, possibly because I set a rather high thinning interval of 10,000 samples. Here's how my autocorrelation plot looks like for one parameter (all the others look the same):

Following @Greenparker's advice, I would think setting the batch size to the lowest possible value (batch size = 1) is a good idea. However, in the same post, she also notes that:

If [batch size]=1, then the batch means will be exactly the Markov chain, and your batch means estimator will estimate Λ and not Σ.

So, on the one hand, I understand that I should use a low batch size if I have low autocorrelation lags. On the other, there seems to be disadvantages in using too low a batch size (although it is not clear to me if estimating Λ and not Σ is something that compromises the estimation of multivariate ESS).

My question is: should I set the batch size to 1 when I have no significant autocorrelation at all? If not, what would be a more recommendable value?

• My answer to the linked question is only intuitively right. In principle, a fixed batch size will not yield theoretically appropriate estimates. The mcmcse R package has a batchSize() function that recommends a batchSize for the mulviariate batch means estimator. That is also the default in the multiESS() function in the package. Jun 19, 2020 at 7:25
• Thank you for the answer! I noticed that the default batch size in multiESS() is the output of batchSize(). However, batchSize() returns a value of 0, causing the following error in multiESS(): Error in mcse.multi(chain, ...) : Either decrease r or increase n. I assume this is because n is below 1? Jun 19, 2020 at 14:25
• I am taking a look at the function batchSize() to see what might be going on. It imputes a value of 1 to b whenever b == 0, and then rounds down b. In the case of my chain, b is calculated as 0.23. It is not transformed into 1 (since b != 0) and then rounded down to 0. If the intention is to bound b to be above or equal to 1, this would work better if the imputation occurred whenever b < 1. Or, alternatively, if the imputation came after the rounding. Could that be the case? Jun 19, 2020 at 15:11
• That's an unfortunate error in the code, and thanks for pointing it out! In this case this implies that you're samples are essentially iid, which would mean that your multiESS == your sample size n. In other words, batchSize() should've just returned 1. Jun 20, 2020 at 1:11
• The mcmcse GitHub repo has it fixed now. I'll push it on to CRAN in the near future: github.com/dvats/mcmcse Jun 20, 2020 at 10:42

Ideally, I should use the function batchSize in package mcmcse to estimate the optimal batch size. That's the default option in multiESS. In my specific case, the optimal batch size happens to be 1, as originally asked.
(Beware that there is an error in function batchSize as available from CRAN (v1.4.1). This error allows the optimal batch size to be lower than 1, which shouldn't happen. The GitHub repo has it fixed: github.com/dvats/mcmcse)