Last modified: December 2016

AHELP for CIAO 4.16 Sherpa


Context: statistics


A maximum likelihood function from XSPEC


The wstat statistic is equivalent to the XSPEC implementation of the Cash statistic where the observed background data is included (i.e. does not have to be modelled). The cstat statistic should be used if the background data is going to be modelled (i.e. fit).

This statistic corresponds to the "Poisson data with Poisson background (cstat)" section of the Statistics in XSPEC appendix, which includes the equations used to define the statistic.

Note that simulations should be used to verify that the statistic (including the reduced statistic) is robust, since there are a number of assumptions used in the derivation.


sherpa> set_stat("wstat")
sherpa> show_stat()
Statistic: WStat

Set the fitting statistic and then confirm the new value.

WSTAT and background subtraction

The subtract command should NOT be used when the wstat is selected. The background data will be automatically included when calculating the statistic. This means that results that use or display the data - such as plot_data(), plot_fit(), and plot_resid() - will not be correct when the wstat statistic is in use, because the plots do not include the background component. If the background is to be modelled then the cstat statistic should be used.


See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.

See Also

cash, chi2constvar, chi2datavar, chi2gehrels, chi2modvar, chi2xspecvar, chisquare, cstat, get_prior, leastsq, list_priors, set_prior, set_sampler, set_stat