Re: [R] optim() not finding optimal values

2010-06-28 Thread Rubén Roa
Ugartea z/g 48395 Sukarrieta (Bizkaia) SPAIN -Mensaje original- De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] En nombre de Derek Ogle Enviado el: sábado, 26 de junio de 2010 22:28 Para: R (r-help@R-project.org) Asunto: [R] optim() not finding optimal values I

Re: [R] optim() not finding optimal values

2010-06-28 Thread Ravi Varadhan
Ogle; R (r-help@R-project.org) Subject: Re: [R] optim() not finding optimal values Derek, As a general strategy, and as an alternative to parscale when using optim, you can just estimate the logarithm of your parameters. So in optim the par argument would contain the logarithm of your parameters

Re: [R] optim() not finding optimal values

2010-06-28 Thread Ravi Varadhan
AM To: 'Rubén Roa'; 'Derek Ogle'; 'R' Subject: Re: [R] optim() not finding optimal values Ruben, Transforming the parameters is also a good idea, but the obvious caveat is that the transformation must be feasible. The log-transformation is only feasible for positive parameter domain. This happens

Re: [R] optim() not finding optimal values

2010-06-28 Thread dave fournier
If you are going to make this program available for general use you want to take every precaution to make it bulletproof. This is a fairly informative data set. The model will undoubtedly be used on far less informative data. While the model looks pretty simple it is very challenging

Re: [R] optim() not finding optimal values

2010-06-27 Thread Derek Ogle
To: Ravi Varadhan Cc: Derek Ogle; R (r-help@R-project.org) Subject: Re: [R] optim() not finding optimal values A slightly better scaling is the following: par.scale - c(1.e06, 1.e06, 1.e-05, 1) # q is scaled differently SPoptim - optim(pars, SPsse, B=d$catch, CPE=d$cpe, control=list

[R] optim() not finding optimal values

2010-06-26 Thread Derek Ogle
I am trying to use optim() to minimize a sum-of-squared deviations function based upon four parameters. The basic function is defined as ... SPsse - function(par,B,CPE,SSE.only=TRUE) { n - length(B) # get number of years of data B0 - par[B0]

Re: [R] optim() not finding optimal values

2010-06-26 Thread Nikhil Kaza
Your function is very irregular, so the optim is likely to return local minima rather than global minima. Try different methods (SANN, CG, BFGS) and see if you get the result you need. As with all numerical optimsation, I would check the sensitivity of the results to starting values.

Re: [R] optim() not finding optimal values

2010-06-26 Thread Ravi Varadhan
- Original Message - From: Derek Ogle do...@northland.edu Date: Saturday, June 26, 2010 4:28 pm Subject: [R] optim() not finding optimal values To: R (r-help@R-project.org) r-help@r-project.org I am trying to use optim() to minimize a sum-of-squared deviations function based upon four parameters

Re: [R] optim() not finding optimal values

2010-06-26 Thread Ravi Varadhan
, 2010 0:42 am Subject: Re: [R] optim() not finding optimal values To: Derek Ogle do...@northland.edu Cc: R (r-help@R-project.org) r-help@r-project.org Derek, The problem is that your function is poorly scaled. You can see that the parameters vary over 10 orders of magnitude (from 1e-04