# Subsample from MCMC sample

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?

• 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. – lacerbi Mar 31 '17 at 15:43