bebi103.hmc.check_variance
- bebi103.hmc.check_variance(samples, epsilon=1e-10, omit=(), omit_array_entry=())
Compute the variance of each variable for each chain and report True if the variance if nonzero and False if the variance is zero.
- Parameters:
samples (cmdstanpy.CmdStanMCMC instance or dict) – MCMC samples from which to compute split Rhat, either as a cmdstanpy.CmdStanMCMC instance or as a dictionary of two-dimensional arrays for each expectand. For the dictionary, the first dimension of each element indexes the Markov chains and the second dimension indexes the sequential states within each Markov chain.
epsilon (float, default 1e-10) – Small number, below which a variance is considered to be zero.
omit (str, re.Pattern, or iterable thereof) – Glob pattern(s) matched against the base (non-indexed) name of each variable. Any variable whose base name matches an entry is omitted, whether scalar or array valued. For example, omit=’*_pred’ omits every variable whose name ends in ‘_pred’. Compiled re.Pattern entries are matched as regular expressions. A single string or pattern may be given instead of an iterable.
omit_array_entry (str or iterable of str) – Specific array entries to omit, e.g. ‘y_pred[1]’ or ‘beta[1,2]’. Each entry must include bracketed, comma-separated integer indices. A single string may be given instead of an iterable.
- Returns:
output – Each key is the name of a variable and each value is a Numpy array whose length is equal to the number of chains in the sampling. Entry i is True if the variance is nonzero and False otherwise.
- Return type:
dict