Problems in non-linear fitting [message #52990] |
Thu, 15 March 2007 02:04  |
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  |
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  |
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.
|
|
|