Summarizing the posterior
As we have already seen, the result of a Bayesian analysis is a posterior distribution. This contains all the information about our parameters, according to the data and the model. One way to visually summarize the posterior is to use the plot_posterior
function that comes with PyMC3. This function accepts a PyMC3 trace or a NumPy array as a main argument. By default, plot_posterior
shows a histogram for the credible parameters together with the mean of the distribution and the 95% HPD as a thick black line at the bottom of the plot. Different interval values can be set for the HPD with the argument alpha_level
. We are going to refer to this type of plot as Kruschke's plot, since John K. Kruschke introduced this type of plot in his great book Doing Bayesian Data Analysis:
pm.plot_posterior(chain, kde_plot=True)
Posterior-based decisions
Sometimes describing the posterior is not enough. Sometimes we need to make decisions based on our inferences. We have to reduce...