A merit function, also known as a figure-of-merit function, is a function that measures the agreement between data and the fitting model for a particular choice of the parameters. By convention, the merit function is small when the agreement is good.
In the process known as regression, parameters are adjusted based on the value of the merit function until a smallest value is obtained,
thus producing a best-fit with the corresponding parameters giving the smallest value
of the merit function known as the best-fit parameters (Press et al. 1992,