To summarize the preceding section, the main components of spectral fitting are as follows:
These components are used in the following manner:
This section describes how XSPEC performs these tasks.
To obtain the observed spectrum (C(I)), for a given observation, XSPEC uses two files: the data file, and the background file (for FITS file format see Arnaud, George & Tennant 19922.2). The data file tells XSPEC how many total photon counts were detected by the instrument in a given channel. XSPEC then uses the background file to derive a background-subtracted C(I) in units of counts per second. The background is scaled to the data by the ratio of the BACKSCAL values in the data and background files. It also is scaled for exposure times (EXPOSURE keyword) and AREASCAL values. The background-subtracted count rate is given by :
When this is done XSPEC has an observed spectrum to which the model spectrum can be fit.
Before XSPEC can take a given set of parameter values and predict the spectrum that would be detected by a given instrument, XSPEC must know the specific characteristics of the instrument. This information is known as the detector response. The response (R(I,E)), if you recall, is proportional to the probability that an incoming photon of energy E will be detected in channel I. As such, the response is a continuous function of E. This continuous function is converted to a discrete function by the creator of a response matrix who defines the energy ranges (EJ) such that:
XSPEC reads both the energy ranges, EJ, and the response matrix (RD(I,J)) from a response file (for FITS file format see George et al 19922.3) in a compressed format that only stores non-zero elements. XSPEC also includes an option to use an auxiliary response file (George et al 19922.4), which contains an array AD(J) that XSPEC multiplies into RD(I,J) as follows:
The model spectrum, f(E), is calculated within XSPEC using the energy ranges defined by the response file :
For a more detailed explanation of models, see Chapter 6.
Once data have been read in and a model defined, XSPEC uses a modified Levenberg-Marquardt algorithm (based on CURFIT from Bevington, 1969) to find the best-fit values of the model parameters. The algorithm used is a local one, so the user should 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.
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 derivatives of the fit statistic with respect to the model parameters. However, the confidence intervals are not reliable and should be used for indicative purposes only.
XSPEC has a separate command (error or uncertainty) 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 runs a grid on these parameters. XSPEC also will display a contour plot of the confidence regions of any two parameters.