fit

fit data

Find the best fit model parameters for the current data by minimizing the current statistic.

Syntax: fit <fit method parameters>

The arguments to fit depend on the fitting method currently in use. See the method command for details (and for the usage of the USE_CHAIN_RULE option in the user's startup Xspec.init file). Output from the fit command also depends on the fitting method currently in use.

Using the Levenberg-Marquardt algorithm, the parameters accepted are the maximum <number of iterations> before the user is prompted, the <critical delta>, which is the (absolute, not fractional) change in the statistic between iterations less than which the fit is deemed to have converged, and <critical beta>.

The <critical beta> provides an optional second stopping criterion, and it refers to the |beta|/N value reported during a Levenberg-Marquardt fit. This is the norm of the vector derivatives of the statistic with respect to the parameters divided by the number of parameters. At the best fit this should be zero, and so provides another measure of how well the fit is converging. <critical beta> is set to a negative value by default, which renders it inactive.

Including the string delay as an argument to fit turns on delayed gratification. It is turned off by nodelay. Delayed gratification modifies the way the damping parameter is set and has been shown in many cases to speed up convergence. The default is nodelay.

If <number of iterations>, <critical delta>, <critical beta>, delay, or nodelay is entered through the fit command, it also becomes the future default value for the currently loaded fit method (ie. Levenberg-Marquardt).

Examples:

XSPEC12> fit
// Fit with the default number of iterations and critical delta 
// chi-squared.
XSPEC12> fit 60
// Fit with 60 as the number of iterations.
XSPEC12> fit  50 1.e-3
// Fit with 1.e-3 as the critical delta.
XSPEC12> fit 50 1.e-3  20.
// Same fit, but will now use |beta|/N = 20.0 as another stopping
// criterion in addition to that of the critical delta. 
XSPEC12> fit delay
// Same fit, but will now use delayed gratification.