José Luis Aznarte M. wrote:
> 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 extrem
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] Pass
Hi
Use the dots argument at the end to pass in named parameters.
This is documented as the last in the argument list under ?optim.
Here's a toy example using x and p:
> f <- function(x,p){sum(x^2)+p*sum(x)}
> gr <- function(x,p){2*x+p*rep(1,length(x))}
> optim(par=c(10,10),fn=f,gr=gr,p=13)
$
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 s
4 matches
Mail list logo