plot_density function doesn't work for predictive prior unless credible interval is specified as 1
See original GitHub issueDescribe the bug When attempt to plot prior predictive distributions using plot_density function, plots show nothin unless credible interval is defined as 1
To Reproduce
az.plot_density(prior,credible_interval=1)
az.plot_density(prior)
Expected behavior Expected that the plot should only contain the 0.89 credible interval, instead of blank plots
Additional context arviz 0.7.0 pymc3 3.8 matplotlib 3.2.1
also using
%matplotlib inline
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
HW2 Solutions 36-724: Applied Bayesian and Computational ...
a Prior Predictive Distribution. Let p(θ)=1 for ... The posterior of θ given y is ... xa is not integrable on the interval...
Read more >M538 Mid - RPubs
The prior predictive distribution isn't informative and doesn't agree with the data observed. This is because it hasn't taken into account the observed...
Read more >Introduction to Bayesian Methods | - Govind G Nair
Introduction. This post will cover the following topics. Differences between Bayesian and Frequentist Approaches; A Simple Bayesian Analysis ...
Read more >How To Interpret Two Bayesian Credible Intervals
Your particular credible interval is constructed by finding the quantiles such that the tails of the posterior distribution are equiprobable, ...
Read more >Chapter 2 Bayesian Inference
Conduct a posterior predictive check to examine the fit between the model and the data, i.e., whether the chosen model with the estimated...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for the example. Now I can confirm the issue. I will work on this and keep you posted. In the meantime you can do this:
data = az.from_pymc3(posterior_1, prior=prior, posterior_predictive=posterior_pred_1)
data will be an ArviZ’s InferenceData object
you can then pass it to arviz functions, for example.
az.summary(data)
or
az.plot_density(data.prior)
or equivalentlyaz.plot_density(data, group=prior)
the default group isposterior
thusaz.plot_density(data)
will give you a plot of the posterior.One tip, you can globally set a few arviz parameters using
az.rcParams
, so for example you can addaz.rcParams["stats.credible_interval"] = 0.89
at the beginning, and then all plots and summaries will use this value instead of the default one (0.94).My guess about statistical rethinking is because the credible interval of .89 is used by the book even when the most common default value is 0.95. ArviZ and Statistical rethinking both uses non common values to remind user of the arbitrary nature of any default value.
Your report was very good. You clearly stated the problem and the excepted outcome. A reproducible (simple) example always helps.
Closing as the recommended workflow is to generate the idata object.