Re: Simultaneous fitting in IDL [message #66372] |
Fri, 15 May 2009 06:20  |
Gianluca Li Causi
Messages: 21 Registered: August 2005
|
Junior Member |
|
|
On May 15, 1:15 pm, Allan Whiteford
<allan.rem...@phys.remove.strath.ac.remove.uk> wrote:
> Gianluca,
>
> If you really believe your data and, more importantly, really believe
> the error bars associated with them then it's formally correct that all
> of your Y2 data points are essentially being ignored. Bet you're sorry
> you went to the trouble of measuring them now? :)
Dear Allan,
thank you much for your reply, but I do not fully agree qith you.
A can assume that both my Y1 and Y2 data are random and not
correlated, but they are not equally dependent on the parameters P=
[P1,P2,P3]: in fact the F1 function is weakly dependent on the last
parameter P3, while the F2 function is heavily dependent on it.
So, if the Y2 data are essentially ingnored I get a large
indetermination of P3, although the Y2 data are enough to constraint
it very well!
Instead if I modify the weight of Y2, i.e. its error, as I do, I get a
nice result for any of my parameters, expecially the P3 given that the
F2 function passes very well across the Y2 data points!
At the limit where each function F_i only depends on a single
parameter P_i, the simultaneous fitting of the joined Y_i vectors
shoud give the same result of the independent one-parameter fitting of
each Y_i dataset, shoudn't it?
My procedure seems to satisfy this limit, which it seems to me is not
satisfied by your suggestion to leave the errors as they are.
> The simple scenario when they wouldn't be ignored would be when one (or
> more) of the parameters only has a significant effect on the modelling
> of Y2 data. This doesn't seem to be the case here since when you mess
> with the errors you do get a change in your fit.
>
> Are the errors on your points (particularly your Y1 points) truly
> random? Chances are your Y1 error estimates don't contain only random
> errors but also have some form of systematic error - hence correlation
> between the points which is a whole new can of worms.
>
> In the case of correlated errors, your weight vector needs to become a
> matrix with the diagonal elements being your weight as before and the
> off-diagonals being the correlation between points (you'll need to
> invert this matrix along the way - hopefully it's not too big). When you
> include this (assuming it has off-diagonal elements which are
> significant) one of the results will be that more attention is paid to
> Y2 data making you glad you went to the trouble of measuring them :).
I agree with you in this case, when the errors are not truly random,
but are correlated: do you know hoe to use the LMFIT routine in this
case? How can I pass to LMFIT the errors correlation matrix in place
of the Y_err vector?
> Scientists typically compensate for this whole complicated correlation
> problem by messing around with weighting of the errors in a similar way
> to what you have been trying - it can often work quite well. Sometimes
> they realise what they are compensating for but mostly they just do it
> because they get curves which look nicer and they have a gut feeling
> that some measurements have to count for something.
>
> After you've messed with your errors/weights though, don't expect formal
> statistical tests to have much meaning. Your problem in this case is
> that your chi2 statistic is still behaving correctly and saying "most of
> these points are further away than they should be" because you've
> mangled the fit so that it moves Y1 points away to compensate for Y2
> points. Who knows what the errors in your measured parameters now
> represent... but they won't be correct!
Of course, the best would be to have an LMFIT routine which accepts
more than one dataset and computes internally the Reduced ChiSquare
for each of them and the Total Reduced ChiSquare to be minimized as
the average of the single Reduced ChiSquares...
Does anybody have a multiple-fitting LMFIT routine?
By the way, I think I could use the same limit told before, to check
if in this limit I get the same parameters error as in the independent
one-parameter fittings...
This maybe should prove once for all what of our tuw approach is the
right one!
What do you think about?
Gianluca
|
|
|