XSPEC and low count spectra

Using XSPEC on spectra with small numbers of counts per bin requires some care.

Chi-squared : diagnostics and explanations

It is well-known that chi-squared doesn't work properly when there are significant numbers of bins in the spectrum with only a few counts. Folk wisdom is that there should be at least 5 counts in every bin. A good diagnostic for problems is if the best fit model is biased low relative to the data. The problems occur because the denominator in chi-squared is the variance for each bin. However, we don't necessarily know that variance so have to estimate it. The standard estimate is simply to use the data (assuming a Poisson distribution). Now, consider what happens if the data in a bin is an upward fluctuation or a downward fluctuation. Because we use the observed data as the denominator then a downward fluctuation contributes more to chi-squared than an upward fluctuation by the same amount. The net result is that the best-fit model is biased downwards.

For instance, this example shows that the data is systematically above the model at energies above 2 keV. Note that I binned up the plot using setplot rebin to make it look a bit better but this command does not bin the data used in the fit.

Use cstat when there is no background

In the simple case where the background is non-existent or negligible and you can assume that the counts in a given channel are just a Poisson variable with mean given by the model-predicted counts in that channel then the best solution is to change the fit statistic to cstat (statistic cstat). The same model and response used above now gives the fit below which no longer has a downward bias at energies above 2 keV.

When there is background it is more complicated

Fit both the source and background files simultaneously

When possible, the best way to approach this is to simultaneously fit to both the source and background files with a background model for the background file and a combination of source model and background model for the source file. The parameters for the background models should be linked. A simple example would be set up in xspec as follows

  XSPEC12> data 1:1 source.pi 2:2 background.pi
  XSPEC12> model phabs(apec) + pow

where we phabs(apec) is the source model and pow the background model. You will now be prompted for parameters for data group 1 (ie the source file) then data group 2 (ie the background file). For the second (background) set of parameters freeze all the parameters of phabs(apec) and set the normalization to zero. Link the second set of parameters for the pow to the first set of parameters. Now fit using cstat.

low count spectra (last edited 2012-04-27 17:02:07 by KeithArnaud)