interpret.plot_comparisons

interpret.plot_comparisons(
    model,
    idata,
    contrast,
    conditional=None,
    average_by=None,
    target='mean',
    pps=False,
    comparison='diff',
    use_hdi=True,
    prob=az.rcParams['stats.ci_prob'],
    transforms=None,
    sample_new_groups=False,
    fig_kwargs=None,
    subplot_kwargs=None,
)

Plot conditional adjusted comparisons.

Parameters

model : Model

The fitted Bambi model.

idata : InferenceData

InferenceData object containing the posterior samples.

contrast : contrastParam

Variable(s) to create contrasts for.

conditional : ConditionalParam = None

Variables to condition on for comparisons.

average_by : str or list or bool or None = None

Variables to average comparisons over.

target : str = 'mean'

The target parameter to compare. Default is “mean”.

pps : bool = False

Whether to use posterior predictive samples. Default is False.

comparison : ComparisonFunc or str = 'diff'

Comparison function or string name. Built-in options: “diff” (difference), “ratio” (ratio), “lift” (relative difference). Default is “diff”. Custom functions should accept (reference, contrast) DataArrays and return a DataArray.

use_hdi : bool = True

Whether to use highest density interval. Default is True.

prob : float or list[float] = az.rcParams['stats.ci_prob']

Probability or list of probabilities for credible intervals. Default is from arviz rcParams. When a list is provided, nested bands with decreasing opacity are drawn.

transforms : dict or None = None

Dictionary of transformations to apply to comparisons.

sample_new_groups : bool = False

Whether to sample new group levels. Default is False.

fig_kwargs : dict or None = None

Additional keyword arguments for figure customization. Use the ‘theme’ key to pass a dictionary of matplotlib rc parameters.

subplot_kwargs : Mapping[str, str] or None = None

Overrides default plotting sequence (main, group, panel).

Returns

: Plot

A Seaborn objects Plot. In Jupyter notebooks, the plot automatically displays. In scripts, call .show() to display. The returned Plot object can be customized before displaying using method chaining (e.g., .label(), .theme()).

Raises

ValueError

If more than 3 conditional variables are provided without averaging.