[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: curve fitting: works badly?

vek@spacsun.rice.edu (Vincent E. Kargatis) writes:

>This is great (really).  But has anyone done a (linear) curvefit that
>includes both X and Y errors?  A much harder problem, but much more
>realistic (c'mon, the Real World's *fun*)!  NUMERICAL RECIPES has one for
>linear fitting (ch. 15.3), but not for non-linear (no surprise, since it's
>probably nigh impossible).  I don't suppose anyone has translated the NR
>routine into IDL?

I think the IDL Goddard Astronomy Library has IDL code to do linear
curvefit with x and y errors. See the IDL FAQ for how to get to the
library. I don't have the library information handy (but Bill Thompson
might :) ).

>Also, why does CURVEFIT want weights instead of errors?  W = 1/(sig_y)^2.
>Whose datasets give them weights?  Mine all give me errors!   :-)

Mine too! 

Seriously, my understanding of why weights instead of errors
is because:

1) Bevington did it that way.
2) It has a precise mathematical definition that can be implemented
easily in least-squares algorithms.
2) There are several different kinds of errors (i.e. instrumental,
statistical, etc. See Bevington for a good discussion of error analysis).

Speaking of errors, if you have criteria for checking whether a fit is
good, looking at the sigma of the output fit parameters is sometimes
not enough because the parameters are correlated to each other. That's
why I added a covariance output matrix to my version of CURVEFIT that
quantitatively describes the correlated variances between the fit
parameters. See my previous post on the Marquardt-Levenberg thread
here on how to do this.



Amara Graps			email: agraps@netcom.com
Computational Physicist         vita: finger agraps@sunshine.arc.nasa.gov
Intergalactic Reality           bio: finger -lm agraps@netcom.com
"Awaken the mind without fixing it anywhere."  --Kungo Kyo