From: Alan Weiss on 14 Apr 2010 16:31 Hi, Tim, I'm glad you are satisfied. Your problem is probably extremely flat in some directions, that is why different problem formulations arrive at different answers. Having bounds affects the algorithm even when the current point is not right at a bound, which is why the results differ. You ask an interesting question about tolerances. I usually tell people not to go much below 1e-12 for a tolerance, and never below eps (I believe 10*eps is usually too small). But it is hard to say exactly, for every recommendation there is a counterexample. Alan Weiss MATLAB mathematical toolbox documentation On 4/14/2010 2:42 PM, Tim wrote: > I set TolFun to 1e-8 and all of my betahats match through the first > decimal place now. It seems for this particular case these values should > not change but I'm willing to move on. For future reference do you have > any guidance for what is a ludicrously small tolerance? Thanks again for > your help. > > Tim > > Alan Weiss <aweiss(a)mathworks.com> wrote in message > <hq4cos$c71$1(a)fred.mathworks.com>... >> Well, there is one more thing to try, though I am a bit reluctant to >> suggest it. You could set TolFun to 1e-8 or 1e-10 and see if the >> results get any closer (I am assuming that the reason lsqcurvefit >> stopped was due to a the TolFun tolerance). The reason I am reluctant >> to suggest this measure is people often overdo this by setting >> ludicrously small tolerances. There is no sense in setting a tolerance >> smaller than eps, and this is already too small for most purposes. >> >> Alan Weiss >> MATLAB mathematical toolbox documentation >> >> On 4/13/2010 4:04 PM, Tim wrote: >> > Thanks for the quick response Alan. You are right, the residuals are >> > very close in both cases. I also switched to a logarithmic expression >> > and tried the same test. My betahats are much closer together but I >> > still get the same behavior. >> > >> > Tim >> > >> > Alan Weiss <aweiss(a)mathworks.com> wrote in message >> > <hq2aag$7e9$1(a)fred.mathworks.com>... >> >> That is an interesting result. You could tell from the original answer >> >> CONSTRAINED >> >> LB = [-10,0,0]; >> >> UB = [50,5,5]; >> >> betahat returned [11.37, 1.83, 0.83] >> >> that the constraints don't matter. But the results differ. Hmm. >> >> >> >> It seems to me that the minimum is probably pretty flat. In other >> >> words, I am guessing that the resulting residuals were virtually the >> >> same for your two runs. Why not try a less fussy objective function. >> >> Take the log of everything: >> >> lfunc = log(b1) + log(x1) + b2.*log(x2) + b3.*log(x3); >> >> This transformation has the same minimum, but might be better-behaved. >> >> >> >> Alan Weiss >> >> MATLAB mathematical toolbox documentation >> >> >> >> On 4/13/2010 11:22 AM, Tim wrote: >> >> > I'm using lsqcurvefit with restrictions placed on the upper and >> lower >> >> > bounds. When I wanted to compare the results to an unconstrained >> >> model I >> >> > changed the restrictions on all parameters to -inf and inf. New >> >> > regression parameters were generated but they were still within the >> >> > original constraints. >> >> > >> >> > Example... >> >> > GENERAL CODE STAYS SAME ACROSS RUNS >> >> > func = (b1.*x1.*x2.^b2.*x3.^b3); >> >> > >> >> > options = optimset('Display', 'iter', 'FunValCheck', 'on', >> >> > 'MaxFunEvals', 5000, 'MaxIter', 1000); >> >> > [betahat,...] = lsqcurvefit('func', beta0, xdata, ydata, LB, UB, >> >> options); >> >> > PARTS I'VE CHANGED BETWEEN RUNS >> >> > >> >> > CONSTRAINED >> >> > LB = [-10,0,0]; >> >> > UB = [50,5,5]; >> >> > betahat returned [11.37, 1.83, 0.83] >> >> > >> >> > UNCONSTRAINED >> >> > LB = [-inf,-inf,-inf]; >> >> > UB = [inf,inf,inf]; >> >> > betahat returned [10.11, 1.78, 0.82] >> >> > >> >> > If the parameters changed between runs I would have expected at >> least >> >> > one element from the new betahat from the unconstrained model to be >> >> > outside the LB and UB of the constrained model. >> >> > Do I just need to put my inner engineer away and think of the two >> >> > betahats as essentially the same? Any thoughts on why the slightly >> >> > different answers? If I do accept them as the same can I return a >> level >> >> > of significance? >> >> > >> >> > Thanks, >> >> > >> >> > Tim
First
|
Prev
|
Pages: 1 2 Prev: shift matrix row-wise by a vector of "shift" values Next: image on a push button |