Skip to content

Fit

Interactive curve fitting for Linux, Windows and macOS

User guide

Losses

R-factor

This software's choice — A decision made by this software rather than by the field's sources; the explanation says why it was made.

Squared deviations normalised by the data, so values are comparable between datasets.

Over the points inside the fit intervals it is

R = sum( (s * calc - obs)^2 ) / ( sum obs )^2

where obs is a measured value, calc the model's value at the same point and s the curve-scaling factor (1 when curve scaling is off).

Dividing by an integral makes it a relative measure: the same sample measured for ten times as long scores the same. It divides by the integral of the DATA, which does not change while the fit runs, as the profile R-factors of Rietveld refinement do; so the value cannot be lowered by changing the model's scale instead of its shape.

It differs from Sum of squares only by the constant factor (sum obs)^2, so the two find the same parameters; this is ordinary least squares, which is why another engine that minimises squared residuals can run it.

It is the default, and kind 0 on purpose: what an unconfigured fit task gets should be the objective chosen, not merely the oldest.

Limitations

Sources

See also: Sum of squares · R-factor (legacy) · Relative deviation

R-factor (legacy)

This software's choice — A decision made by this software rather than by the field's sources; the explanation says why it was made.

The original objective. Normalised by the model rather than by the data, so with curve scaling on it can be lowered by inflating the model. Kept for comparison.

Over the points inside the fit intervals it is

R = sum( (s * calc - obs)^2 ) / ( sum calc )^2

It is this program's original objective, kept so the two forms can be compared. Its intent is the same as the R-factor's - a relative measure - but it divides by the integral of the MODEL.

For a good fit sum(calc) is close to sum(obs), so the choice looks immaterial, which is why it stood for years. With curve scaling on it is not: the engine then sets s = (sum obs) / (sum calc), which makes the numerator unchanged by the model's amplitude while the denominator still grows with it. The value can then be lowered by inflating the model, along a direction that does nothing for the agreement with the data.

That is why it is greyed for a curve type whose amplitude is free to grow, and why it is replaced by the R-factor if it was selected.

Limitations

See also: R-factor

Sum of squares

Convention — Common practice or a guideline in the field, not a rule its sources require.

Plain least squares, with no normalisation at all - the value scales with the data, so compare it only within one dataset.

Over the points inside the fit intervals it is

S = sum( (s * calc - obs)^2 )

Least squares is the usual objective for fitting a model to data whose errors are independent and of equal size; it is the maximum-likelihood choice when they are Gaussian. It is a convention of the field, not a requirement.

It is minimised by the same parameters as the R-factor, which differs from it only by the constant (sum obs)^2. It is offered for interpretability: the value is in the units of the data squared.

Limitations

Sources

See also: R-factor

Relative deviation

Convention — Common practice or a guideline in the field, not a rule its sources require.

Absolute deviations as a fraction of the data - reads directly as "the model is off by this much".

Over the points inside the fit intervals it is

D = sum( |s * calc - obs| ) / sum( |obs| )

It is the form of the profile R-factor Rp of Rietveld refinement: absolute deviations over the observed magnitude. It reads directly as the fraction by which the model is off, and, since it does not square the deviations, a few large misfits count for less than they do in a squared measure.

Absolute deviations are not a sum of squares, so an engine that minimises squared residuals cannot run it; the fit runs on the built-in engine instead.

Limitations

Sources

See also: R-factor