arviz_plots.plot_bf

Contents

arviz_plots.plot_bf#

arviz_plots.plot_bf(dt, var_names, ref_val=0, kind=None, sample_dims=None, plot_collection=None, backend=None, labeller=None, aes_by_visuals=None, visuals=None, stats=None, **pc_kwargs)[source]#

Bayes Factor for comparing hypothesis of two nested models.

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 H0 is a special case of H1. For more details see here https://arviz-devs.github.io/EABM/Chapters/Model_comparison.html#savagedickey-ratio

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, optional

Variables for which the bayes factor will be computed and the prior and posterior will be plotted.

ref_valint or float, default 0

Reference (point-null) value for Bayes factor estimation.

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

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

sample_dimsstr or sequence of hashable, optional

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

plot_collectionPlotCollection, optional
backend{“matplotlib”, “bokeh”, “plotly”}, 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. 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 one variable.

>>> from arviz_plots import plot_bf, style
>>> style.use("arviz-variat")
>>> from arviz_base import load_arviz_data
>>> dt = load_arviz_data('centered_eight')
>>> plot_bf(dt, var_names="mu", kind="hist")
../../_images/arviz_plots-plot_bf-1.png