arviz.plot_compare(comp_df, insample_dev=True, plot_standard_error=True, plot_ic_diff=True, figsize=None, textsize=None, plot_kwargs=None, ax=None)[source]

Summary plot for model comparison.

This plot is in the style of the one used in the book Statistical Rethinking (Chapter 6) by Richard McElreath.

comp_df: pd.DataFrame

Result of the method

insample_dev : bool, optional

Plot in-sample deviance, that is the value of the information criteria without the penalization given by the effective number of parameters (pIC). Defaults to True

plot_standard_error : bool, optional

Plot the standard error of the information criteria estimate. Defaults to True

plot_ic_diff : bool, optional
Plot standard error of the difference in information criteria between each model

and the top-ranked model. Defaults to True

figsize : tuple, optional

If None, size is (6, num of models) inches

textsize: float

Text size scaling factor for labels, titles and lines. If None it will be autoscaled based on figsize.

plot_kwargs : dict, optional

Optional arguments for plot elements. Currently accepts ‘color_ic’, ‘marker_ic’, ‘color_insample_dev’, ‘marker_insample_dev’, ‘color_dse’, ‘marker_dse’, ‘ls_min_ic’ ‘color_ls_min_ic’, ‘fontsize’

ax : axes, optional

Matplotlib axes

ax : matplotlib axes


Defaults to comparing Widely Accepted Information Criterion (WAIC) if present in comp_df column, otherwise compares Leave-one-out (loo)


Show default compare plot

>>> import arviz as az
>>> model_compare ={'Centered 8 schools': az.load_arviz_data('centered_eight'),
>>>                  'Non-centered 8 schools': az.load_arviz_data('non_centered_eight')})
>>> az.plot_compare(model_compare)

Plot standard error and information criteria difference only

>>> az.plot_compare(model_compare, insample_dev=False)