11.6.4.1. Drawing the trace

This method is used to visualise the trace of the chains, i.e., the evolution of parameter values across iterations. It should be used to check the stability of the chains (stability of the mean and variance, see [Bla17]), and to detect potential autocorrelation (when the chain moves too slowly within the target distribution).

Thus, trace plots provide a first indication of the appropriate burn-in (the number of iterations to discard before stability is reached) and lag (the number of iterations to skip to reduce autocorrelation). The prototype is:

void drawTrace(TString sTitre, const char *variable = "*", Option_t * 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 parameter names to be drawn, separated by colons “:”. The default "*" draws all parameters;

  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);

    • “vertical”: if multiple parameters are plotted, display them stacked vertically (one per row). By default, plots are arranged horizontally, side by side;

Returning to the example in Macro “calibrationMCMCFlowrate1D.C”, the trace plots (shown in Figure 13.67) reveal that the very beginning of the chain is unstable, likely because initialization was far from the most probable value. Afterward, the behavior stabilizes, oscillating around what appears to be the most probable region. Based on this, a small burn-in of about 10 iterations could be chosen.

Looking at the acceptance ratio plot (see Figure 13.68), however, suggests that the burn-in should be slightly larger. Therefore, we set a value of 50 for the burn-in using the setBurnin method (see Investigating the quality of the samples through diagnostics and plots). When a trace plot is drawn after defining a burn-in with setBurnin, the burn-in region is indicated by a black dotted line.