RE: [R] linear constraint optim with bounds/reparametrization

2004-08-12 Thread Kahra Hannu
>From Spencer Graves: >However, for an equality constraint, I've had good luck by with an objective function >that adds something like the >following to my objective function: constraintViolationPenalty*(A%*%theta-c)^2, where >"constraintViolationPenalty" is >passed via "..." in a call to optim.

Re: [R] linear constraint optim with bounds/reparametrization

2004-08-10 Thread Spencer Graves
If A%*%theta>c, then log(c-A%*%theta) returns NA. if A%*%theta However, for an equality constraint, I've had good luck by with an objective function that adds something like the following to my objective function: constraintViolationPenalty*(A%*%theta-c)^2, where "constraintViolati

Re: [R] linear constraint optim with bounds/reparametrization

2004-08-10 Thread Ingmar Visser
On 8/9/04 4:52 PM, "Thomas Lumley" <[EMAIL PROTECTED]> wrote: > On Mon, 9 Aug 2004, Kahra Hannu wrote: > >>> 1) constrOptim does not work in this case because it only fits inequality >>> constraints, ie A%*%theta > = c >> --- I was struggling with the same problem a >>

Re: [R] linear constraint optim with bounds/reparametrization

2004-08-09 Thread Thomas Lumley
On Mon, 9 Aug 2004, Spencer Graves wrote: > Hi, Tom: > > Why is adding "a multiple of log(A*theta-c) to the objective > function ... a really bad idea as a way of faking equality constraints"? Because it is infinite everywhere on the feasible set: log(0)? It's fine to add constraints to th

Re: [R] linear constraint optim with bounds/reparametrization

2004-08-09 Thread Spencer Graves
Hi, Tom: Why is adding "a multiple of log(A*theta-c) to the objective function ... a really bad idea as a way of faking equality constraints"? I've used Lagrange multipliers on other occasions, but if computer time is cheaper than the time to work out the Lagrange multiplier approa

RE: [R] linear constraint optim with bounds/reparametrization

2004-08-09 Thread Thomas Lumley
On Mon, 9 Aug 2004, Kahra Hannu wrote: > >1) constrOptim does not work in this case because it only fits inequality > >constraints, ie A%*%theta > = c > --- I was struggling with the same problem a > few weeks ago in the portfolio optimization context. You can impose > e

RE: [R] linear constraint optim with bounds/reparametrization

2004-08-09 Thread Kahra Hannu
> from Ingmar Visser: >I would like to optimize a (log-)likelihood function subject to a number of >linear constraints between parameters. These constraints are equality >constraints of the form A%*%theta=c, ie (1,1) %*% 0.8,0.2)^t = 1 meaning >that these parameters should sum to one. Moreover, th

[R] linear constraint optim with bounds/reparametrization

2004-08-09 Thread Ingmar Visser
Hello All, I would like to optimize a (log-)likelihood function subject to a number of linear constraints between parameters. These constraints are equality constraints of the form A%*%theta=c, ie (1,1) %*% 0.8,0.2)^t = 1 meaning that these parameters should sum to one. Moreover, there are bounds