interpret.predictions()

Compute conditional adjusted predictions.

Usage

Source

interpret.predictions(
    model,
    idata,
    conditional=None,
    average_by=None,
    target="mean",
    use_hdi=True,
    prob=az.rcParams["stats.ci_prob"],
    transforms=None,
    sample_new_groups=None,
)

Parameters

model: Model

The fitted Bambi model.

idata: DataTree

DataTree object containing the posterior samples.

conditional: str, list[str], dict[str, ConditionalValues], or None = None

Variables to condition on for predictions.

average_by: (str, list or None) = None

Variables to average predictions over.

target: str = "mean"

Which quantity to extract. "mean" (default) for the posterior of the parent parameter (e.g. "mu"). Pass the response variable name (e.g. "mpg") for posterior predictive samples. Pass a distributional component name (e.g. "sigma") for the posterior of that component.

use_hdi: bool = True

Whether to use highest density interval. Default is True.

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

Probability or list of probabilities for credible intervals. Default is from arviz rcParams. When a list is provided, multiple nested intervals are computed. Pass None to omit credible intervals.

transforms: dict or None = None

Dictionary of transformations to apply to predictions.

sample_new_groups: bool or None = None
Deprecated and has no effect. Bambi automatically determines how to predict for new groups based on the type of group. Default is None.

Returns

Result
A named tuple with .summary (DataFrame of summary statistics) and .draws (DataTree of raw posterior draws).

Raises

ValueError
If any prob value is not between 0 and 1.