[R] Small Bug in constrOptim documentation

From: Matthias Gondan <matthias-gondan_at_gmx.de>
Date: Wed, 18 Jun 2008 17:41:00 +0200


Dear list,

I think there is a small bug in the constrOptim documentation (R-2.7.0):

## from optim
fr <- function(x) { ## Rosenbrock Banana function

     x1 <- x[1]
     x2 <- x[2]
     100 * (x2 - x1 * x1)^2 + (1 - x1)^2

}

grr <- function(x) { ## Gradient of 'fr'
     x1 <- x[1]
     x2 <- x[2]
     c(-400 * x1 * (x2 - x1 * x1) - 2 * (1 - x1),
        200 *      (x2 - x1 * x1))

}

optim(c(-1.2,1), fr, grr)
#Box-constraint, optimum on the boundary constrOptim(c(-1.2,0.9), fr, grr, ui=rbind(c(-1,0),c(0,-1)),ci=c(-1,-1))

# x<=0.9, y-x>0.1 <<-- here
constrOptim(c(.5,0), fr, grr, ui=rbind(c(-1,0),c(1,-1)), ci=c(-0.9,0.1))

I think the ui/ci bounds translate to x <= 0.9 and x-y > 0.1, not y-x

Could anybody confirm this, please?

Best wishes,

Matthias



R-help_at_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. Received on Wed 18 Jun 2008 - 18:35:32 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 18 Jun 2008 - 19:30:51 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive