Once data have been read in and a model defined, XSPEC uses a fitting algorithm to minimize the fit statistic, and hence find the best-fit values of the model parameters. The default is a modified Levenberg-Marquardt algorithm (based on CURFIT from Bevington, 1969). The algorithm used is local rather than global, so be aware that it is possible for the fitting process to get stuck in a local minimum and not find the global best-fit. The process also goes much faster (and is more likely to find the true minimum) if the initial model parameters are set to sensible values.

The Levenberg-Marquardt algorithm relies on XSPEC calculating the 2nd derivatives of the fit statistic with respect to the model parameters. By default these are calculated analytically, with the assumption that the 2nd derivatives of the model itself may be ignored. This can be changed by setting the USE_NUMERICAL_DIFFERENTIATION flag to ``true'' in the Xspec.init initialization file, in which case XSPEC will perform numerical calculations of the derivatives (which are slower).

At the end of a fit, XSPEC will write out the best-fit parameter values, along with estimated confidence intervals. These confidence intervals are one sigma and are calculated from the second derivatives of the fit statistic with respect to the model parameters at the best-fit. These confidence intervals are not reliable and should be used for indicative purposes only.

XSPEC has a separate command (error or uncertain) to derive confidence intervals for one interesting parameter, which it does by fixing the parameter of interest at a particular value and fitting for all the other parameters. New values of the parameter of interest are chosen until the appropriate delta-statistic value is obtained. XSPEC uses a bracketing algorithm followed by an iterative cubic interpolation to find the parameter value at each end of the confidence interval.

To compute confidence regions for several parameters at a time, XSPEC
can run a grid on these parameters (steppar). XSPEC will also
display a contour plot of the confidence regions of any two parameters
(plot `contour`).