set_iter_method¶
- sherpa.ui.set_iter_method(meth)¶
Set the iterative-fitting scheme used in the fit.
Control whether an iterative scheme should be applied to the fit.
- Parameters
meth ({ 'none', 'primini', 'sigmarej' }) – The name of the scheme used during the fit; ‘none’ means no scheme is used. It is only valid to change the scheme when a chi-square statistic is in use.
- Raises
TypeError – When the
methargument is not recognized.
See also
fitFit a model to one or more data sets.
get_iter_method_nameReturn the name of the iterative fitting scheme.
get_iter_method_optReturn one or all options for the iterative-fitting scheme.
list_iter_methodsList the iterative fitting schemes.
set_iter_method_optSet an option for the iterative-fitting scheme.
set_statSet the statistical method.
Notes
The parameters of each scheme are described in set_iter_method_opt.
The
priminischeme is used for re-calculating statistical errors, using the best-fit model parameters from the previous fit, until the fit can no longer be improved.This is a chi-square statistic where the variance is computed from model amplitudes derived in the previous iteration of the fit. This ‘Iterative Weighting’ (1) attempts to remove biased estimates of model parameters which is inherent in chi-square statistics (2).
The variance in bin i is estimated to be:
sigma^2_i^j = S(i, t_s^(j-1)) + (A_s/A_b)^2 B_off(i, t_b^(j-1))
where j is the number of iterations that have been carried out in the fitting process, B_off is the background model amplitude in bin i of the off-source region, and t_s^(j-1) and t_b^(j-1) are the set of source and background model parameter values derived during the iteration previous to the current one. The variances are set to an array of ones on the first iteration.
In addition to reducing parameter estimate bias, this statistic can be used even when the number of counts in each bin is small (< 5), although the user should proceed with caution.
The
sigmarejscheme is based on the IRAFsfitfunction 3, where after a fit data points are excluded if the value of(data-model)/error)exceeds a threshold, and the data re-fit. This removal of data points continues until the fit has converged. The error removal can be asymmetric, since there are separate parameters for the lower and upper limits.References
- 1
“Multiparameter linear least-squares fitting to Poisson data one count at a time”, Wheaton et al. 1995, ApJ 438, 322 http://adsabs.harvard.edu/abs/1995ApJ…438..322W
- 2
“Bias-Free Parameter Estimation with Few Counts, by Iterative Chi-Squared Minimization”, Kearns, Primini, & Alexander, 1995, ADASS IV, 331 http://adsabs.harvard.edu/abs/1995ASPC…77..331K
- 3
Examples
Switch to the ‘sigmarej’ scheme for iterative fitting and change the low and high rejection limits to 4 and 3 respectively:
>>> set_iter_method('sigmarej') >>> set_iter_method_opt('lrej') = 4 >>> set_iter_method_opt('hrej') = 3
Remove any iterative-fitting method:
>>> set_iter_method('none')