# [R] Equation constraints: optim()

Tue Jul 17 10:56:39 CEST 2001

```Dear All,

I am using optim() to minimise a function,

(y-E exp{a*(2-(L+E/K))+ a * c (L/E -1))^2

I would like the result to respect the following constraints. The problem I
am having problems understanding is how to impose them, when they relate not
to the parameters a and c directly, but to equations containing a and c,

alpha = a * (L+E/K)
beta = a * (c * L/E + L/K)
gamma = 1 - alpha - beta

where

alpha, beta and gamma are all non-negative and sum to 1. Gamma itself does
not appear in the function to be fitted.

I note that within Mathematic it is possible to solve under constraints on
the parameters and equations containing the parameters ? Is this possible in
R ?

Does anyone have any ideas ? Am I missing an obvious mathematical solution
and thereby asking too much of r ?

many thanks

Ben Warr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://stat.ethz.ch/pipermail/r-help/attachments/20010717/39f8a427/attachment.html
```