interpret.InterpretResult
Unit-preserving posterior draws for predictions, contrasts, or slopes.
Usage
interpret.InterpretResult(
*,
ds,
outcome,
quantity,
variable=None,
estimator="structural",
causal=False,
interventional=False,
identifiable=None
)Internal storage is an xarray.Dataset with dims ("chain", "draw", "unit") exposed as dataset.
Parameters
ds: xr.Dataset-
Labelled draws for the outcome variable.
outcome: str-
Outcome variable name.
quantity: str-
"prediction","comparison", or"slope". variable: str or None = None-
Varied variable name, if any.
estimator: str = "structural"-
Estimator backend label.
causal: bool = False-
Whether the result supports a causal interpretation.
interventional: bool = False-
Whether graph surgery / do() was used.
identifiable: bool or None = None- Backdoor identifiability when a treatment/outcome pair is defined.
Attributes
| Name | Description |
|---|---|
| causal | Whether the result supports a causal interpretation. |
| dataset |
Labeled draws as an xarray.Dataset.
|
| estimator | Estimator backend that produced this result. |
| identifiable | Backdoor identifiability of the treatment-outcome pair, if defined. |
| interventional | Whether graph surgery / do() was used. |
| outcome | The outcome variable this result targets. |
| quantity |
Query kind: prediction, comparison, or slope.
|
| variable | Varied variable name, if any. |
causal
Whether the result supports a causal interpretation.
causal: bool
dataset
Labeled draws as an xarray.Dataset.
dataset: xr.Dataset
Variables use dims ("chain", "draw", "unit"). For a flat (n_samples,) numpy view, use draws() instead.
estimator
Estimator backend that produced this result.
estimator: str
identifiable
Backdoor identifiability of the treatment-outcome pair, if defined.
identifiable: bool | None
interventional
Whether graph surgery / do() was used.
interventional: bool
outcome
The outcome variable this result targets.
outcome: str
quantity
Query kind: prediction, comparison, or slope.
quantity: str
variable
Varied variable name, if any.
variable: str | None
Methods
| Name | Description |
|---|---|
| draws() | Return flat posterior draws, defaulting to the outcome variable. |
| hdi() | Return the highest-density interval, defaulting to the outcome. |
| mean() | Return the posterior mean, defaulting to the outcome variable. |
| plot() |
Plot the marginal posterior of the outcome (mean over unit first).
|
draws()
Return flat posterior draws, defaulting to the outcome variable.
Usage
draws(var=None)hdi()
Return the highest-density interval, defaulting to the outcome.
Usage
hdi(var=None, prob=DEFAULT_HDI_PROB)mean()
Return the posterior mean, defaulting to the outcome variable.
Usage
mean(var=None)plot()
Plot the marginal posterior of the outcome (mean over unit first).
Usage
plot(ax=None, *, var=None, bins=None)Parameters
ax: matplotlib.axes.Axes or None = None-
Axes to plot on. Creates a new figure when
None. var: str or None = None-
Variable to plot. Defaults to the outcome.
bins: BinsLike or None = None-
Passed through to
matplotlib.axes.Axes.hist: a positive integer bin count, a binning strategy name such as"auto", or a sequence of bin edges.
Returns
matplotlib.figure.Figure- The figure containing the histogram.
Raises
ValueError- If bins is neither one of the accepted types nor, for an integer bin count, positive.