bebi103.hmc.tail_xi_hat

bebi103.hmc.tail_xi_hat(samples, xi_hat_threshold=0.25, omit=(), omit_array_entry=())

Compute the empirical generalized Pareto shape (xi_hat) for the upper and lower tails of a sample of expectand values, ignoring any autocorrelation between the values.

Parameters:
  • samples (cmdstanpy.CmdStanMCMC instance or dict) – MCMC samples from which to compute ESShat, 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.

  • xi_hat_threshold (float, default 0.25) – Quantile fraction passed through to _compute_xi_hat() for each tail.

  • 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 value in the dictionary is the shape estimate for lower and upper tail for each expandand for each chain for each chain for each expectand. Each value is a Numpy array of shape (n_chains, 2), where the first index indexes the chain and the second index gives the shape index of the lower and upper tail.

Return type:

dict

Notes