# Effective sample size [duplicate]

If I want to estimate $E_P(f (x))$ where f is some function, I can produce samples $\left\lbrace x^{1} , \dotsc , x^{L}\right\rbrace$ from the Markov chain (with a stationary distribution matching $P$ ) and have the following estimator:

$$E_{MCMC} (f (x)) = \frac{1}{L} \sum_{l=1}^{L} f \left(x^{l} \right).$$

The samples produced by MCMC are non-i.i.d.. It is common to analyze the effective sample size (ESS) of an MCMC sampler, i.e.,

How should I find the ratio of the sample of size $S$ produced by MCMC to its effective size (the ratio between number of samples produced by the chain to the number of perfect i.i.d. samples both of result into estimators that have same variance)?