Curve fitting with measurement uncertainties
A measurement uncertainty describes how much a measured value could vary. A parameter uncertainty describes how precisely a fit has determined a quantity such as a slope, decay rate or peak position. They answer different questions: small error bars on individual points do not guarantee that every parameter is well determined.
This guide explains the assumptions behind the uncertainty choices in curve.fit. For instructions on entering values and selecting controls, see application Help.
What the error bars represent
For the usual least-squares interpretation, enter standard uncertainties: values representing one standard deviation, often written 1σ. A 95% interval, an instrument's resolution and a standard deviation are not interchangeable. Convert an interval only when you know the assumptions used to construct it.
If the reported value is an average of repeated observations, its uncertainty is usually the uncertainty of that average, not the spread of individual readings. Conversely, dividing an uncertainty by the square root of the number of readings is not justified for a shared calibration error.
The ordinary independent-error model assumes that one observation's error does not predict another's. A common zero offset or shared calibration factor can violate that assumption. Entering the same uncertainty on every row does not describe their correlation.
Which variables are uncertain?
With only y uncertainties, weighted least squares compares vertical residuals with their uncertainties. With uncertainties in x as well, curve.fit uses orthogonal distance regression, allowing for uncertainty in both coordinates. An x uncertainty can matter substantially on a steep part of a curve.
Selecting None tells the application not to use that uncertainty column. It does not establish that a physical measurement is exact. See weighted least squares for the y-only case.
Absolute or Nominal?
Both choices use the same selected measurement uncertainties as weights. They produce the same fitted parameters, residuals and goodness-of-fit statistic. The choice changes the reported parameter uncertainties and quantities derived from them.
Absolute means that the entered standard uncertainties establish the measurement-error scale. The fit propagates that scale to the parameters without estimating a replacement scale from the residuals. This is appropriate when the uncertainties have an independent basis and you intend to use their stated sizes.
Nominal means that you trust the relative sizes of the uncertainties but estimate a common multiplier from residual scatter. Compared with Absolute, the parameter standard uncertainties are multiplied by the square root of reduced chi-squared:
Here a is a fitted parameter. Nominal is the current default for every curve.fit model, including Weighted Mean. Without selected measurement uncertainties, parameter uncertainty is estimated from residual scatter; Absolute is unavailable.
At reduced chi-squared equal to one, the parameter uncertainties agree. That does not make every display identical: the model uncertainty bands for curve fits use different coverage multipliers in the two modes.
Why scaling the input uncertainties can be informative
Imagine fitting the same points twice, first with every y uncertainty equal to 0.1 and then with every y uncertainty equal to 1.0. The relative weights have not changed, so neither has the fitted line. Under Absolute, parameter uncertainties grow by a factor of ten. Under Nominal, residual rescaling cancels that common factor, and parameter uncertainties stay the same. These results express two different assumptions about what was known before fitting.
This is also the distinction behind SciPy's absolute_sigma option; it is not evidence that curve.fit uses SciPy's curve_fit function internally. SciPy documentation.
Read residuals before interpreting precision
Reduced chi-squared compares residual scatter with the selected uncertainty scale. A large value can arise from underestimated uncertainties, an unsuitable model, outliers or dependence between observations. A small value can arise from conservative uncertainties, chance or correlations. It is not a setting to tune until a model looks acceptable.
Neither option corrects a wrong model or incorporates missing systematic effects. Inspect the residual plot, check units and uncertainty estimates, and report which convention you used. A model uncertainty band describes the fitted mean response; it is not a prediction interval for a new measurement.
Next: weighted least squares · weighted mean.