# Number of iterations

**URL:** <https://discourse.mc-stan.org/t/number-of-iterations/1674>\
**Category:** General\
**Created:** [August 24, 2017, 5:35pm UTC](https://discourse.mc-stan.org/t/number-of-iterations/1674 "2017-08-24T17:35:32Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![betanalpha](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/betanalpha/32/4_2.png) [@betanalpha](https://discourse.mc-stan.org/u/betanalpha)\
**Post date:** [March 24, 2019, 6:42pm UTC](https://discourse.mc-stan.org/t/number-of-iterations/1674/13 "2019-03-24T18:42:42Z")

</div>

If your Markov chain behaves well enough then effective sample size controls the error of your MCMC estimators, such as the mean (see [https://betanalpha.github.io/assets/case\_studies/rstan\_workflow.html](https://betanalpha.github.io/assets/case_studies/rstan_workflow.html) for more details). So you want to generate enough effective sample to be sufficient for _your_ application. In general there is no unique answer.

For example, if I all I want to do is crudely locate the mean within the marginal posterior distribution then error[f] ~ sqrt{ Var[f] } / 3 should be sufficient and that implies

\sqrt{ Var[f] / ESS[f] } = error[f] ~ sqrt{ Var[f] } / 3  
3 ~ sqrt{ ESS[f] }  
10 ~ ESS[f]

Typically 100 effective samples allows for a more precise evaluation of the posterior properties.

Just keep in mind that all of this holds only if you have a central limit theorem, which means also checking for divergences, Rhats, and the like.

---

_[View the full topic](https://discourse.mc-stan.org/t/number-of-iterations/1674)._
