    Calculate the fit statistic for a data set.

calc_stat(id=None, *otherids)
id - int or str, optional
*otherids - int or str, optional

Evaluate the model for one or more data sets, compare it to the data using the current statistic, and return the value. No fitting is done, as the current model parameter, and any filters, are used.

Calculate the statistic for the model and data in the default data set:

>>> stat = calc_stat()

Find the statistic for data set 3:

>>> stat = calc_stat(3)

When fitting to multiple data sets, you can get the contribution to the total fit statistic from only one data set, or from several by listing the datasets explicitly. The following finds the contribution from the data sets labelled "core" and "jet":

>>> stat = calc_stat("core", "jet")

Calculate the statistic value using two different statistics:

>>> set_stat('cash') >>> s1 = calc_stat() >>> set_stat('cstat') >>> s2 = calc_stat()

PARAMETERS

The parameters for this function are:

Parameter
Definition
id
The data set that provides the data. If not given then all data sets with an associated model are used simultaneously.
*otherids
Other data sets to use in the calculation.

The return value from this function is:

stat -- The current statistic value.

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

December 2023