you need to use the `...' argument; look at ?optim() for more info. Best, Dimitris
---- Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm ----- Original Message ----- From: ""José Luis Aznarte M."" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, September 12, 2007 10:32 AM Subject: [R] Passing parameters to 'optim' fn function > Hi again! I'm using the 'optim' method to fix the parameters of a > model. I have written the function to be minimised and another > function > which returns the gradient of the error. Now my problem is that, in > order to compute that gradient, it would be extremely convenient to > be > able to pass some parameters to the gradient function. I don't see > how > to do it given the fixed syntax of 'optim', which does not allow for > parameters being passed to fn and gr: > > > optim(par, fn, gr = NULL, ...) > > Of course the first idea would be to "pack" the extra parameters > in > the vector 'par', but in that case the extra parameters would be > optimized too. > Does anyone have an idea on how to pass parameters to gr in > optim? > Thanks for your time! > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.