arviz-stats is a Python package that provides statistical functions and diagnostics for the exploratory analysis of Bayesian models. It is a subpackage of the broader ArviZ library (along with arviz-base and arviz-plots) and focuses specifically on computational and numerical features like statistical summaries, diagnostics, and model comparison. The current version is 1.0.0, released on March 2, 2026. The ArviZ ecosystem, including arviz-stats, has a regular release cadence with several releases in the past year.
pip install "arviz-stats[xarray]"Verified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to load an example Bayesian model's inference data using `arviz-base` and then apply `arviz-stats` functions like `summary` for posterior diagnostics and `mode` for statistical computation. For full functionality, especially with InferenceData, the `xarray` optional dependency is recommended.
To explicitly get an `xarray.Dataset` from a DataTree group, use `dt["group"].dataset` for a view or `dt["group"].to_dataset()` for a mutable copy.
Update your code to explicitly set `ci_prob` (e.g., `az.rcParams['stats.ci_prob'] = 0.94`) and `ci_kind` if you rely on the previous defaults.
For most end-user workflows, install with `xarray` dependencies: `pip install "arviz-stats[xarray]"`.
Set `rounding=None` to return raw numbers for programmatic use, or provide an integer for specific decimal places.
If you need `Dataset` specific functionality, explicitly convert or access the dataset view: `my_datatree_group.to_dataset()` or `my_datatree_group.dataset`.
Ensure that the `log_likelihood` group variables have well-defined and consistent dimension names (e.g., `chain`, `draw`, `obs_id`) and shapes that align with the `InferenceData` schema. Review how `log_likelihood` is created during inference.
Inspect your model's sampling diagnostics (`rhat`, `ess`). Consider re-parameterizing the model, increasing `target_accept` in your PPL's sampler, or filtering out divergent transitions. Ensure your input data to `arviz-stats` functions is clean and doesn't contain unexpected `NaN`s.
Uninstall the minimal `arviz-stats` and reinstall it with the recommended `xarray` optional dependency: `pip uninstall arviz-stats && pip install "arviz-stats[xarray]"`.