Re: [R] Optim with two constraints

2005-10-20 Thread Berwin A Turlach
AD == Alexis Diamond [EMAIL PROTECTED] writes: AD I have a follow-up from Jens's question and Professor Ripley's AD response. AD Jens wants to do quadratic optimization with 2 constraints: # I need two constraints: # 1. each element in par needs to be between 0 and 1

Re: [R] Optim with two constraints

2005-10-20 Thread Thomas Wood
Alexis, WIKI: You create the box constraints with two inequality constraints for each element.Suppose that you have five elements, and your upper bound is .33, and your lower bound is 0. Then quadprog would require constraints as: A[1,]=(1,0,0,0,0)b=(0)

Re: [R] Optim with two constraints

2005-10-19 Thread Alexis Diamond
Hainmueller Cc: r-help@stat.math.ethz.ch Betreff: Re: [R] Optim with two constraints This is actually quadratic programming, so why do you want to use optim()? There are packages specifically for QP, e.g. quadprog. A more general approach is to eliminate one variable, which gives you

Re: [R] Optim with two constraints

2005-10-13 Thread Prof Brian Ripley
This is actually quadratic programming, so why do you want to use optim()? There are packages specifically for QP, e.g. quadprog. A more general approach is to eliminate one variable, which gives you an inequality constrained problem in n-1 variables to which you could apply contrOptim().

[R] Optim with two constraints

2005-10-12 Thread Jens Hainmueller
Hi R-list, I am new to optimization in R and would appreciate help on the following question. I would like to minimize the following function using two constraints: ## fn - function(par,H,F){ fval - 0.5 * t(par) %*% H %*% par + F%*% par fval } # matrix H is (n by k)