Traceplot for linear regression

To better answer this, you need to remember what is stored in the trace. The trace holds separate chains of points. These points hold all of the model’s free RV and deterministic values. Some RVs are defined to be arrays with many entries, such as mu, while others are simple scalars, like alpha, beta and sigma.

The old version of traceplot plots a trace for each chain. That is why you see two lines instead of one in the plots that correspond to alpha, beta and sigma. When the trace had non scalar RVs (like mu), the old behavior of traceplot was to draw one like for each element in the RV (mu[0], mu[1], etc) and also draw separate traces for each chain.

The new version of traceplot splits the elements of array-like RVs into different axes in the figure (mu[0], mu[1], etc will be plotted in separate axes). Furthermore, you can pass combined=True to combine the results from every chain, which would then show a single line for the plots of alpha, beta and sigma.

1 Like