Posterior predictive and mean plots for regression-like data.
str
or DataArray
or ndarray
If str, variable name from observed_data
.
InferenceData
, Optional
Optional only if y
is not str.
str
, tuple
of strings
, DataArray
or array_like, optional
If str or tuple, variable name from constant_data
. If ndarray, could be 1D, or 2D for multiple plots. If None, coords name of y
(y
should be DataArray).
str
or Sequence
, Optional
If str, variable name from posterior
. Its dimensions should be same as y
plus added chains and draws.
str
, Optional
If str, variable name from posterior_predictive
. Its dimensions should be same as y
plus added chains and draws.
int
, Optional
, Default
50
Significant if kind_pp
is “samples” or kind_model
is “lines”. Number of samples to be drawn from posterior predictive or
Default
“samples”
Options to visualize uncertainty in data.
Default
“lines”
Options to visualize uncertainty in mean of the data.
str
, Optional
Necessary if y
is multidimensional.
str
, Optional
Select plotting backend {“matplotlib”,”bokeh”}. Default “matplotlib”.
dict
, optional
Passed to matplotlib.axes.Axes.plot()
in matplotlib and bokeh:bokeh.plotting.Figure.circle()
in bokeh
dict
, optional
Passed to matplotlib.axes.Axes.plot()
in matplotlib and bokeh:bokeh.plotting.Figure.circle()
in bokeh
dict
, optional
Passed to arviz.plot_hdi()
dict
, optional
Passed to matplotlib.axes.Axes.plot()
in matplotlib and bokeh:bokeh.plotting.Figure.line()
in bokeh
dict
, optional
Significant if kind_model
is “hdi”. Passed to arviz.plot_hdi()
dict
, optional
Passed to matplotlib.axes.Axes.plot()
in matplotlib and bokeh:bokeh.plotting.Figure.line()
in bokeh
dict
, optional
These are kwargs specific to the backend being used. Passed to matplotlib.pyplot.subplots()
or bokeh.plotting.figure()
.
float
, float
), optional
Figure size. If None it will be defined automatically.
float
, optional
Text size scaling factor for labels, titles and lines. If None it will be autoscaled based on figsize
.
numpy
array_like of matplotlib Axes
or bokeh_figures
, optional
A 2D array of locations into which to plot the densities. If not supplied, Arviz will create its own array of plot areas (and return it).
Call backend show function.
Add legend to figure. By default True.
Add grid to figure. By default True.
matplotlib
axes
or bokeh
figures
See also
plot_ts
Plot timeseries data
plot_ppc
Plot for posterior/prior predictive checks
Examples
Plot regression default plot
>>> import arviz as az >>> import numpy as np >>> import xarray as xr >>> idata = az.load_arviz_data('regression1d') >>> x = xr.DataArray(np.linspace(0, 1, 100)) >>> idata.posterior["y_model"] = idata.posterior["intercept"] + idata.posterior["slope"]*x >>> az.plot_lm(idata=idata, y="y", x=x)
Plot regression data and mean uncertainty
>>> az.plot_lm(idata=idata, y="y", x=x, y_model="y_model")
Plot regression data and mean uncertainty in hdi form
>>> az.plot_lm( ... idata=idata, y="y", x=x, y_model="y_model", kind_pp="hdi", kind_model="hdi" ... )
Plot regression data for multi-dimensional y using plot_dim
>>> data = az.from_dict( ... observed_data = { "y": np.random.normal(size=(5, 7)) }, ... posterior_predictive = {"y": np.random.randn(4, 1000, 5, 7) / 2}, ... dims={"y": ["dim1", "dim2"]}, ... coords={"dim1": range(5), "dim2": range(7)} ... ) >>> az.plot_lm(idata=data, y="y", plot_dim="dim1")
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4