comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Problems in non-linear fitting
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Problems in non-linear fitting [message #52990] Thu, 15 March 2007 02:04 Go to next message
duxiyu@gmail.com is currently offline  duxiyu@gmail.com
Messages: 88
Registered: March 2007
Member
I am using the MPFITFUN for curve-fittin.
It is easy and effectual.
But I have some confused points in using it.

Could it give a value which can measure the quality of fiting?
For example, if you do a linear fiting, you can caculate the R^2 to
measure the quality of fiting.
This R maybe is the correlate cofficient between Y and Yfit. (I am not
sure for this. if you know how the R is caculated, please tell me.)
I do not know whether the R^2 can describe the quality of non-linear
fiting.
Becasuse when I select the different starting values of the parameters
to fit, I get the different results, I need a parameter to determine
which result is best.
If it not, I want to find a new parameter which can meet my request.

Best regards,
Du Jian
Re: Problems in non-linear fitting [message #53081 is a reply to message #52990] Thu, 15 March 2007 08:30 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
"duxiyu@gmail.com" <duxiyu@gmail.com> writes:
> I am using the MPFITFUN for curve-fittin.
> It is easy and effectual.
> But I have some confused points in using it.
>
> Could it give a value which can measure the quality of fiting?
> For example, if you do a linear fiting, you can caculate the R^2 to
> measure the quality of fiting.
> This R maybe is the correlate cofficient between Y and Yfit. (I am not
> sure for this. if you know how the R is caculated, please tell me.)
> I do not know whether the R^2 can describe the quality of non-linear
> fiting.

R does not necessarily measure the quality of fit, but rather the
degree of *linear* correlation between two variables. Thus, it is
only appropriate for linear fitting.

The chi^2 statistic is more commonly used for non-linear fitting; see
the BESTNORM parameter of MPFIT & MPFITFUN.


> Becasuse when I select the different starting values of the parameters
> to fit, I get the different results, I need a parameter to determine
> which result is best.
> If it not, I want to find a new parameter which can meet my request.

You may be getting different solutions for two different reasons that
I can think of. One possibility is that there are multiple local
minima. In that case, MPFIT is not the best method; perhaps monte
carlo or simulated annealing would be more appropriate.

Another possibility is that you are using the automatic derivatives,
but MPFIT is varying the parameters by too little to calculate an
accurate derivative. In that case you should use the PARINFO
parameter with the STEP or RELSTEP fields, to declare a step size to
use for derivatives.

Good luck,
Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
Re: Problems in non-linear fitting [message #53082 is a reply to message #52990] Thu, 15 March 2007 08:25 Go to previous message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Mar 15, 4:04 am, "dux...@gmail.com" <dux...@gmail.com> wrote:
> I am using the MPFITFUN for curve-fittin.
> It is easy and effectual.
> But I have some confused points in using it.
>
> Could it give a value which can measure the quality of fiting?
> For example, if you do a linear fiting, you can caculate the R^2 to
> measure the quality of fiting.
> This R maybe is the correlate cofficient between Y and Yfit. (I am not
> sure for this. if you know how the R is caculated, please tell me.)
> I do not know whether the R^2 can describe the quality of non-linear
> fiting.
> Becasuse when I select the different starting values of the parameters
> to fit, I get the different results, I need a parameter to determine
> which result is best.
> If it not, I want to find a new parameter which can meet my request.
>
> Best regards,
> Du Jian

Read the "header" of the mpfitfun.pro file. Especially look for the
PERROR keyword.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: The spectra of fluctuations in variable
Next Topic: change colors of IDL shell on OS X?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 14:01:04 PDT 2025

Total time taken to generate the page: 0.00596 seconds