Re: Problems getting CURVEFIT to work [message #32876 is a reply to message #32860] |
Fri, 15 November 2002 20:38   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
"Pavel A. Romashkin" <pavel_romashkin@hotmail.com> writes:
> Jonathan Greenberg wrote:
>>
>> Hello again Craig:
>>
>> You MPCURVEFIT function is terrific! I've started using it instead of
>> CURVEFIT. One quick question, how does it deal with NaN values? I started
>> including NaN values in my regressions, and I noticed some strange behavior
>> from the output -- ideally it should just ignore the X,Y that has a NaN for
>> the X value, but is this actually the case?
>
> Aha! This handling of NANs is the only part I couldn't figure out why it
> was not there.
> All I do is filter my own data for NANs before fitting.
> I guess Craig got distracted and didn't put WHERE(FINITE()) into his code...
> And of course, the program is excellent. No question there.
Hi Pavel--
There is no formal requirement that X and Y have the same dimensions
for most of the MPFIT family routines. Thus, doing the kind of
filtering you suggest gets a little tricky.
In more recent versions of MPFIT, I actually check for NaNs or
Infinities, and notify the user of a problem. If you have NaNs, that
is a problem. If certain points are to be ignored, then set their
WEIGHTS equal to zero. I don't think that CURVEFIT handles NaNs
either. Not that that's a good excuse (:-) but I think it's better
for the user to be explicit about what to do.
Happy fitting!
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|