Chi2Gehrels

class sherpa.stats.Chi2Gehrels(name='chi2gehrels')[source]

Bases: sherpa.stats.Chi2

Chi Squared with Gehrels variance.

The variance is estimated from the number of counts in each bin, but unlike Chi2DataVar, the Gaussian approximation is not used. This makes it more-suitable for use with low-count data.

The standard deviation for each bin is calculated using the approximation from [1]:

sigma(i,S) = 1 + sqrt(N(i,s) + 0.75)

where the higher-order terms have been dropped. This is accurate to approximately one percent. For data where the background has not been subtracted then the error term is:

sigma(i) = sigma(i,S)

whereas with background subtraction,

sigma(i)^2 = sigma(i,S)^2 + [A(S)/A(B)]^2 sigma(i,B)^2

Notes

The accuracy of the error term when the background has been subtracted has not been determined. A preferable approach to background subtraction is to model the background as well as the source signal.

References

[1]“Confidence limits for small numbers of events in astrophysical data”, Gehrels, N. 1986, ApJ, vol 303, p. 336-346. http://adsabs.harvard.edu/abs/1986ApJ...303..336G

Methods Summary

calc_chisqr(data, model) Return the chi-square value for each bin.
calc_stat(data, model)
calc_staterror

Methods Documentation

calc_chisqr(data, model)

Return the chi-square value for each bin.

Parameters:
  • data (a Data or DataSimulFit instance) – The data set, or sets, to use.
  • model (a Model or SimulFitModel instance) – The model expression, or expressions. If a SimulFitModel is given then it must match the number of data sets in the data parameter.
Returns:

chisqr – The per-bin chi-square values.

Return type:

array of numbers

calc_stat(data, model)
calc_staterror()