Last modified: December 2023

URL: https://cxc.cfa.harvard.edu/sherpa/ahelp/set_iter_method.html
AHELP for CIAO 4.16 Sherpa

set_iter_method

Context: methods

Synopsis

Set the iterative-fitting scheme used in the fit.

Syntax

set_iter_method(meth)

meth - { 'none', 'sigmarej' }

Description

Control whether an iterative scheme should be applied to the fit.


Examples

Example 1

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

Example 2

Remove any iterative-fitting method:

>>> set_iter_method('none')

PARAMETERS

The parameter for this function is:

Parameter Definition
meth 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.

Notes

The parameters of the schemes are described in `set_iter_method_opt` .

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.

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 sigmarej scheme is based on the `IRAF ``sfit`` function <https://iraf.readthedocs.io/en/latest/tasks/noao/imred/specred/sfit.html>`_, 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

Changes in CIAO

Changed in CIAO 4.15

The "primini" scheme has been removed from Sherpa.


Bugs

See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.

See Also

confidence
set_conf_opt, set_covar_opt, set_proj_opt
data
set_areascal, set_arf, set_backscal, set_bkg, set_coord, set_counts, set_data, set_dep, set_exposure, set_grouping, set_quality, set_rmf, set_staterror, set_syserror
filtering
set_filter
fitting
fit, simulfit
methods
get_iter_method_name, get_iter_method_opt, list_iter_methods, set_iter_method_opt, set_method, set_method_opt
modeling
get_par, get_xsabund, get_xscosmo, get_xsxsect, get_xsxset, set_bkg_model, set_bkg_source, set_full_model, set_model, set_par, set_pileup_model, set_source, set_xsabund, set_xscosmo, set_xsxsect, set_xsxset
plotting
plot_fit, plot_fit_delchi, plot_fit_resid
statistics
get_stat, get_stat_name, set_prior, set_sampler, set_sampler_opt, set_stat
utilities
calc_chisqr, calc_stat, set_analysis, set_default_id
visualization
contour_resid, image_fit, image_setregion