Chi2ConstVar

class sherpa.stats.Chi2ConstVar(name='chi2constvar')[source]

Bases: sherpa.stats.Chi2

Chi Squared with constant variance.

The variance is the same in each bin, and set to be the mean number of counts in the data:

sigma(i)^2 = (1/N) * (sum)_(j=1)^N N(j,S) + [A(S)/A(B)]^2 N(j,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) 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)

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)

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]

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