routine for geometric mean regression [message #28278] |
Fri, 30 November 2001 13:40  |
john.b.miller
Messages: 2 Registered: November 2001
|
Junior Member |
|
|
I've searched the various online libraries to no avail...
Does anyone know of or have a geometric mean regression routine?
I have the routine 'fitexy.pro' and am aware of the IDL version of
ODRpack. These do what I need (fit a line with errors in y AND x), but
I'd like to compare these with the geometric mean approach.
Thanks
|
|
|
Re: routine for geometric mean regression [message #28368 is a reply to message #28278] |
Sun, 02 December 2001 21:47  |
Wayne Landsman
Messages: 117 Registered: January 1997
|
Senior Member |
|
|
John Miller wrote:
> Does anyone know of or have a geometric mean regression routine?
>
> I have the routine 'fitexy.pro' and am aware of the IDL version of
> ODRpack. These do what I need (fit a line with errors in y AND x), but
> I'd like to compare these with the geometric mean approach.
If I understand what you mean by "geometric mean" correctly, then the
following 3 lines of IDL should do it. I assume you have data (X,Y)
with corresponding error bars SIGX and SIGY
resulty = linfit(x,y,sdev = sigy) ;Fit Y vs. X using Y error
bars
resultx = linfit(y,x,sdev = sigx) ;Fit X vs. Y using X error
bars
slope = sqrt(resulty[1]/resultx[1]) ;Take geometric mean of two slope
determinations
But, as you note, the correct way to fit a straight line with errors in
both coordinates is given by the procedure
http://idlastro.gsfc.nasa.gov/ftp/pro/math/fitexy.pro
Wayne Landsman landsman@mpb.gsfc.nasa.gov
|
|
|