11.6.1. Constructing the TMCMC object

The constructors available for creating an instance of the TMCMC class are detailed in Common methods of the calibration classes. As a reminder, the available prototypes are:

# Constructor with a runner
TMCMC(tds, runner, ns=1, option="")
# Constructor with a TCode
TMCMC(tds, code, ns=1, option="")
# Constructor with a function using Launcher
TMCMC(tds, fcn, varexpinput, varexpoutput, ns=1, option="")

Details about these constructors can be found in Construction with a TRun, Construction with a TCode, and Construction for a function with the Launcher architecture respectively for the TRun, TCode, and TLauncherFunction-based constructor. In all cases, the number of iterations \(ns\) must be specified.

This class provides one specific option, which can be used to modify the default value of the a posteriori distribution returned by the algorithm. Two possible choices are available for obtaining the single-point estimate that best represents the distribution:

  • Mean of the distribution: this is the default option;

  • Mode of the distribution: the user must specify “mode” in the option field of the TMCMC constructor.

The default solution is straightforward, whereas the second requires internal smoothing of the distribution in order to obtain the best estimate of the mode.

In practice, the constructor—whichever one is chosen—initializes a folder named MCMC_N, where N is an integer ensuring the folder name is available. This folder contains all the information related to the MCMC calculation (the chain values, the algorithm used, the number of accepted samples, etc.), with each chain stored in a separate file named MCMC_N_chain_M (for the M-th chain, starting from 0). By default, only one chain is initialized, so the MCMC_N folder contains a single file MCMC_N_chain_0. This folder will be duplicated once the setMultistart method is called (see Initialising several chains). The files are automatically loaded and saved during the computation.

The next step is to construct the TDistanceLikelihoodFunction, a mandatory step that must always immediately follow the constructor. For now, the only available likelihood function is the Gaussian, as it is the most commonly used. It can be accessed through the classic setLikelihood method using the function name "log-gauss", following the standard prototype (presented in Recommended distance and likelihood functions, construction method). As previously explained, in this case the weights provided to the constructor correspond to the standard deviations of each observation. Advanced users also have the option to define a custom likelihood by following the prototype:

setLikelihood(likelihoodFunc, tdsRef, input, reference, weight="")