arviz_plots.plot_prior_posterior

arviz_plots.plot_prior_posterior#

arviz_plots.plot_prior_posterior(dt, var_names=None, filter_vars=None, group=None, coords=None, sample_dims=None, kind=None, plot_collection=None, backend=None, labeller=None, aes_by_visuals=None, visuals=None, stats=None, **pc_kwargs)[source]#

Plot 1D marginal densities for prior and posterior.

The Bayes factor is estimated by comparing a model (H1) against a model in which the parameter of interest has been restricted to be a point-null (H0) This computation assumes the models are nested and thus H0 is a special case of H1.

Parameters:
dtxarray.DataTree or dict of {strxarray.DataTree}

Input data. In case of dictionary input, the keys are taken to be model names. In such cases, a dimension “model” is generated and can be used to map to aesthetics.

var_namesstr or list of str, optional

One or more variables to be plotted. Prefix the variables by ~ when you want to exclude them from the plot.

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

If None, 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.

groupNone

This argument is ignored. Have it here for compatibility with other plotting functions.

coordsdict, optional
sample_dimsstr or sequence of hashable, optional

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

kind{“kde”, “hist”, “dot”, “ecdf”}, optional

How to represent the marginal density. Defaults to rcParams["plot.density_kind"]

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

Mapping of visuals to aesthetics that should use their mapping in plot_collection when plotted. The prior and posterior groups are combined creating a new dimension “group”. By default, there is an aesthetic mapping from group to color. Valid keys are the same as for visuals.

visualsmapping of {strmapping or False}, optional

Valid keys are:

statsmapping, optional

Valid keys are:

  • dist -> passed to kde, ecdf, …

**pc_kwargs

Passed to arviz_plots.PlotCollection.wrap

Returns:
PlotCollection

Examples

Select two variables and plot them with a ecdf.

>>> from arviz_plots import plot_prior_posterior, style
>>> style.use("arviz-variat")
>>> from arviz_base import load_arviz_data
>>> dt = load_arviz_data('centered_eight')
>>> plot_prior_posterior(dt, var_names=["mu", "tau"], kind="ecdf")
../../_images/arviz_plots-plot_prior_posterior-1.png