Dear R wizards:   I am playing (and struggling) with the example in the
constrOptim function.  simple example.  let's say I want to constrain my
variables to be within -1 and 1.    I believe I want a whole lot of
constraints where ci is -1 and ui is either -1 or 1.  That is, I have 2*N
constraints.  Should the following work?

N=10
x= rep(1:N)
ci= rep(-1, 2*N)
ui= c(rep(1, N), rep(-1, N))
constrOptim( x, f, NULL, ui, ci, method="Nelder-Mead");

actually, my suggestions would be to give an example in the constrOptim docs
where the number of constraints is something like this example.  the current
ones have 2*2 constraints, so it is harder to figure out the appropriate
dimensions for different cases by extending the examples.  on another note,
the "non-conformable arguments" error could be a little more informative,
telling the end user what the two incompatible dimensions actually are.
this is not hard to find out by hand, but it would still be useful.

regards,

/iaw
-- 
Ivo Welch (ivo.we...@brown.edu, ivo.we...@gmail.com)

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to