Chi2DataVar

class sherpa.stats.Chi2DataVar(name='chi2datavar')[source]

Bases: sherpa.stats.Chi2

Chi Squared with data variance.

The variance in each bin is estimated from the data value in that bin. See also Chi2Gehrels, Chi2XSpecVar and Chi2ModVar.

If the number of counts in each bin is large, then the shape of the Poisson distribution from which the counts are sampled tends asymptotically towards that of a Gaussian distribution, with variance

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

where N is the number of on-source (and off-source) bins included in the fit. The background term appears only if an estimate of the background has been subtracted from the data.

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()