arviz_plots.plot_lm#
- arviz_plots.plot_lm(dt, x=None, y=None, y_obs=None, plot_dim=None, smooth=True, filter_vars=None, group='posterior_predictive', coords=None, sample_dims=None, ci_kind=None, ci_prob=None, point_estimate=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:
- dt
xarray.DataTree Input data
- x
stroptional Independent variable. If None, use the first variable in group. Data will be taken from the constant_data group unless the group argument is “predictions” in which case it is taken from the predictions_constant_data group.
- y
stroptional Response variable or linear term. If None, use the first variable in observed_data group.
- y_obs
strorxarray.DataArray, optional Observed response variable. If None, use y.
- plot_dim
str, optional Dimension to be represented as the x axis. Defaults to the first dimension in the data for x. It should be present in the data for y too.
- smoothbool, default
True If True, apply a Savitzky-Golay filter to smooth the lines.
- 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.
- group
str, 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_prob
floator array_like offloats, optional Indicates the probabilities that should be contained within the plotted credible intervals. Defaults to
rcParams["stats.ci_prob"]- point_estimate{“mean”, “median”,”mode”}, optional
Which point_estimate to use for the line. Defaults to
rcParams["stats.point_estimate"]- plot_collection
PlotCollection, optional - backend{“matplotlib”, “bokeh”}, optional
- labeller
labeller, optional - aes_by_visualsmapping, optional
Mapping of visuals to aesthetics that should use their mapping in
plot_collectionwhen plotted. Valid keys are the same as forvisuals. By default, there are no aesthetic mappings at all- visualsmapping of {
strmapping or bool}, optional Valid keys are:
pe_line-> passed to
line_xy.Represents the mean, median, or mode of the predictions, E(y|x), or of the linear predictor, E(η|x).
ci_band -> passed to
fill_between_y.Represents a credible interval for E(y|x) or E(η|x).
ci_bounds -> passed to
line_xy. Defaults to FalseRepresents the upper and lower bounds of a credible interval for E(y|x) or E(η|x). This is similar to ci_band, but uses lines for the boundaries instead of a filled area.
ci_line_y -> passed to
ci_line_y. Defaults to FalseThis is intended for categorical x values or discrete variables with few unique values of x for which ci_band or ci_bounds do not work well.
observed_scatter -> passed to
scatter_xy.Represents the observed data points.
xlabel -> passed to
labelled_x.ylabel -> passed to
labelled_y.
- 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
- dt
- Returns: