WOLFRAM COMMUNITY
Connect with users of Wolfram technologies to learn, solve problems and share ideas
Join
Sign In
Dashboard
Groups
People
Group Abstract
Message Boards
Answer
(
Unmark
)
Mark as an Answer
WOLFRAM COMMUNITY
Dashboard
Groups
People
0
|
2.5K Views
|
3 Replies
|
3 Total Likes
View groups...
Follow this post
Share
Share this post:
GROUPS:
Mathematics
Mathematica
Minimizing distance (not square of distance) of linear fit to data points
Gustav Fredell
Gustav Fredell
Posted
12 years ago
Hi all,
I have a set of data {x1, y1}, {x2, y2}...
Is it possible to fit a regression line to this data that minimizes the total distance from the line to my data points? This would be better than Least-Squares in this instance.
Thank you
POSTED BY:
Gustav Fredell
Reply
|
Flag
3 Replies
Sort By:
Replies
Likes
Recent
2
Daniel Lichtblau
Daniel Lichtblau, Wolfram Research
Posted
12 years ago
From the wording it appears that you are looking for a "total least squares" result. That can be done using the singular values decomposition.
POSTED BY:
Daniel Lichtblau
Reply
|
Flag
1
Gustav Fredell
Gustav Fredell
Posted
12 years ago
I think I solved the problem myself by using:
FindFit[{dataset}, a + b x, {a, b}, x, NormFunction -> (Norm[#, Infinity] &)]
Thanks for looking.
POSTED BY:
Gustav Fredell
Reply
|
Flag
0
Sander Huisman
Sander Huisman, University of Twente
Posted
12 years ago
Gustace, I don't think it will take into account the 'horizontal' difference, only the vertical distance. Calculating the closest distance to a line is a little tricky, but can be done of course.
POSTED BY:
Sander Huisman
Reply
|
Flag
Reply to this discussion
in reply to
Add Notebook
Community posts can be styled and formatted using the
Markdown syntax
.
Tag limit exceeded
Note: Only the first five people you tag will receive an email notification; the other tagged names will appear as links to their profiles.
Publish anyway
Cancel
Reply Preview
Attachments
Remove
Add a file to this post
Follow this discussion
or
Discard
Be respectful. Review our
Community Guidelines
to understand your role and responsibilities.
Community Terms of Use
Feedback