11.6.5.1. Drawing the 2D trace

This method is used to visualise the trajectory of the chains across iterations by examining two parameters at a time. It can help verify that the chains uniformly explore the distribution and that they converge toward the same posterior. It also highlights potential covariance between pairs of parameters in the posterior distribution.

Although this method can be used as a diagnostic tool, it is less effective for assessing chain stability or detecting autocorrelation. For those purposes, standard trace plots remain preferable.

The prototype is:

draw2DTrace(sTitre, variable, option = "")

This method takes up to three arguments, two of which are optional:

  1. sTitre: the title of the plot (an empty string is allowed);

  2. variable (optional): a list of exactly two parameter names to be drawn, separated by colons ":". For example, "t0:t1" is a valid argument to plot the chains of t0 and t1 together on a 2D trace;

  3. option (optional): a list of options, separated by commas “,”, to adjust the plotting behavior:

    • “nonewcanvas”: draw on the current canvas (instead of creating a new one);

Returning to the example in Macro “calibrationMCMCLinReg.py”, the 2D trace plot (shown in Figure 13.72) clearly show the four chains converging toward the posterior distribution located in the center of the plot. The distribution appears to be uniformly covered by a sufficient number of samples, without any obvious trend suggesting covariance between the two parameters.