Re: [R] Optimzing a nested function

2011-04-12 Thread Ravishankar Rajagopalan
Thanks Duncan and Mario. It works fine now. On Tue, Apr 12, 2011 at 3:11 PM, Duncan Murdoch wrote: > On 11-04-12 2:33 AM, vioravis wrote: > >> I am trying to optimize a nested function using nlminb. This throws out an >> error that y is missing. Can someone help me with the correct syntax?? >> Th

Re: [R] Optimzing a nested function

2011-04-12 Thread Duncan Murdoch
On 11-04-12 2:33 AM, vioravis wrote: I am trying to optimize a nested function using nlminb. This throws out an error that y is missing. Can someone help me with the correct syntax?? Thank you. See ?nlminb. The parameters to optimize should be given as a vector in a single parameter. Other p

Re: [R] Optimzing a nested function

2011-04-12 Thread Mario Valle
P.S.: It is bad taste to call a variable 'sum' because it is a R function. Ciao! mario On 12-Apr-11 08:33, vioravis wrote: I am trying to optimize a nested function using nlminb. This throws out an error that y is missing. Can someone help me with the correct syntax?? Thank

[R] Optimzing a nested function

2011-04-11 Thread vioravis
I am trying to optimize a nested function using nlminb. This throws out an error that y is missing. Can someone help me with the correct syntax?? Thank you. test1 <- function(x,y) { sum <- x + y return(sum) } test2 <- function(x,y) { sum <- test1(x,y) sumSq <- sum*sum return(sumSq) } n