[SciPy-user] Numerical Recipes robust fit implementation

Angus McMorland amcmorl@gmail....
Mon Jul 16 06:01:16 CDT 2007

Hi Andrew et al.,

> Angus McMorland wrote:
> > I'm in need of a robust linear-fit algorithm- Numerical Recipes (in C)
> > medfit routine will do nicely. I've had a quick look and don't see any
> > similar routines in scipy. Is there one I'm missing?

On 16/07/07, Andrew Straw <strawman@astraw.com> wrote:
> I don't know if the MEDFIT algorithm is something you really want, but I
> wrote a simple implementation of the RANSAC algorithm:
> http://www.scipy.org/Cookbook/RANSAC
> This is not to say I recommend the use of such algorithms as RANSAC! :)
> -Andrew
> PS There seems to be some criticism of the MEDFIT algorithm in general
> and as implemented in NR in particular online.

Thanks for the heads up on those issues. I've had a quick google on
this myself now and found this
(http://www.lysator.liu.se/c/num-recipes-in-c.html) comment verbatim
several times on different websites  - someincluding mention that the
discussion refers to the first edition and some not. According to NR
(http://www.nr.com/bug-rebutt.htm - seems a little melodramatically
worded in places) in the second edition they've addressed issues
raised about medfit.

I'm going to have to think a bit more what I want to achieve to see if
RANSAC is useful. Ultimately I hope to determine the probability of a
a given data set being exponentially distributed, by comparing the raw
frequency distribution to an expected distribution based on a linear
fit to the log transform of the raw one. It seems a bit like basing my
'expected' distribution on a subset of data from which outliers have
been completely excluded is self-fulfilling, and having some other
criterion for weighting of the error term (as medfit does) seems more
appropriate. This is however very much just a gut feeling rather than
an educated assessment, so any other comments are welcome.

It certainly is useful to know the RANSAC algorithm exists, so thanks for that.

Thanks again,

AJC McMorland, PhD Student
Physiology, University of Auckland

More information about the SciPy-user mailing list