11.2.3.5. Estimate custom residuals

Once the estimate has been performed, both a priori and a posteriori residuals can be computed. Since a priori and a posteriori estimates depend on the chosen algorithm, their formulas are not detailed here. It is also possible to re-evaluate residuals for any custom set of parameter values provided by the user. This can be done through

estimateCustomResiduals(resName, theta_nb, theta_val)

It takes three arguments, which are:

  1. resName: a tag identifying the stored set of residuals;

  2. theta_nb: the number of parameter values in the array (must match _nPar);

  3. theta_val: an array containing the parameter values.

For convenience, this method can be called with a numpy array, as shown below

import numpy as np
mypar = np.array([0., 2., 3.])
mycal.estimateCustomResiduals("set1", len(mpar), mypar)

This feature allows re-estimating the residuals based on the available sample after the a posteriori distributions have been calibrated. A common use case is Markov chain Monte Carlo methods, where it may be necessary to discard the burn-in phase before evaluating residuals. Once created, the custom set can be used in the drawResiduals function, as discussed in Drawing the residuals.