Chi2Gehrels¶
-
class
sherpa.stats.Chi2Gehrels(name='chi2gehrels')[source] [edit on github]¶ Bases:
sherpa.stats.Chi2Chi 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)^2See also
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)Return the statistic value for the data and model. calc_staterror(data)Return the statistic error values for the data. Methods Documentation
-
calc_chisqr(data, model) [edit on github]¶ 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) [edit on github]¶ Return the statistic value for the data and model.
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: statval, fvec – The statistic value and the per-bin “statistic” value.
Return type: number, array of numbers
-
static
calc_staterror(data)[source] [edit on github]¶ Return the statistic error values for the data.
Parameters: data (scalar or 1D array of numbers) – The data values. Returns: staterror – The errors for the input data values (matches the data argument). Return type: scalar or array of numbers
-