LinkSpec.mean_correction#
- abstractmethod LinkSpec.mean_correction(posterior, output_var='y')[source]#
Per-draw factor converting median-scale outputs to the response mean.
Counterfactual contributions are computed on the conditional median of the response (the inverse link applied to
mu). For links whose conditional mean differs from the median, multiplying by this factor rescales the median-based quantity to the conditional meanE[y | mu, ...].- Parameters:
- posterior
xr.Dataset Posterior group of the fitted model’s
InferenceData.- output_var
str, default"y" Name of the observed variable, used to locate the likelihood scale parameter in the posterior.
- posterior
- Returns:
xr.DataArrayThe multiplicative correction with
(chain, draw, ...)dims (broadcasting overdate). It is identically1for links whose mean equals the median (e.g. the identity link).