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

Home » Public Forums » archive » Re: the problem of PERROR in MPFITFUN
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
Re: the problem of PERROR in MPFITFUN [message #53076] Thu, 15 March 2007 08:36
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
"duxiyu@gmail.com" <duxiyu@gmail.com> writes:

> In my work, independent variable X is time and measured dependent
> variable Y is magnetic field. The instrument do not give the measured
> error.
> Do I use 1 in MPFITFUN for errors of Y?
> Is the PERROR useless at this time?

Also, I recommend that you consult,
http://cow.physics.wisc.edu/~craigm/idl/mpfittut.html
and the citation to Bevington, Chapter 6.4.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
Re: the problem of PERROR in MPFITFUN [message #53077 is a reply to message #53076] Thu, 15 March 2007 08:34 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:
> In my work, independent variable X is time and measured dependent
> variable Y is magnetic field. The instrument do not give the measured
> error.

Adding to what Kuyper said... do you have no uncertainty estimate of
the magnetic field? I would guess that your instrument has been
calibrated, and the calibration information should provide an estimate
of the uncertainties.

The chi^2 value (i.e. BESTNORM) provides a measure of goodness of fit,
*if* you have estimated the measurement uncertainties properly.

OR, *if* the fit is known to be good, then the chi-square provides an
estimate of the measurement uncertainties.

Good luck,
Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
Re: the problem of PERROR in MPFITFUN [message #53079 is a reply to message #53077] Thu, 15 March 2007 08:31 Go to previous message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Mar 15, 4:17 am, "dux...@gmail.com" <dux...@gmail.com> wrote:
> In my work, independent variable X is time and measured dependent
> variable Y is magnetic field. The instrument do not give the measured
> error.
> Do I use 1 in MPFITFUN for errors of Y?
> Is the PERROR useless at this time?
>
> I do not understand the following paragraph in the instructions of
> MPFITFUN.
> Who can give me some explanations for it?
>
> ; *If* you can assume that the true reduced chi-squared
> ; value is unity -- meaning that the fit is implicitly
> ; assumed to be of good quality -- then the estimated
> ; parameter uncertainties can be computed by scaling PERROR
> ; by the measured chi-squared value.
> ;
> ; DOF = N_ELEMENTS(X) - N_ELEMENTS(PARMS) ; deg of
> freedom
> ; PCERROR = PERROR * SQRT(BESTNORM / DOF) ; scaled
> uncertainties
>
> Best regards,
> Du Jian

Can you estimate the instrument error, say from a "just noise" signal,
or part of the signal?
Re: the problem of PERROR in MPFITFUN [message #53084 is a reply to message #53079] Thu, 15 March 2007 07:44 Go to previous message
James Kuyper is currently offline  James Kuyper
Messages: 425
Registered: March 2000
Senior Member
duxiyu@gmail.com wrote:
> In my work, independent variable X is time and measured dependent
> variable Y is magnetic field. The instrument do not give the measured
> error.
> Do I use 1 in MPFITFUN for errors of Y?
> Is the PERROR useless at this time?
>
> I do not understand the following paragraph in the instructions of
> MPFITFUN.
> Who can give me some explanations for it?
>
> ; *If* you can assume that the true reduced chi-squared
> ; value is unity -- meaning that the fit is implicitly
> ; assumed to be of good quality -- then the estimated
> ; parameter uncertainties can be computed by scaling PERROR
> ; by the measured chi-squared value.
> ;
> ; DOF = N_ELEMENTS(X) - N_ELEMENTS(PARMS) ; deg of
> freedom
> ; PCERROR = PERROR * SQRT(BESTNORM / DOF) ; scaled
> uncertainties

To do proper curve fitting, you need error estimates for your data
points. Using those error estimates, the reduced chi-squared value
will typically be around 1.0 or better for a good fit; if it's much
large than 1.0, you've probably got a poor fit and should try a
different model function. If it is a good fit, the rate of change in
the chi-squared function with respect to a change in a parameter
estimate gives you a measure of how precisely determined that
parameter is by this data set.

However, it's not uncommon to have no easy way to estimate the errors.
This is a bad idea, and you should always try to fix it by coming up
with a proper error estimate. However, if you're willing to assume
that a) all the data points have exact the same error estimate and b)
that the fit is a good one, then it is possible to calculate what
error estimate would give you a chi-squared value of exactly 1.0.
Using that error estimate will then allow calculation of the
uncertainties in the parameter estimates.
This approach should not be used unless you have no alternative: it
gives you no feedback to indicate whether or not you've got a good
match between your model and the data that you are fitting it to.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: change colors of IDL shell on OS X?
Next Topic: Re: :_(x,y,z)_

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

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

Total time taken to generate the page: 0.00713 seconds