bayesvalidrox.bayes_inference.mcmc.gelman_rubin

bayesvalidrox.bayes_inference.mcmc.gelman_rubin(chain, return_var=False)

The potential scale reduction factor (PSRF) defined by the variance within one chain, W, with the variance between chains B. Both variances are combined in a weighted sum to obtain an estimate of the variance of a parameter ( theta ).The square root of the ratio of this estimates variance to the within chain variance is called the potential scale reduction. For a well converged chain it should approach 1. Values greater than 1.1 typically indicate that the chains have not yet fully converged.

Source: http://joergdietrich.github.io/emcee-convergence.html

https://github.com/jwalton3141/jwalton3141.github.io/blob/master/assets/posts/ESS/rwmh.py

Parameters

chainarray (n_walkers, n_steps, n_params)

The emcee ensamples.

Returns

R_hatfloat

The Gelman-Robin values.