I have a set of data with errors, how do I compute the error for the fit $f(x)=a$?

I remember there are formulas for the errors in parameters for fit $f(x)=ax+b$, i.e. $\delta a$ and $\delta b$. Where can I find these kind of formulas?

  • $\begingroup$ en.wikipedia.org/wiki/Propagation_of_uncertainty $\endgroup$
    – Ed V
    Mar 31, 2022 at 20:21
  • 1
    $\begingroup$ Usually software packages that compute the fits for you (e.g., numpy, R, etc) will return also standard errors. You might also be interested in Cross Validated for better guidance on that. $\endgroup$
    – Kyle Kanos
    Mar 31, 2022 at 20:50
  • $\begingroup$ I like the text Data Analysis for Scientists and Engineers by Meyer. He explains the assumptions for different relationships, such as independence, linear dependence (correlation), and the use of a Taylor series expansion with higher terms either zero or assumed small. $\endgroup$
    – John Darby
    Mar 31, 2022 at 21:54
  • 1
    $\begingroup$ There's are whole books written about how to estimate the uncertainty on parameters in a fit. I am guessing(?) you want something simple, such as the error on linear regression coefficients if you assume Gaussian, homoskedastic uncertainty. There are lots of places you can find that case worked out, like here: web.stanford.edu/class/stats110/notes/Chapter7/Inference.html $\endgroup$
    – Andrew
    Mar 31, 2022 at 22:39

2 Answers 2


Since you know the errors $\sigma_i$ on the measurements $x_i$, one method is to write a $\chi^2(a) = \sum \frac{(x_i-a)^2}{\sigma_i^2}$, and minimize it with respect to $a$, providing an estimator $\hat{a}$, and a minimum $\hat{\chi^2}$. 68% confidence intervals on $a$ are then obtained by determining the values of $a$ for which $\chi^2 = \hat{\chi^2}+1$. In the case of your constant model, this can be done analytically.


There's no general formula for all functions, because the small-signal noise propogation requires that you know the sensitivity (a derivative), and... some functions aren't differentiable.

A general technique that works, is to add a dither function (a small random addition to all data points) scaled to be comparable to experimental error, and do a few dozens or hundreds of trial curve-fits to observe the results. This is a kind of Monte Carlo calculation.

A few operations (like a discrete Fourier transform) have known noise-propogation properties that are simple. Others (like determination of phase by taking arctangent of a ratio) have singlularities (nondifferentiable at some values).

It is always possible, in a multivariate fit, to add one more variable and find that the data cannot solve for that particular unknown. Just as you may need five data points to find five unknowns, you may have five data points but no unique solution for all five unknowns. The error sensitivity, if two solutions are possible, is formally infinite.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.