<commit_before>.. residuals_help.rst


.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ

.. _Assessing_Fit_Quality:

Assessing Fit Quality
---------------------

When performing model-fits to some experimental data it is helpful to be able to
gauge how good an individual fit is, how it compares to a fit of the *same model*
*to another set of data*, or how it compares to a fit of a *different model to the*
*same data*.

One way is obviously to just inspect the graph of the experimental data and to
see how closely (or not!) the 'theory' calculation matches it. But *SasView*
also provides two other measures of the quality of a fit:

*  $\chi^2$ (or 'Chi2'; pronounced 'chi-squared')
*  *Residuals*

.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ

Chi2
^^^^

Chi2 is a statistical parameter that quantifies the differences between an observed
data set and an expected dataset (or 'theory').

*SasView* actually returns this parameter normalized to the number of data points,
*Npts* such that

.. math::

  \chi^2/N_{pts} =  \sum[(Y_i - Y_{theory}_i)^2 / (Y_error_i)^2] } / N_{pts}

This differs slightly from what is sometimes called the 'reduced $\chi^2$'
because it does not take into account the number of fitting parameters (to
calculate the number of 'degrees of freedom'), but the 'normalized $\chi^2$
and the 'reduced $\chi^2$ are very close to each other when $N_{pts} \gg
\text{number of parameters}.

For a good fit, $\chi^2/N_{pts}$ tends to 1.

$\chi^2/N_{pts}$ is sometimes referred to as the 'goodness-of-fit' parameter.

.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ

Residuals
^^^^^^^^^<commit_msg>removed excess bracket<commit_after>.. residuals_help.rst


.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ

.. _Assessing_Fit_Quality:

Assessing Fit Quality
---------------------

When performing model-fits to some experimental data it is helpful to be able to
gauge how good an individual fit is, how it compares to a fit of the *same model*
*to another set of data*, or how it compares to a fit of a *different model to the*
*same data*.

One way is obviously to just inspect the graph of the experimental data and to
see how closely (or not!) the 'theory' calculation matches it. But *SasView*
also provides two other measures of the quality of a fit:

*  $\chi^2$ (or 'Chi2'; pronounced 'chi-squared')
*  *Residuals*

.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ

Chi2
^^^^

Chi2 is a statistical parameter that quantifies the differences between an observed
data set and an expected dataset (or 'theory').

*SasView* actually returns this parameter normalized to the number of data points,
*Npts* such that

.. math::

  \chi^2/N_{pts} =  \sum[(Y_i - Y_{theory}_i)^2 / (Y_error_i)^2] / N_{pts}

This differs slightly from what is sometimes called the 'reduced $\chi^2$'
because it does not take into account the number of fitting parameters (to
calculate the number of 'degrees of freedom'), but the 'normalized $\chi^2$
and the 'reduced $\chi^2$ are very close to each other when $N_{pts} \gg
\text{number of parameters}.

For a good fit, $\chi^2/N_{pts}$ tends to 1.

$\chi^2/N_{pts}$ is sometimes referred to as the 'goodness-of-fit' parameter.

.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ

Residuals
^^^^^^^^^
{'fraction_non_alphanumeric': 0.10014513788098693, 'fraction_numerical': 0.007547169811320755, 'mean_word_length': 4.50479233226837, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 6, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5146981', 'n_tokens_mistral': 1173, 'n_tokens_neox': 1124, 'n_words': 432}