Displaying 1 result from an estimated 1 matches for "optimconst".
2009 Mar 25
0
constrOptim workaround for "L-BFGS-B" or Box Constraints
...welcome.
Comments:
1) thank you very much to Paul Smith in the post
https://stat.ethz.ch/pipermail/r-help/2008-March/157249.html
This is intended to build on that example with something more complex
than
a 2x2 set of constraints
2) "L-BFGS-B" does not appear to work in optimConst
Problem:
let's say you have a function
y= a + b1*x1 + b2*x2 + b3*x3 + b4*x4
and you want to minimize (where b and x are the matrices of the b's and x's)
error = (a + b %*% x - y) ^ 2
subject to the constraints
sum(b) = 1
0<b<1
The code:
# rm(list=ls())
# FULL ON...