Re: [R] About nlminb function

2012-07-04 Thread Rui Barradas
Hello, Try makeFunction <- function(x) eval( parse(text=x) ) name <- 'hdev' nlminb(c(9, 12), objective = makeFunction(name)) Hope this helps, Rui Barradas Em 04-07-2012 17:37, Freddy Hernández escreveu: Hello I want to use the nlminb function but I have the objective function like charact

Re: [R] About nlminb function

2012-07-04 Thread Jorge I Velez
Dear Freddy, Thank you for the explanation and the reproducible example. You can use get() as follows: nlminb(c(9, 12), objective=get(name)) Regards, Jorge.- On Wed, Jul 4, 2012 at 12:37 PM, Freddy Hernández <> wrote: > Hello > > I want to use the nlminb function but I have the objective fu

[R] About nlminb function

2012-07-04 Thread Freddy Hernández
Hello I want to use the nlminb function but I have the objective function like characters. I can summarize the problem using the first example in the nlminb documentation. x <- rnbinom(100, mu = 10, size = 10) hdev <- function(par) -sum(dnbinom(x, mu = par[1], size = par[2], log = TRUE)) nlminb