<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>Equation constraints: optim()</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>Dear All,</FONT>
</P>

<P><FONT SIZE=2>I am using optim() to minimise a function,</FONT>
</P>

<P><FONT SIZE=2>(y-E exp{a*(2-(L+E/K))+ a * c (L/E -1))^2</FONT>
</P>

<P><FONT SIZE=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, </FONT></P>

<P><FONT SIZE=2>alpha = a * (L+E/K)</FONT>
<BR><FONT SIZE=2>beta = a * (c * L/E + L/K)</FONT>
<BR><FONT SIZE=2>gamma = 1 - alpha - beta</FONT>
</P>

<P><FONT SIZE=2>where</FONT>
</P>

<P><FONT SIZE=2>alpha, beta and gamma are all non-negative and sum to 1. Gamma itself does not appear in the function to be fitted.</FONT>
</P>

<P><FONT SIZE=2>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 ?</FONT></P>

<P><FONT SIZE=2>Does anyone have any ideas ? Am I missing an obvious mathematical solution and thereby asking too much of r ?</FONT>
</P>

<P><FONT SIZE=2>many thanks</FONT>
</P>

<P><FONT SIZE=2>Ben Warr</FONT>
</P>

</BODY>
</HTML>