bebi103.stan.check_rhat

bebi103.stan.check_rhat(samples, parameters=None, rhat_rule_of_thumb=1.01, omit=(), quiet=False, return_diagnostics=False)

Checks the potential issues with scale reduction factors. Rhat is computed with rank-normalization and folding.

Parameters
  • samples (ArviZ InferenceData instance) – Contains samples to be checked. Must contain both posterior and sample_stats.

  • parameters (list of str, or None (default)) – Names of parameters to use. If None, use all parameters. For multidimensional parameters, each entry must be given separately, e.g., [‘alpha[0]’, ‘alpha[1]’, ‘beta[0,1]’].

  • quiet (bool, default False) – If True, do no print diagnostic result to the screen.

  • rhat_rule_of_thumb (float, default 1.01) – Rule of thumb value for maximum allowed R-hat, as per Vehtari, et al.

  • omit (str, re.Pattern, or list or tuple of str and re.Pattern) – If parameters is not provided, all sampled parameters are checked for Rhat. We often want to ignore samples of variables that a transformed parameters, as their Rhats are irrelevant and often NaNs. For each string entry in omit, the variable given by the string is omitted. For each entry that is a compiled regular expression patters (re.Pattern), any variable name matching the pattern is omitted. By default, no variables are omitted.

  • return_diagnostics (bool, default False) – If True, return both a Boolean about whether the diagnostic passed and a data frame containing results about the number of effective samples tests. Otherwise, only return Boolean if the test passed.

Returns

  • passed (bool) – Return True if test passed. Return False otherwise.

  • rhat_diagnostics (DataFrame) – Data frame with information about problematic R-hat values.

References

Vehtari, et al., 2019, https://arxiv.org/abs/1903.08008.