Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am writing a program that inputs a sequence of points $(x_i,y_i)$ based on the user clicking on certain pixels in an image shown. The program should then find the "best -fitting" line in the least squares sense to the set of points received. However, I must account for error in both the $x$ and $y$ variables based on the fact that the user is not exact in his/her clicking, and I must weight the points with predetermined weights $w_i$ based on how important they are in determining the line.

What is the most accurate way of computing the line in this case?

share|cite|improve this question
Weighted linear least-square fitting is a well kwown topic, eg – leonbloy Jul 8 '11 at 16:35
@leonbloy, Thanks for the link, but does that method account for error in both variables? And what will be my variance-covariance matrix in this case? – jake Jul 8 '11 at 16:39
Traditional least squares fixed a "indepentent" variable and seeks to minimize the squared error in the "dependent" variable. That's often reasonable. You can also try (a little more complex) "Total least squares" – leonbloy Jul 8 '11 at 16:47
Here's a different take on it in response to a previous question:… – joriki Jul 8 '11 at 16:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.