error estimation in a non-linear least squares fitting

E

Evelien

Dear python-users,

I am trying to do a non-linear least squares fitting. Maybe trying is
not the best word, as I already succeeded in that. At the moment I am
using leastSquaresFit from Scientific Python. I know of other least
squares routines, such as the one in scipy.optimize and I believe
there is also one in numpy. Now here is my question: in my search for
a good algorithm, I was not able to find any non-linear least squares
fitting routine which in the end doesn't only give me the parameters
which I asked for, but also the estimated errors on these parameters.
Is there anyone who can help me getting these errors?

Thanks in advance,
Evelien
 
R

Robert Kern

Evelien said:
Dear python-users,

I am trying to do a non-linear least squares fitting. Maybe trying is
not the best word, as I already succeeded in that. At the moment I am
using leastSquaresFit from Scientific Python. I know of other least
squares routines, such as the one in scipy.optimize and I believe
there is also one in numpy. Now here is my question: in my search for
a good algorithm, I was not able to find any non-linear least squares
fitting routine which in the end doesn't only give me the parameters
which I asked for, but also the estimated errors on these parameters.
Is there anyone who can help me getting these errors?

In scipy SVN, scipy.optimize.leastsq() will also return a covariance matrix of
the estimate if using full_output=True.

--
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
 
E

Evelien

Thanks Robert for your reply. I must say I am kind of disappointed if
that is the only solution. I thought that such a standard problem as
least squares fitting, would always give you an estimation of the
error bars, without having to look up how you can convert a covariance
matrix into error bars...

But thanks anyway.
Evelien
 
R

Robert Kern

Evelien said:
Thanks Robert for your reply. I must say I am kind of disappointed if
that is the only solution. I thought that such a standard problem as
least squares fitting, would always give you an estimation of the
error bars, without having to look up how you can convert a covariance
matrix into error bars...

If you want an all-singing, all-dancing statistics-oriented nonlinear
least-squares interface, you can use scipy.odr. The numerical algorithm in
leastsq() outputs a covariance matrix naturally. Interpreting that to give you
statistical error bars requires some care and judgment. scipy.optimize is not a
statistical package.

--
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
 
E

Evelien

Ok, then I have to look into scipy.odr to see how it can help me move
forward. Thanks Robert!
Evelien
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top