I got a MCMC sample $S = \{x_1, \dots, x_n\}$ from the posterior distribution $p$ and I want to estimate $\int f(x)p(dx)$. The obvious choise of estimator is $\frac{1}{n}\sum_{i} f(x_i)$ but every evaluation $f(x_i)$ does heavy computations so I want to extract a subset $S'\subset S$ such that $$\frac{1}{|S'|} \sum_{x\in S'}f(x) \approx \frac{1}{|S|} \sum_{x\in S}f(x).$$ There is general rule of how to choose $S'$. Is there a relation between this and the effective sample size?

  • 1
    $\begingroup$ You could thin your sequence (take a sample every $\sim k$) and compute the effective sample size (ESS) of the thinned sequence. Plot ESS as a function of $k$ and then pick something you are happy with. $\endgroup$ – lacerbi Mar 31 '17 at 15:43

Of course it doesn't make sense to have n >> effective sample size, but the other consideration is that you only need your n large enough to have sufficient certainty about the posterior predictive statistics you are interested in.

In my experience, for unproblematic posterior predictive statistics (mean, sd, as in your case), n = 1000 is a common choice. So just sample 1000 values equidistantly from the posterior, and calculate the posterior predictive statistics that you want.

However, if you are interested in the tail of the posterior predictive distribution, e.g. for extreme values, you may want to set n much higher.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.