Synopsis
Set the statistical method.
Syntax
set_stat(stat)
Description
Changes the method used to evaluate the fit statistic, that is the numerical measure that determines how closely the model represents the data.
Example
>>> set_stat('cash')
PARAMETERS
The parameter for this function is:
Parameter | Type information | Definition |
---|---|---|
stat | str or sherpa.stats.Stat instance | When a string, the name of the statistic (case is not important): see `list_stats()` for supported values. Otherwise an instance of the statistic to use. |
Notes
The available statistics include:
Item | Definition |
---|---|
cash | A maximum likelihood function [1]. |
chi2 | Chi-squared statistic using the supplied error values. |
chi2constvar | Chi-squared with constant variance computed from the counts data. |
chi2datavar | Chi-squared with data variance. If the data has 0 counts then the error for that bin is 0. |
chi2gehrels | Chi-squared with gehrels method [2]. This is the default method. |
chi2modvar | Chi-squared with model amplitude variance. |
chi2xspecvar | Chi-squared with data variance to match XSPEC. Errors from zero-count channels (source or background) are ignored if the other channel (background or source) contains counts, or replaced by a minimum value (when both source or background are empty). It should not be used when a model is fit to the background rather than the background is subtracted from the data. |
cstat | A maximum likelihood function (the XSPEC implementation of the Cash function) [3]. This does not include support for including the background. |
wstat | A maximum likelihood function which includes the background data as part of the fit (i.e. for when it is not being explicitly modelled) (the XSPEC implementation of the Cash function) [3]. |
leastsq | The least-squares statisic (the error is not used in this statistic). |
References
- Cash, W. "Parameter estimation in astronomy through application of the likelihood ratio", ApJ, vol 228, p. 939-947 (1979).
- Gehrels, N. "Confidence limits for small numbers of events in astrophysical data", ApJ, vol 303, p. 336-346 (1986).
- https://heasarc.gsfc.nasa.gov/xanadu/xspec/manual/XSappendixStatistics.html
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
- info
- list_stats
- methods
- set_iter_method, set_iter_method_opt, set_method, set_method_opt
- modeling
- get_par, set_bkg_model, set_bkg_source, set_full_model, set_model, set_par, set_pileup_model, set_source
- statistics
- cash, chi2constvar, chi2datavar, chi2gehrels, chi2modvar, chi2xspecvar, chisquare, cstat, get_prior, get_stat_name, leastsq, list_priors, load_user_stat, set_prior, set_sampler, set_sampler_opt, wstat
- utilities
- calc_stat, set_analysis, set_default_id
- visualization
- image_setregion