Next: xsect Up: Setting Commands Previous: method

## statistic

change the objective function (statistic) for the fit

Change the fit or test statistic in use, for one or more spectra.

 Syntax: statistic [chi |cstat | lstat |pgstat |pstat |whittle[#]] [] statistic test [ad |chi |cvm |ks | pchi |runs] []

The fit statistic options are chi-squared (chi), C statistic (cstat), Loredo statistic (lstat), a statistic for Poisson data with assumed known background (pstat), a statistic for Poisson data with Gaussian background (pgstat), and the Whittle statistic (whittle) for power density functions. If the statistic is given as whittle with a number appended (e.g. whittle5) then the statistic is appropriate for that number of power density functions averaged together.

The test statistic options are Anderson-Darling (ad), chi-squared (chi), Cramer-von Mises (cvm), Kolmogorov-Smirnov (ks), Pearson chi-square (pchi) and Runs (runs). These statistics are described in the appendix on Statistics in XSPEC.

If a spectrum number or spectrum range is given, the chosen statistic will only apply to those spectra. It is therefore possible for a multi-spectrum fit to use more than one fit or test statistic. If no spectrum number or range is given, the chosen statistic will apply to all loaded spectra and will be the default statistic for any future loaded spectra.

Note that if the chosen statistic is not compatible with the currently used weight method, the weight method will be changed to standard weighting until the conflict is removed.

Examples:

Assume 3 spectra are currently loaded, all using the chi-squared statistic, and that chi-squared is the default statistic.

```XSPEC12>statistic cstat 2-3
// Spectrum 1 continues to use chi-sq, 2 and 3 use cstat.
XSPEC12>data 4 spec4.pha
// New spectrum 4 will use chi-sq.
XSPEC12>statistic cstat
// All 4 spectra now use cstat, cstat is the new default.
XSPEC12>data 5 spec5.pha
// New spectrum 5 will use cstat.
XSPEC12>statistic test ks
// All 4 spectra now use ks as the test statistic.
```

Next: xsect Up: Setting Commands Previous: method