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 fr

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

2010-06-28 Thread Ravi Varadhan
010 9:48 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 feasibl

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

2010-06-28 Thread Ravi Varadhan
m: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Rubén Roa Sent: Monday, June 28, 2010 2:24 AM To: Derek 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 usin

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

2010-06-27 Thread Rubén Roa
mendi 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] opti

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

2010-06-27 Thread Derek Ogle
11:52 PM > 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 > > >

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

2010-06-26 Thread Ravi Varadhan
unday, June 27, 2010 0:42 am Subject: Re: [R] optim() not finding optimal values To: Derek Ogle Cc: "R (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

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

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

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. Ni

[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"]