bebi103.stan.check_all_diagnostics

bebi103.stan.check_all_diagnostics(samples, parameters=None, e_bfmi_rule_of_thumb=0.3, total_ess_rule_of_thumb=100, fractional_ess_rule_of_thumb=0.001, rhat_rule_of_thumb=1.01, omit=(), max_treedepth=10, quiet=False, return_diagnostics=False)

Checks all MCMC diagnostics

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 in checking Rhat and ESS. If None, use all parameters. For multidimensional parameters, each entry must be given separately, e.g., [‘alpha[0]’, ‘alpha[1]’, ‘beta[0,1]’].

  • e_bfmi_rule_of_thumb (float, default 0.3) – Rule of thumb value for E-BFMI. If below this value, there may be cause for concern.

  • total_ess_rule_of_thumb (int, default 100) – Rule of thumb for number of effective samples per chain. The default of 100 is based on the suggestion of Vehtari, et al., to have 50 effective samples per split chain.

  • fractional_ess_rule_of_thumb (float, default 0.001) – Rule of thumb value for fractional number of effective samples. The default of 0.001 is based on CmdStan’s defaults.

  • rhat_rule_of_thumb (float, default 1.1) – Rule of thumb value for maximum allowed R-hat.

  • 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.

  • max_treedepth (int, default 'infer') – If int, specification of maximum treedepth allowed. If ‘infer’, inferred from fit.

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

  • return_diagnostics (bool, default False) – If True, return a dictionary containing the results of each test.

Returns

  • warning_code (int) – When converted to binary, each digit in the code stands for whether or not a test passed. A digit of zero indicates the test passed. The ordering of the tests goes:

    • ess

    • r_hat

    • divergences

    • tree depth

    • E-BFMI

    For example, a warning code of 12 has a binary representation of 01100, which means that R-hat and divergences tests failed.

  • return_dict (dict) – Returned if return_dict is True. A dictionary with the result of each diagnostic test.