On Wed, Sep 8, 2010 at 1:35 PM, Michael Bernsteiner <dethl...@hotmail.com> wrote: > > Dear all, > > I'm optimizing a relatively simple function. Using optimize the optimized > parameter value is worse than the starting. > why? > > f<-function(delta,P,U){ > minimiz<-P+delta*U > x<-minimiz[1] > y<-minimiz[2] > z<-100*(y-x^2)^2+(1-x)^2 > return(z) > }
This looks familiar. Is this some 1-d version of the Rosenbrock Banana Function? http://en.wikipedia.org/wiki/Rosenbrock_function It's designed to be hard to find the minimum. In the real world one would hope that things would not have such a pathological behaviour. Numerical optimisations are best done using as many methods as possible - see optimise, nlm, optim, nlminb and the whole shelf of library books devoted to it. Barry ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.