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,
p. 498).

Press, W. H.; Flannery, B. P.; Teukolsky, S. A.; and Vetterling, W. T. "Bessel Functions of Fractional Order, Airy Functions,
Spherical Bessel Functions." §6.7 in Numerical
Recipes in FORTRAN: The Art of Scientific Computing, 2nd ed. Cambridge, England:
Cambridge University Press, 1992.