Skip to content
Prev 280561 / 398502 Next

constrOptim and problem with derivative

Michael Griffiths wrote
grr is a function with two arguments. Do this

grr

and then you will see.
But the gradient function passed to constrOptim wants a function with a
vector argument.

So if you do

gradr <- function(x) {
    b0 <- x[1]
    b1 <- x[2]
    grr(b0,b1)
}

and after testing with

gradr(c(-0.1,0.2))

this should work

constrOptim(c(-0.1,0.2), fr1, gradr, ui=rbind(c(1,0),c(0,1)),
ci=c(-0.2,0.1)) 

Berend


--
View this message in context: http://r.789695.n4.nabble.com/constrOptim-and-problem-with-derivative-tp4217531p4217776.html
Sent from the R help mailing list archive at Nabble.com.