arviz.rhat¶

arviz.
rhat
(data, *, var_names=None, method='rank')[source]¶ Compute estimate of rank normalized splitRhat for a set of traces.
The rank normalized Rhat diagnostic tests for lack of convergence by comparing the variance between multiple chains to the variance within each chain. If convergence has been achieved, the betweenchain and withinchain variances should be identical. To be most effective in detecting evidence for nonconvergence, each chain should have been initialized to starting values that are dispersed relative to the target distribution.
 Parameters
 dataobj
Any object that can be converted to an az.InferenceData object. Refer to documentation of az.convert_to_dataset for details. At least 2 posterior chains are needed to compute this diagnostic of one or more stochastic parameters. For ndarray: shape = (chain, draw). For ndimensional ndarray transform first to dataset with az.convert_to_dataset.
 var_nameslist
Names of variables to include in the rhat report
 methodstr
Select Rhat method. Valid methods are  “rank” # recommended by Vehtari et al. (2019)  “split”  “folded”  “z_scale”  “identity”
 Returns
 xarray.Dataset
Returns dataset of the potential scale reduction factors, \(\hat{R}\)
Notes
The diagnostic is computed by:
\[\hat{R} = \frac{\hat{V}}{W}\]where \(W\) is the withinchain variance and \(\hat{V}\) is the posterior variance estimate for the pooled ranktraces. This is the potential scale reduction factor, which converges to unity when each of the traces is a sample from the target posterior. Values greater than one indicate that one or more chains have not yet converged.
Rank values are calculated over all the chains with scipy.stats.rankdata. Each chain is split in two and normalized with the ztransform following Vehtari et al. (2019).
References
Vehtari et al. (2019) see https://arxiv.org/abs/1903.08008 Gelman et al. BDA (2014) Brooks and Gelman (1998) Gelman and Rubin (1992)