Path: news.mathworks.com!not-for-mail
From: "Nicolas " <support-knitro@artelys.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: robust fitting using lsqcurvefit
Date: Fri, 16 May 2008 12:55:05 +0000 (UTC)
Organization: Artelys
Lines: 116
Message-ID: <g0k078$as3$1@fred.mathworks.com>
References: <g09793$4mc$1@fred.mathworks.com> <g098ir$i7v$1@fred.mathworks.com> <g0ff8d$kda$1@fred.mathworks.com>
Reply-To: "Nicolas " <support-knitro@artelys.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1210942505 11139 172.30.248.38 (16 May 2008 12:55:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 16 May 2008 12:55:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1323298
Xref: news.mathworks.com comp.soft-sys.matlab:468828


"Ture VP" <turevp@gmail.com> wrote in message 
<g0ff8d$kda$1@fred.mathworks.com>...
> "John D'Errico" <woodchips@rochester.rr.com> wrote in
> message <g098ir$i7v$1@fred.mathworks.com>...
> > "Ture VP" <turevp@gmail.com> wrote in message 
> > <g09793$4mc$1@fred.mathworks.com>...
> > > Hi,
> > > 
> > > I am fitting my data with 'lsqcurvefit'. This works 
fine.
> > > But now I would like to include a robust fitting 
procedure. 
> > > 
> > > It was not clear to me from the help function whether 
or not
> > > this is possible. In the section about robust fitting 
it is
> > > written that on can use it for non-linear least square
> > > problems. However I cannot find how to turn it on for 
my
> > > function (here the options have to be set 
using 'optimset'
> > > which does not like the option 'robust','on')
> > > 
> > > Ture
> > 
> > How can it be not clear in the help?
> > 
> > No place in the help for lsqcurvefit is the word
> > "robust" ever used. At least, find never located
> > the word, nor did quick a search I find that
> > word in any function in the entire optimization
> > toolbox. There is absolutely no implication that
> > this code is or can be used for anything but a
> > standard nonlinear least squares solution.
> > 
> > As far as using a non-existent 'robust' option
> > in optimset, you cannot simply make up an
> > option and pretend that it now is valid in
> > optimset. It is Monday. Can I now change the
> > day to last Thursday by setting
> > 
> > options = optimset('DayOfWeek','lastthursday');
> > 
> > While I admit that I've not tried this simple test,
> > it seems highly likely to fail.
> > 
> > You can find robustfit in the statistics toolbox.
> > 
> > John
> 
> Dear John,
> 
> There is absolutely no need here to become sarcastic. In
> fact, your answer is not helping anything. 
> 
> First of all I am of course aware that the robust fitting 
is
> not part of the optimization toolbox. However my question
> concerned 'lsqcurvefit' which is part of the curve fitting
> toolbox. In this toolbox you do have options for robust
> fitting (e.g. the function 'fit', as also mentioned by 
Peter
> Perkins). 
> 
> I like 'lsqcurvefit' because it is extremely fast, has 
upper
> and lower bounds and allows me to play with gradients and
> hessians. The function 'fit' on the other hand is much
> slower and if you want to fit a few ten thousand spectra 
you
> do want to optimize the speed of the fitting routine.
> 'robustfit' and nlinfit are absolutely not suitable for my
> purposes.
> 
> Concerning your comment about the help: maybe I am not a
> genius as you are and yes, I do get sometimes lost in the
> help functions of all these toolboxes (I have access to 
most
> of them).
> 
> In the past I was actually using 'fminunc' 
and 'fminsearch'
> from the optimization toolbox where I added myself the
> robust part. But again here these routines are not really
> fast and not optimized for complex curve fitting (e.g. no
> upper and lower bounds).
> 
> I could somehow live with the 'fit' function but it is not
> clear to me how to e.g. use a split pearsonVII (where the
> function is defined by two separate equations).
> 
> So to cut long story short: what is actually the 
fundamental
> reason that some functions have the option for robust
> fitting and others don't?
> 
> Cheers!
> 
> Ture
> 
> Steven
> 
> 
> 
> 

Dear Steven,

I read that you used fminunc to do robust fitting. If you 
have the R2008A of the optimization toolbox, you might also 
try ktrlink that uses the knitro solver.
If needed, I can provide you with a one-month trial license 
of knitro for matlab.

Nicolas Omont