octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #38063] optim: expfit inaccurate (incorrect)


From: Olaf Till
Subject: [Octave-bug-tracker] [bug #38063] optim: expfit inaccurate (incorrect)
Date: Tue, 09 Apr 2013 13:26:58 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20121207 Iceweasel/3.5.16 (like Firefox/3.5.16)

Follow-up Comment #3, bug #38063 (project octave):

In my tests, MaxIter was not limiting (it was set to 100 and there were 34 and
32 iterations) and yet general optimization, though giving a good fit, did not
come up with reasonably correct parameters, while expfit did the latter for
the small noise case. (I'm pasting only the small-noise case.)

octave:1> x0 = 0; step = 0.05; xend = 5; x = x0:step:xend;
octave:2> y = 2*exp(1.3*x)-0.5*exp(2*x);
octave:4> serror = (rand(1,length(y))-0.5)*3e-4;
octave:16> [p, fy, cvg, outp] = nonlin_curvefit (@ (p, x) p(1) * exp (p(3) *
x) + p(2) * exp (p(4) * x), [-1; -1; 1; 1], x, y + serror, optimset
("maxiter", 100));
octave:17> p
p =

  -0.093230
  -0.119135
   2.146504
   2.146838

octave:18> cvg
cvg =  3
octave:19> outp
outp =

  scalar structure containing the fields:

    niter =  34

octave:20> [alpha,c,rms] = expfit(2,x0,step,y+serror)
alpha =

   2.0000
   1.3000

c =

  -0.50002
   1.99994

rms =  0.0018253
octave:21> 


I still suspect a misunderstanding. Your emphasis seems to be on curve fit,
while possibly in the case of the models dealt with by expfit, parameter
determination could be more important. My argument was that in the case of the
example with the large noise, although you say this is more like real world,
there is possibly no optimizer at all which can figure out the correct model
parameters ('correct' in the sense of 'underlying' (assuming the model
reflects the real conditions producing the data), not in the sense of
producing a good fit).


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?38063>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]