What does the error message "w = 0 in Givens();" mean when trying curve fitting in gnuplot?

StackOverflow https://stackoverflow.com/questions/16415007

سؤال

I keep having the w = 0 in Givens(); error message when I try to use gnuplot built-in curve fitting feature.

What I do is trying to fit experimental data to a certain mathematical model in gnuplot. I define the model function s(x):

gnuplot> z(x)=(x-mu)/be
gnuplot> s(x)=(k/be)*exp(-z(x)-exp(-z(x)))

Then I plot the actual data and the model function to get an initial guess for the model parameters:

initial

Then I adjust the initial guess:

gnuplot> k=2.6; mu=-8.8; 
gnuplot> replot

To obtain a pretty fine picture:

initial-adjusted

Then I try to precisely fit the curve:

gnuplot> fit s(x) '701_707_TRACtdetq.log30.hist1.txt' u 2:6 via k,be,mu

And what I get is the single iteration and a error message:

 Iteration 0
 WSSR        : 3.85695           delta(WSSR)/WSSR   : 0
 delta(WSSR) : 0                 limit for stopping : 1e-05
 lambda   : 0.223951

initial set of free parameter values

k               = 2.6
be              = 1
mu              = -8.8
/

 Iteration 1
 WSSR        : 0.0720502         delta(WSSR)/WSSR   : -52.5315
 delta(WSSR) : -3.7849           limit for stopping : 1e-05
 lambda   : 0.0223951

resultant parameter values

k               = 2.03996
be              = 0.777868
mu              = -8.87082
         w = 0 in Givens();  Cjj = 3.37383e-196,  Cij = 2.54469e-192

And the curve pretty fit:

fit

What does that error means and how would I get the fit process going?

هل كانت مفيدة؟

المحلول

The error message w = 0 in Givens(); seems to be related to inability of fit to perform the next iteration of fit parameters estimation. The error message is accompanied by the values of a certain matrix C[][] that is related to the direction of the next step of the fit iterations. Those values are usually very small, like in the example, Cjj = 3.37383e-196, Cij = 2.54469e-192. This means that the fit process has converged to a state where every other local set of fit parameters are less optimal than the current (local state extreme), but the current residuals are above the convergence limit, in this case delta(WSSR) : -3.7849 limit for stopping : 1e-05. This happens when the data to be fitted exhibits a disturbance (at approximately x=-13 in this case) that yields significant delta despite the perfect fit.

Long story short: the error usually happens when the fit is fine but the delta is still high.

نصائح أخرى

What I'm just about to say might seem strange but it works!

When I run into the 'w = 0 in Givens()' error I use:

gnuplot> set xrange [a,b]

where 'a' and 'b' are chosen to window the 'most interesting' parts. If you now do the fitting command that you have:

gnuplot> fit s(x) '701_707_TRACtdetq.log30.hist1.txt' u 2:6 via k,be,mu

You might find that your fit now converges. I'm not sure why 'set range' affects the fitting algorithm but it does! In your example, I might let:

a = -12

b = -2

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top