11.5.1. Constructing the TRejectionABC object

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

# Constructor with a runner
TRejectionABC(tds, runner, ns=1, option="")
# Constructor with a TCode
TRejectionABC(tds, code, ns=1, option="")
# Constructor with a function using Launcher
TRejectionABC(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 samples \(ns\) must be specified, as it represents the number of retained samples in the final posterior distribution. In our implementation, the total number of computations is determined by the chosen percentile value (see Defining the percentile).

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 TRejectionABC 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.

The final step is to construct the TDistanceLikelihoodFunction, a mandatory step that must always immediately follow the constructor. Although ABC methods are Bayesian, they are likelihood-free: instead of directly computing the likelihood, they calculate the distance between the observed data and the simulated data for several prior samples, until the best-fitting distribution is identified. Consequently, the TDistanceLikelihoodFunction object can be constructed via the setDistance method (following the prototype presented in Recommended distance and likelihood functions, construction method). Advanced users also have the option to define a custom distance by following the prototype:

setDistance(distFunc, tdsRef, input, reference, weight="")

Warning

If the reference dataset is compared against a deterministic model (i.e. a model with no intrinsic stochasticity), it is necessary to explicitly specify the uncertainty hypotheses. This is done via the method described in Introducing noise for deterministic function.