Computation of the minimum \(\chi^{2}\) with the Markov Chain Monte Carlo method

Description of the Markov Chain Monte Carlo method

In the Markov Chain Monte Carlo method (MCMC), the minimum and maximum values set for a parameter in a component define the bounds in which the values are chosen randomly. Contrary to the regular grid method, the models are not predetermined by the min, max, and step of a physical parameter. Indeed the step \(\theta_{i}\) used in MCMC is not regular and depends on the iteration \(i\) and other parameters.

(1)\[ \theta_{i+1} = \theta_{i} + \alpha (v - 0.5)\]

with

\[\alpha = \dfrac{ k (x_{max} - x_{min}) }{ k' }\]

if the iteration \(i < c\)

\[k = \dfrac{(r_{c} - 1)}{c} i + 1\]

if \(i > c\)

\[k = r_{c}\]
  • \(v\) is a random value between 0 and 1.
  • \(k'\) is a reduction factor set by the user with reducePhysicalParam
  • \(c\) determines the value of the iteration for which cutoff occurs and is set by the user with cutOff
  • \(r_{c}\) is the ratio at the cutoff set by the user with ratioAtCutOff

\(\alpha\) determines the amplitude of the step. It decreases until a constant value \(r_{c}\), allowing bigger steps at the beginning of the computation in order to find a good \(\chi^{2}\) and shorter steps at the end to refine the value of the potential best \(\chi^{2}\). Of course, this reasoning depends of the number of iterations (drawNumber). The higher this value, the wider the area visited in the space of the \(\chi^{2}\).

The MCMC method requires more inputs from the user who must carefully handle these extra parameters and their relation.

In order to compute the minimum \(\chi^{2}\) with the Markov Chain Monte Carlo method, the user must use the functions:

initComponentsForMCMC

Allow you to set the initial value of the physical parameters, i.e \(\theta_{0}\) defined in (1).

Usage:

userInputs.initComponentsForMCMC(*initComponents)

initComponents are lists of pairs of elements:

  • The first element is the component to be used for the computation
  • The second element is a dictionary whose keys are the parameter names and the values their corresponding initial values. Not all the initial parameters have to be specified. Indeed, when a parameter is not specified, the initial value is chosen randomly within the selected bounds.

Example 1: Some parameters are specified:

initialValues1 = {"nmol": 3.5e17, "fwhm": 3.0}
initialValues2 = {"nmol": 1e14}
userInputs.initComponentsForMCMC([component1, initialValues1], [component2, initialValues2])

Example 2: No parameter is specified:

initialValues1 = {}
initialValues2 = {}
userInputs.initComponentsForMCMC([component1, initialValues1], [component2, initialValues2])

computeChi2MinUsingMCMC

Compute the minimal \(\chi^{2}\) with the MCMC method after the components are initialized.

Usage:

userInputs.computeChi2MinUsingMCMC(drawNumber, cutOff, ratioAtCutOff)
  • drawNumber: the number of iterations
  • cutOff: the iteration for which the cutoff occurs. \(\alpha\) is constant and the variation of \(\theta\) is almost regular (cf equation (1).)
  • ratioAtCutOff: the ratio of \((x_{max} - x_{min})\) at the cutoff Its value must be < 1.

Example:

userInputs.computeChi2MinUsingMCMC(1000, 500, 0.2)

Example: A typical computation using MCMC:

drawNumber = 1000
cutOff = 300
ratioAtCutOff = 0.1
initialValues1 = {"nmol": 3.5e17, "fwhm": 3.0}
initialValues2 = {"nmol": 1E14}
userInputs.initComponentsForMCMC([component1, initialValues1], [component2, initialValues2])
userInputs.computeChi2MinUsingMCMC(drawNumber, cutOff, ratioAtCutOff)