Re: xerr [message #64345 is a reply to message #64276] |
Thu, 18 December 2008 21:43   |
ed.schmahl
Messages: 11 Registered: October 2008
|
Junior Member |
|
|
On Dec 18, 8:24 pm, Craig Markwardt <cbmarkwa...@gmail.com> wrote:
> On Dec 17, 5:08 pm, Paolo <pgri...@gmail.com> wrote:
>
>> This is discussed for example in
>> section 15.3 in edition 3 of the book
Orthogonal least squares, as in finding the line with minimum squared
distance from a set of points (x,y), where x and y are on an equal
footing, is an eigenvalue problem, and therefore not within the
province of MPFIT. Just try googling "least square distance" to find
oodles of info about this problem.
However, a working IDL program that finds the orthogonal solution a*x
+b*y=d, where x and y are on an equal footing, may be found at
http://hesperia.gsfc.nasa.gov/~schmahl/pro/lst_sq_dist_line. pro.
The least square plane a*x+b*y+c*z=d is just as readily found using a
similar program: http://hesperia.gsfc.nasa.gov/~schmahl/pro/lst_sq_plane.pro
Both of these programs were converted to IDL from a Fortran program so
old its origin is lost in the mists of time.
In each case (2D or 3D), the eigenvector with minimum eigenvalue found
by this program is perpendicular to the line (or plane) and the
eigenvalue is the sum of the squares of the distances of the points
from the line.
Adding a subroutine that computes the sigmas for x and y is an
exercise for the reader.
Ed Schmahl
CoRA, Boulder, CO
> "numerical recipes".
>
> I've used the Numerical Recipes hack for X errors successfully before.
>
> As mentioned, orthogonal distance regression is the real way to do
> this, but unfortunately MPFIT does not support this. [ It could in
> principle with a lot of work, but doesn't in practice. ]
>
> Craig
|
|
|