The basic fit command is called fit. This command performs a minimization on the fit statistic (set by statistic) using the currently selected algorithm (set by method: the default is Levenberg-Marquardt). fit takes arguments that are passed to the fitting method: by default, these are the number of iterations to execute before asking the user whether to continue, and the numerical convergence criterion.

A systematic model uncertainty can be included using the systematic command. The error or uncertain command calculates error bounds for one interesting parameter for the specified parameters and confidence levels. To produce multi-dimensional errors the steppar command is used to generate a fit-statistic grid. Two-dimensional grids may be expressed as contour plots (using plot contour). The model normalization can be set using the renorm command. The normalization of the correction file background (from corfile) can be set with cornorm. ftest and the Tcl script simftest can be used to calculate F-test probabilities.

Markov Chain Monte Carlo runs can be performed using the chain command. The proposal distribution covariance can be rescaled using chain rescale if the Metropolis-Hastings algorithm is selected. If an MCMC chain has been loaded then error uses this chain. The analog of steppar is the margin command with the results being plotted using plot margin or plot integprob.

What to do when you have Poisson data

The statistic assumes that all the spectral channels are Gaussian distributed and that the estimate for the variance is uncorrelated with the observed counts. If the data are Poisson then these are bad assumptions especially if there are small numbers of counts in a channel. An alternative fit statistic, the C-statistic, should be used in this case. The C-statistic can also provide confidence intervals in exactly the same way as . To use, give the command

XSPEC12> statistic cstatand then use the fit and error commands as usual.

An alternative (and deprecated) approach is to continue using the statistic but change the weighting to provide a better estimate of the variance in the small number limit. This can be done using the weight gehrels or weight churazov commands. The latter is to be preferred.

The goodness-of-fit statistic can be set using the command statistic `test`. There are a number of options available. They can be interpreted
using the goodness command, which utilizes Monte Carlo methods.