2.2 Summarizing the posterior
Generally, the first task we will perform after sampling from the posterior is to check what the results look like. The plot_trace
function from ArviZ is ideally suited to this task:
Code 2.3
az.plot_trace(idata)
Figure 2.1: A trace plot for the posterior of our_first_model
Figure 2.1 shows the default result when calling az.plot_trace
; we get two subplots for each unobserved variable. The only unobserved variable in our model is θ. Notice that y is an observed variable representing the data; we do not need to sample that because we already know those values. Thus we only get two subplots. On the left, we have a Kernel Density Estimation (KDE) plot; this is like the smooth version of the histogram. Ideally, we want all chains to have a very similar KDE, like in Figure 2.1. On the right, we get the individual values at each sampling step; we get as many lines as chains. Ideally, we want it to be something that looks noisy, with no clear...