Fork me on GitHub

Return to: FAQ index

Which fit statistics and optimization methods are available?

A Sherpa fit in Iris can be done using a least-squares statistic, chi-squared (with various methods for estimating the variances used by chi-squared), or with either of two maximum likelihood statistics that are useful when the data have low numbers of counts. The Sherpa fit statistics and optimization methods available in Iris are listed below with brief descriptions; refer to the Statistics and Optimizationsherpa_opt pages of the Sherpa website for a full and detailed explanation of each.

Fit Optimization Methods

  • Levenberg-Marquardt - a method to find the best-fit model parameter values, by finding the local minimum in parameter space; the functions to be minimized are nonlinear least-squares functions of the model parameters.
  • Nelder-Mead - a method to find the best-fit model parameter values, by finding the local minimum in parameter space; a direct search method is used to continually move “downhill” in parameter space, until settling in a local minimum.
  • Monte Carlo - a method using the differential evolution algorithm, to find a global minimum in parameter space; the search is seeded with randomly selected starting points, and can continue the search for the true minimum where the other methods could get stuck in local minima that do not represent the actual best fit. (Most useful for complex models and fits that could explore complicated regions of parameter space.)

Fit Statistics

  • least-squares - Sum of the squares of the differences between data and model values.
  • Cash - A maximum likelihood function based on Poisson statistics. More suitable for counts data than for fluxes.
  • C-stat - A maximum likelihood function similar to Cash, but with a chi-squared-like probability distribution. More suitable for counts data than for fluxes.
  • chi2datavar - Chi-squared statistic with variance computed from the data. If measured errors are provided, the variance is taken from these errors; else, the variance is computed from the y-values of the data points. This is the preferred chi-squared option to be used in Iris.
  • chi2gehrels - Chi-squared statistic, where the variance is computed with a function from Gehrels et al. Suitable for low counts data (e.g., X-ray data) to correct for bias in using chi-squared.
  • chi2modvar - Chi-squared statistic, where the variance is computed from the model values instead of data.
  • chi2constvar - Chi-squared statistic, where the variance is set to be a constant value. That constant is the average of the y-values of the data points.
  • chi2xspecvar - Chi-squared statistic, where the variance is computed as the X-ray spectral fitting program XSPEC would compute the variance (i.e., where the variance would be less than one, reset it to one). More suitable for low counts data (e.g., X-ray data).

The Iris default fitting method and statistic are “neldermead” and “leastsq”, respectively, which represent good choices for a robust, quick, initial fit of a relatively simple model to a data set covering potentially many orders of magnitude in flux and/or wavelength.

Return to: FAQ index