[SciPy-user] odr weighted residuals

Robert Kern robert.kern at gmail.com
Wed Aug 16 11:05:35 CDT 2006


Christian Kristukat wrote:
> Robert Kern wrote:
>> Christian Kristukat wrote:
>>> Hi,
>>> this is probably a question for Robert but other people might be interested in
>>> this as well, so here it goes:
>>>
>>> Does odr support weighted residuals such that data points which are far away
>>> from the bulk of points have small weights?
>> Nope. Whatever else ODR is, it's still least-squares. In order to do what you 
>> want, you will have to resort to iterated reweighting (Google for algorithms) or 
>> some other scheme that is built on top of least-squares. Or you can construct 
>> the appropriate non-linear optimization problem directly and use one of the 
>> fmin*() functions.
> 
> Ok, thanks. I think I'll better remove the bad data points, but just for
> curiosity: when using optimize.leastsq you have to provide the residuals. Can't
> odr modified to calculate the residuals externally or would that break the
> algorithm?

It sort of breaks the algorithm of optimize.leastsq(), too. And no, it can't. 
One of the things that ODR does for you is calculate the minimum orthogonal 
distance (residual) from your data points and the function. If you could 
calculate those orthogonal residuals, you wouldn't need ODRPACK; you could just 
use optimize.leastsq().

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco


More information about the SciPy-user mailing list