Re: [R] optim seems to be finding a local minimum

2011-11-17 Thread Dimitri Liakhovitski
One more thing: trying to defend R's honor, I've run optimx instead of optim (after dividing the IV by its max - same as for optim). I did not use L-BFGS-B with lower bounds anymore. Instead, I've used Nelder-Mead (no bounds). First, it was faster: for a loop across 10 different IVs BFGS took 6.14

Re: [R] optim seems to be finding a local minimum

2011-11-14 Thread Kevin Wright
Actually, Interval Analysis can be used to find _all_ optima (including the global optimum) within a starting box. It's not particularly well-known in statistical circles. See this (for example): http://bib.tiera.ru/ShiZ/math/other/Global%20Optimization%20Using%20Interval%20Analysis%20-%20E.%20H

Re: [R] optim seems to be finding a local minimum

2011-11-14 Thread Dimitri Liakhovitski
Just to provide some closure: I ended up dividing the IV by its max so that the input vector (IV) is now between zero and one. I still used optim: myopt <- optim(fn=myfunc, par=c(1,1), method="L-BFGS-B", lower=c(0,0)) I was able to get great fit, in 3 cases out of 10 I've beaten Excel Solver, but

Re: [R] optim seems to be finding a local minimum

2011-11-11 Thread John C Nash
Some tips: 1) Excel did not, as far as I can determine, find a solution. No point seems to satisfy the KKT conditions (there is a function kktc in optfntools on R-forge project optimizer. It is called by optimx). 2) Scaling of the input vector is a good idea given the seeming wide range of val

Re: [R] optim seems to be finding a local minimum

2011-11-11 Thread Dimitri Liakhovitski
Thank you very much to everyone who replied! As I mentioned - I am not a mathematician, so sorry for stupid comments/questions. I intuitively understand what you mean by scaling. While the solution space for the first parameter (.alpha) is relatively compact (probably between 0 and 2), the second o

[R] optim seems to be finding a local minimum

2011-11-11 Thread Ravi Varadhan
Hi Dimitri, Your problem has little to do with local versus global optimum. You can convince yourself that the solution you got is not even a local optimum by checking the gradient at the solution. The main issue is that your objective function is not differentiable everywhere. So, you have

Re: [R] optim seems to be finding a local minimum

2011-11-11 Thread John C Nash
I won't requote all the other msgs, but the latest (and possibly a bit glitchy) version of optimx on R-forge 1) finds that some methods wander into domains where the user function fails try() (new optimx runs try() around all function calls). This includes L-BFGS-B 2) reports that the scaling i

Re: [R] optim seems to be finding a local minimum

2011-11-11 Thread Ben Bolker
Hans W Borchers googlemail.com> writes: > > Ben Bolker gmail.com> writes: > > > > > Simulated annealing and other stochastic global optimization > > methods are also possible solutions, although they may or may not > > work better than the many-starting-points solution -- it depends > > on

Re: [R] optim seems to be finding a local minimum

2011-11-11 Thread Hans W Borchers
Ben Bolker gmail.com> writes: > > Simulated annealing and other stochastic global optimization > methods are also possible solutions, although they may or may not > work better than the many-starting-points solution -- it depends > on the problem, and pretty much everything has to be tuned.

Re: [R] optim seems to be finding a local minimum

2011-11-10 Thread Ben Bolker
Rolf Turner xtra.co.nz> writes: > > On 11/11/11 08:55, Dimitri Liakhovitski wrote: > > Bert, > > that's exactly where I started. I found optim in the first paragraph > > under "General Purpose Continuous Solvers" and used bounded BFGS for a > > constrained optimization for a situation with more

Re: [R] optim seems to be finding a local minimum

2011-11-10 Thread Rolf Turner
On 11/11/11 08:55, Dimitri Liakhovitski wrote: Bert, that's exactly where I started. I found optim in the first paragraph under "General Purpose Continuous Solvers" and used bounded BFGS for a constrained optimization for a situation with more than 1 parameters. Again, not being an engineer / mat

Re: [R] optim seems to be finding a local minimum

2011-11-10 Thread Dimitri Liakhovitski
Bert, that's exactly where I started. I found optim in the first paragraph under "General Purpose Continuous Solvers" and used bounded BFGS for a constrained optimization for a situation with more than 1 parameters. Again, not being an engineer / mathematician - would greatly appreciate any pointer

Re: [R] optim seems to be finding a local minimum

2011-11-10 Thread Bert Gunter
Refer to the CRAN "Optimization" task view, please. That is a much more appropriate place to begin than posting a query here. All numerical optimizers only produce local optima. -- Bert On Thu, Nov 10, 2011 at 11:24 AM, Dimitri Liakhovitski < dimitri.liakhovit...@gmail.com> wrote: > Just to add

Re: [R] optim seems to be finding a local minimum

2011-11-10 Thread Dimitri Liakhovitski
Just to add: I also experimented with the starting parameters (par) under optim, especially with the second one. I tried 1, 10, 100, 1000, etc. When I tried 100,000,000 then I got a somewhat better solution (but still not as good as in Excel). However, under message it said: "ERROR: ABNORMAL_TERM

[R] optim seems to be finding a local minimum

2011-11-10 Thread Dimitri Liakhovitski
Hello! I am trying to create an R optimization routine for a task that's currently being done using Excel (lots of tables, formulas, and Solver). However, otpim seems to be finding a local minimum. Example data, functions, and comparison with the solution found in Excel are below. I am not experie