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

Home » Public Forums » archive » Re: How to determine the WEIGHTS in MPFITFUN for distribution function fit?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: How to determine the WEIGHTS in MPFITFUN for distribution function fit? [message #55833 is a reply to message #55764] Mon, 10 September 2007 22:21 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:

> On 9 7 , 2 26 , Craig Markwardt
> <craigm...@REMOVEcow.physics.wisc.edu> wrote:
>>
>> If Y is measured counts, then the YERR should be ~ SQRT(Y), right?
>>
>> But overall I agree, the original poster needs to specify how the
>> numbers were measured in order to estimate the measurement error.
>>
>> Craig
>>
>
> The effect of Yerr=SQRT(Y) is the same as the effect of WEIGHTS=1/y
> for the procedure MPFITFUN, isn't it?

Yes.

> The array named D in IDL means the original mesured data.
> Y = histogram ( D, locations = X )
> I want use a specified function to fit this curve in the x-y plane.
> The computed function is the distribution function for the measured
> data D, isn't it?

Yes, that's one way of thinking of it.

> If there are not the measurement errors for the data D, I should set
> the Yerr = SQRT(Y) when I use the MPFITFUN to fit the curve.
> If there ara the measurement errors Derr which have the same
> dimensions as the data D, how do I caculate the Yerr?

I don't know. For HISTOGRAM() either the point falls within a bin or
it does not. If your "D" has measurement errors, the bin assignment
becomes ambiguous. This is usually solved with Monte Carlo methods
and some kind of probability matrix.

> The another question is how to determine the START_PARAMS in the
> procedure MPFITFUN?

That is up to you. As I point out on my "tutorial" page, this is
somewhat of an art.

> When I use the matlab to fit the curve, the procedure can select the
> start_value automatically.

That sounds interesting, but I would not trust the automatic method.
There are an infinite number of model functions, and for each model,
there are an infinite number of parameterizations. How could 'matlab'
know about every one?

> The START_PARAMS in <PFITFUN must be given by user.
> The START_PARAMS is set to some values, and the procedure can return
> the results without any error.
> But when the START_PARAMS change a little, the procedurel gives the
> warning "Program caused arithmetic error: Floating illegal operand"
> and return the different results.
> I do not know the criterion of its selection.

MPFIT provides diagnostic information (STATUS and ERRMSG keywords),
and numerical errors can be trapped with !EXCEPT. These may help you
solve your problem. One possibility to consider is that there may be
a numerical problem if Y is zero (so YERR is also zero). In that
case, the Gaussian approximation underlying YERR ~ SQRT(Y) no longer
holds.

Good luck,
Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Call IDL (Virtual Machine) Save file from Java
Next Topic: Random problem with Delaunay triangulation

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

Current Time: Sat Oct 11 16:13:33 PDT 2025

Total time taken to generate the page: 0.56207 seconds