# Effective Sample Size for Weighted Samples

I have an MCMC sampler with weighted samples and I want to compute effective sample size at every step to determine sample degeneracy. I am using the following formula:

$$ESS = \frac{(\sum_{i=1}^N{w_i})^2}{\sum_{i=1}^Nw_i^2}$$

I realized that this metric does not measure effective sample size well when MCMC algorithm works badly.

For instance, suppose that all samples degenerate into one bad sample, i.e. $$x_1 = x_2 = ... = x_N$$. Then, after assigning weights (by likelihood $$p(y|x_i)$$) all samples will have the same weight thus $$ESS$$ is equal to $$N$$ while in fact there is only one sample representing the distribution.

Are there alternative ways to compute $$ESS$$ for MCMC?

• Your ESS definition seems to be the one from Importance Sampling, and not from MCMC. What are the $w$s? – Greenparker Feb 15 at 10:56
• @Greenparker $w_i$s are the weights that are assigned to propagated particles after receiving observation at time $t$, i.e. $p(y_t|x_t)$. – KRL Feb 18 at 2:40