quivers.diagnostics.comparison¶
Pointwise PSIS-LOO and model comparison via ArviZ.
comparison
¶
Model comparison and PSIS-LOO via ArviZ.
Thin wrappers around the canonical ArviZ entry points with quivers-typed inputs. No information-criterion or PSIS math lives here; ArviZ is the source of truth.
compare
¶
compare(fits: Mapping[str, DataTree], *, method: Literal['stacking', 'BB-pseudo-BMA', 'pseudo-BMA'] = 'stacking', var_name: str | None = None, reference: str | None = None, round_to: int | Literal['auto', 'none', 'None'] | None = 'auto') -> object
Rank candidate models by expected log predictive density.
Delegates to ArviZ, which computes PSIS-LOO on each fit's log-likelihood group and combines the results into a ranked comparison table.
| PARAMETER | DESCRIPTION |
|---|---|
fits
|
Per-model fits produced by quivers.diagnostics.to_datatree. Every fit must carry a log-likelihood group.
TYPE:
|
method
|
Model-weight estimator. Default "stacking" follows Yao, Vehtari, Simpson, and Gelman (2018).
TYPE:
|
var_name
|
Observed variable in the log-likelihood group; required when a fit carries multiple log-likelihood variables.
TYPE:
|
reference
|
Fit name used as the reference for ELPD differences. Default is the top-ranked model.
TYPE:
|
round_to
|
ArviZ rounding policy. Default "auto" retains display rounding. An integer specifies decimal places, while "none" or "None" preserves full numeric precision. None uses ArviZ's configured default.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
ArviZ ranking table with one row per model. |
Source code in src/quivers/diagnostics/comparison.py
loo
¶
Estimate expected log predictive density with PSIS-LOO.
This thin wrapper delegates all computation to ArviZ. It preserves ArviZ's canonical log scale and, with pointwise=True, returns its per-observation elpd_i and pareto_k arrays unchanged, including nonfinite Pareto estimates.
| PARAMETER | DESCRIPTION |
|---|---|
fit
|
Fit containing posterior and log-likelihood groups.
TYPE:
|
pointwise
|
Whether to include one elpd_i and pareto_k value per observation. None uses ArviZ's configured default.
TYPE:
|
var_name
|
Log-likelihood variable to evaluate. Required when the log-likelihood group contains multiple variables.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ELPDData
|
ArviZ's canonical PSIS-LOO result. |