RE: [R] Non-linear minimization

From: Wiener, Matthew <>
Date: Wed 09 Mar 2005 - 00:57:21 EST

I have had my best luck by re-parametrizing so that I no longer needed restrictions. For example, if parameters must be positive, then I optimize over parameters in log space, taking the exponential within my function. This requires small changes to the function I'm optimizing (and the gradient, if supplied), but, for me at least, has worked better than trying to enforce box constraints as in L-BFGS-B.

Hope this helps,

Matt Wiener

-----Original Message-----
[] On Behalf Of Sébastien Ballesteros Sent: Tuesday, March 08, 2005 8:24 AM

Subject: [R] Non-linear minimization

hello, I have got some trouble with R functions nlm(), nls() or optim() : I would like to fit 3 parameters which must stay in a precise interval. For exemple with nlm() :

fn<-function(p) sum((dN-estdata(p[1],p[2],p[3]))^2) out<-nlm(fn, p=c(4, 17, 5),

with estdata() a function which returns value to fit with dN (observed data vactor)

My problem is that only optim() allows me to set parameters interval with "L-BFGS-B" method but this one doesn't work in my case.

I have heard about nls2 package ( but it doesn't work on Windows.

Do you know any solutions

Thank's a lot for reading my post

Best regards

INA P-G ecology dpt mailing list PLEASE do read the posting guide! mailing list PLEASE do read the posting guide! Received on Wed Mar 09 01:06:11 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:41 EST