    Return the statistical error on the dependent axis of a data set.

get_staterror(id=None, filter=False, bkg_id=None)
id - int or str, optional
filter - bool, optional
bkg_id - int or str, optional

The function returns the statistical errors on the values (dependenent axis) of a data set, or its background. These may have been set explicitly - either when the data set was created or with a call to `set_staterror` - or as defined by the chosen fit statistic (such as "chi2gehrels").

If not explicitly given, the statistical errors on a data set may be calculated from the data values (the independent axis), depending on the chosen statistic:

>>> load_arrays(1, [10, 15, 19], [4, 5, 9]) >>> set_stat('chi2datavar') >>> get_staterror() array([ 2. , 2.23606798, 3. ]) >>> set_stat('chi2gehrels') >>> get_staterror() array([ 3.17944947, 3.39791576, 4.122499 ])

If the statistical errors are set - either when the data set is created or with a call to `set_staterror` - then these values will be used, no matter the statistic:

>>> load_arrays(1, [10, 15, 19], [4, 5, 9], [2, 3, 5]) >>> set_stat('chi2datavar') >>> get_staterror() array([2, 3, 5]) >>> set_stat('chi2gehrels') >>> get_staterror() array([2, 3, 5])

PARAMETERS

The parameters for this function are:

Parameter
Definition
id
The identifier for the data set to use. If not given then the default identifier is used, as returned by

`get_default_id` .
filter
Should the filter attached to the data set be applied to the return value or not. The default is False .
bkg_id
Set if the values returned should be from the given background component, instead of the source data set.

The return value from this function is:

staterrors -- The statistical error for each data point. This may be estimated from the data (e.g. with the chi2gehrels

statistic) or have been set explicitly ( `set_staterror` ). For PHA data sets, the return array will match the grouping scheme applied to the data set. The size of this array depends on the `filter` argument.

Notes

The default behavior is to not apply any filter defined on the independent axes to the results, so that the return value is for all points (or bins) in the data set. Set the `filter` argument to `True` to apply this filter.

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

December 2023