arviz_plots.plot_lm

Contents

arviz_plots.plot_lm#

arviz_plots.plot_lm(dt, y=None, x=None, y_pred=None, x_pred=None, filter_vars=None, group='posterior_predictive', coords=None, sample_dims=None, ci_kind=None, ci_prob=None, line_kind=None, plot_collection=None, backend=None, labeller=None, aes_by_visuals=None, visuals=None, stats=None, **pc_kwargs)[source]#

Posterior predictive and mean plots for regression-like data..

Parameters:
dtxarray.DataTree

Input data

ystr or xarray.DataArray, optional

Target variable. If None (default), the first variable in “observed_data” is used.

xstr or list of str or xarray.DataArray or xarray.Dataset, optional

Independent variable(s). If None (default), all variables in “constant_data” are used.

y_predstr or xarray.DataArray, optional

Predicted values. If None (default), the variable in the specified group with the same name as y is used.

x_predstr or list of str or xarray.DataArray or xarray.Dataset, optional

Independent variable(s) for predictions.

If None (default), and if group is “predictions”, all variables corresponding to x data in “predictions_constant_data” group are used. If group is “posterior_predictive”, x is used.

filter_vars: {None, “like”, “regex”}, default None

If None (default), interpret var_names as the real variables names. If “like”, interpret var_names as substrings of the real variables names. If “regex”, interpret var_names as regular expressions on the real variables names. It is used for any of y, x, y_pred, and x_pred if they are strings or lists of strings.

groupstr, default “posterior_predictive”

Group to use for plotting.

coordsmapping, optional

Coordinates to use for plotting.

sample_dimsiterable, optional

Dimensions to reduce unless mapped to an aesthetic. Defaults to rcParams["data.sample_dims"]

ci_kind{“hdi”, “eti”}, optional

Which credible interval to use. Defaults to rcParams["stats.ci_kind"]

ci_probfloat or list of float, optional

Indicates the probabilities that should be contained within the plotted credible intervals. Defaults to rcParams["stats.ci_prob"]

line_kind{“mean”, “median”,”mode”}, optional

Which point estimate to use for the line. Defaults to rcParams["stats.point_estimate"]

plot_collectionPlotCollection, optional
backend{“matplotlib”, “bokeh”}, optional
labellerlabeller, optional
aes_by_visualsmapping, optional

Mapping of visuals to aesthetics that should use their mapping in plot_collection when plotted. Valid keys are the same as for visuals. By default, there are no aesthetic mappings at all

visualsmapping of {strmapping or bool}, optional

Valid keys are:

statsmapping, optional

Valid keys are:

  • credible_interval -> passed to eti or hdi

  • point_estimate -> passed to mean, median or mode

**pc_kwargs

Passed to arviz_plots.PlotCollection.wrap

Returns:
PlotMatrix