# Changeset a7c6f38 in sasview for src/sas/sasgui/perspectives/fitting/media/residuals_help.rst

Ignore:
Timestamp:
Mar 4, 2018 4:07:55 PM (6 years ago)
Branches:
Children:
84ac3f1
Parents:
943e17a
Message:

Clarify use of chi2 in GUI and documentation

Changed Gui name and tooltip to reflect we are using reduced chi2 not
simply Chi
2/Npts. Also edited the documenataion to finish making that
clear and in the process cleaned up a few old (i.e. incorrect)
statements.

File:
1 edited

### Legend:

Unmodified
 r99ded31 $\chi^2$ is a statistical parameter that quantifies the differences between an observed data set and an expected dataset (or 'theory'). When showing the a model with the data, *SasView* displays this parameter normalized to the number of data points, $N_\mathrm{pts}$ such that an observed data set and an expected dataset (or 'theory') calculated as .. math:: \chi^2_N =  \sum[(Y_i - \mathrm{theory}_i)^2 / \mathrm{error}_i^2] / N_\mathrm{pts} \chi^2 =  \sum[(Y_i - \mathrm{theory}_i)^2 / \mathrm{error}_i^2] When performing a fit, *SasView* instead displays the reduced $\chi^2_R$, which takes into account the number of fitting parameters $N_\mathrm{par}$ (to calculate the number of 'degrees of freedom'). This is computed as Fitting typically minimizes the value of $\chi^2$.  However, for assessing the quality of the model and its "fit" this parameter is not terribly helpful on its own.  Thus *SasView* instead displays a normalized version of this parameter, using the traditional reduced $\chi^2_R$.  This is the $\chi^2$ divided by the degrees of freedom (or DOF). The DOF is simply the number of data points being considered reduced by the number of free (i.e. fitted) parameters. Note that model parameters that are kept fixed do *not* contribute to the DOF (they are not"free". This reduced value is then given as .. math:: / [N_\mathrm{pts} - N_\mathrm{par}] The normalized $\chi^2_N$ and the reduced $\chi^2_R$ are very close to each other when $N_\mathrm{pts} \gg N_\mathrm{par}$. where $N_\mathrm{par}$ is the number of *fitted* parameters. Note that this means the displayed value will vary depending on the number of parameters used in the fit.  In particular, when doing a calculation without a fit (e.g. manually changing a parameter) the DOF will now equal $N_\mathrm{pts}$ and the $\chi^2_R$ will be the smallest possible for that combination of model, data set and set of parameter values. When $N_\mathrm{pts} \gg N_\mathrm{par}$ as it should for proper fitting, the value of the reduced $\chi^2_R$ will not change very much. For a good fit, $\chi^2_R$ tends to 1.