# Best way to estimate a coefficient when data have errors

I am a little bit confused about some tecniques concerning error-analysis.Consider this situatiuon:

During an experiment I collected a $x,y$ table of data that are expected to satisfy a linear relation $y=kx$. For any $x_i$ I have an associated error/uncertainty $\delta x_i$ and the same applies to the $y_i$'s. What is the best thing to do in order to have a good estimate of the parameter $k$ and the associated error $\delta k$?

1. Maybe compute $k_i=y_i/x_i$ and compute the maximal error $\delta k_i$ with the error propagation furmula for division, then compute some kind of weighted average the $k_i$ according to the size of the $\delta k_i$? What would be a good estimate for $\delta k$ then?

2. Or compute $k$ that minimizes $\sum_i (kx_i-y_i)^2$ with standard least square tecniques, i.e. $k=\frac{\sum y_ix_i}{\sum x_i^2}$ and compute $\delta k$ with the error propagation forumlas and add the additional error due to least square approximation?

Or something else?

• It depends on how your errors are distributed. If they follow a normal distribution, then the best predictor for the constant are given by a least-mean square fit, if the errors are not normally distributed, then they are not. – CuriousOne Jul 19 '16 at 15:01
• If you have measurement errors in both your $x$'s and $y$'s, then you want an "errors-in-variables" model – Paul T. Jul 19 '16 at 15:15
• This might get more attention/answers on the statistics SE. – knzhou Jul 19 '16 at 16:50

During an experiment I collected a $x,y$ table of data that are expected to satisfy a linear relation $y=kx$. For any $x_i$ I have an associated error/uncertainty $\delta x_i$ and the same applies to the $y_i$'s. What is the best thing to do in order to have a good estimate of the parameter $k$ and the associated error $\delta k$?
• @MarcoDisce, Often the errors in the independent variable are small enough (or can be improved by better experimental technique) so we can ignore them and just use ordinary least squares. If the $\delta{}x$ are small you won't see much different between the OLS and TLS results. – The Photon Jul 19 '16 at 17:27