### n_eff (ESS)

Quick definition \(n_{eff}\) is an estimate of the effective number of independent draws from the posterior distribution of the estimand of interest. Because the draws within a chain are not independent if there is autocorrelation, the effective sample size will be smaller than the total number of iterations.

#### More deftails

Samples in a Markov chain are only drawn with the marginal distribution \(p(\theta | y,x)\) after the chain has converged to its equilibrium distribution. There are several methods to test whether an MCMC method has failed to converge; unfortunately, passing the tests does not guarantee convergence. The recommended method for Stan is to run multiple Markov chains, initialized randomly with a diffuse set of initial parameter values, discard the warmup/adaptation samples, then split the remainder of each chain in half and compute the potential scale reduction statistic \(\hat{R}\).
If the result is not enough effective samples, double the number of iterations and start again, including rerunning warmup and everything. Often a lack of effective samples is a result of not enough warmup iterations. At most this rerunning strategy will consume about 50% more cycles than guessing the correct number of iterations at the outset.
The estimation of effective sample size is described in detail in the 'Markov Chain Monte Carlo Sampling' chapter of the Stan Modeling Language User's Guide and Reference Manual.