# How to compute errors from a fit?

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?

• en.wikipedia.org/wiki/Propagation_of_uncertainty
– Ed V
Mar 31, 2022 at 20:21
• 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. Mar 31, 2022 at 20:50
• 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. Mar 31, 2022 at 21:54
• 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 Mar 31, 2022 at 22:39

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.