Re: [R] Non-linear minimization

2005-03-08 Thread Uwe Ligges
Sébastien Ballesteros wrote: 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),

RE: [R] Non-linear minimization

2005-03-08 Thread Wiener, Matthew
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,

Re: [R] Non-linear minimization

2005-03-08 Thread Dimitris Rizopoulos
maybe you could re-parameterize the problem, e.g., p \in (a, b) p^* = (p - a) / (b - a) \in (0, 1) x = qlogis(p^*) \in \Re I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35,

Re: [R] Non-linear minimization

2005-03-08 Thread christopher . m . turner
After some experimentation, I have had very good luck with the rgenoud package. It handles box constraints well and for small problems its slow speed has not been much of a problem. It has worked for me on Windows, Macintosh, and Linux. Chris JPMorgan Asset Management