| AHELP for CIAO 4.5 Sherpa v1 | set_iter_method |
Context: methods |
Synopsis
Set the iterative fitting method
Syntax
set_iter_method(name)
Description
The set_iter_method command is used to set the current iterative fitting method to either "none" (default), "primini", or "sigmarej". All available iterative fitting methods are returned by the list_iter_methods command, and the name of the current iterative fitting method is returned by the get_iter_method_name command. The essence of an iterative fitting method is that the chosen fit optimization method can be called several times, until some criterion is met. The fit statistic and optimization methods are selected independently of the iterative fitting method.
- name = name of an iterative fitting method, either "none" (default), "primini", or "sigmarej"
If the iterative fitting method is "none", then no iterative fitting is done when "fit()" is called; the optimization method is called once, and Sherpa otherwise operates as expected.
Primini's method 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.
The sigma-rejection method is based on the IRAF SFIT function. In successive fits, data points for which ((data - model) / error) exceeds some threshold are added to the filter, and automatically excluded from the next fit.
Primini's method and sigma-rejection can only be called when the fit statistic is a chi-squared statistic; it cannot be used with least-squares, Cash or C-statistic.
Example 1
sherpa> set_stat("chi2datavar")
sherpa> set_method("neldermead")
sherpa> print(get_iter_method_name())
none
sherpa> set_iter_method("primini")
sherpa> fit()Primini's method is set as the iterative fitting method for fitting data set 1. When "fit()" is run, the Nelder-Mead optimization method is called until the fit can no longer be improved.
Example 2
sherpa> set_stat("chi2xspecvar")
sherpa> set_method("levmar")
sherpa> print(get_iter_method_name())
primini
sherpa> set_iter_method("none")
sherpa> fit(2)Data set 2 is to be fit without iterative fitting, therefore the current iterative fitting method is changed from "primini" to "none". The Levenberg-Marquardt optimization method is called once during the fit to data set 2.
Example 3
sherpa> set_stat("chi2gehrels")
sherpa> set_method("simplex")
sherpa> set_iter_method("sigmarej")
sherpa> fit(2,3)The sigma-rejection iterative fitting method is used in the simultaneous fitting of data sets 2 and 3. When "fit(2,3)" is run, the Nelder-Mead optimization method is called until the fit can no longer be improved.
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_exposure, set_grouping, set_quality, set_rmf, set_staterror, set_syserror
- filtering
- set_filter
- fitting
- fit
- methods
- get_iter_method_name, get_iter_method_opt, list_iter_methods, set_iter_method_opt, set_method, set_method_opt
- modeling
- get_par, set_bkg_model, set_full_model, set_par, set_pileup_model, set_source, set_xsabund, set_xscosmo, set_xsxsect, set_xsxset
- plotting
- plot_fit
- statistics
- get_stat, 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

![[Sherpa Logo]](../imgs/sherpa_logo_navbar.gif)