Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
CalculateChiSquared-v1.rst 5.46 KiB

Description

Calculates a measure of the goodness of a fit in four ways.

The ChiSquared property returns the sum of squares of differences between the calculated and measured values:

\chi_{1}^{2} = \sum_{i} (y_i - f_i)^2

where y_i and f_i are the measured and calculated values at i-th point.

The ChiSquaredDividedByDOF is ChiSquared divided by the number of degrees of freedom (DOF):

\chi_{2}^{2} = \frac{1}{DOF}\sum_{i} (y_i - f_i)^2

DOF = N_d - N_p where N_d is the number of data points used in fitting and N_p is the number of free (not fixed or tied) parameters of the function.

The ChiSquaredWeighted property sums the squares of the differences divided by the data errors:

\chi_{3}^{2} = \sum_{i} \left(\frac{y_i - f_i}{\sigma_i}\right)^2

Finally, ChiSquaredWeightedDividedByDOF is

\chi_{4}^{2} = \chi_{3}^{2} / DOF

Parameter errors

Setting the Output property to a non-empty string makes the algorithm explore the surface of the \chi^{2} around its minimum and estimate the standard deviations for the parameters. The value of the property is a base name for two output table workspaces: '<Output>_errors' and '<Output>_pdf'. The former workspace contains parameter error estimates and the latter shows \chi^{2}'s 1d slices along each parameter (keeping all other fixed).

The error table has the following columns:

Column Description
Parameter Parameter name
Value Parameter value passed with the Function property
Value at Min The minimum point of the 1d slice of the \chi^{2}. If the Function is at the minimum then Value at Min should be equal to Value.
Left Error The negative deviation from the minimum point equivalent to 1\sigma. Estimated from analisys of the surface.
Right Error The positive deviation from the minimum point equivalent to 1\sigma. Estimated from analisys of the surface.
Quadratic Error 1\sigma standard deviation in the quadratic approximation of the surface.
Chi2 Min The value of \chi^{2} at the minimum relative to the test point.

The pdf table contains slices of the \chi^{2} along each parameter. It has 3 column per parameter. The first column of the 3 is the parameter values, the second has the \chi^{2} and the third is the probability density function normalised to have 1 at the maximum.

Usage

Example 1

Output:

Example 2