# st: Re: beginning programming advice

 From Kit Baum <[email protected]> To [email protected] Subject st: Re: beginning programming advice Date Tue, 16 Oct 2007 06:19:21 -0400

If you can write down the maximand (or minimand) for your problem, optimize() can work with it. It is not clear to me what that might be. Note in the documentation that "type v" optimizers allow you to work with a vector rather than scalar function. optimize() is general enough to solve a multivariate optimization problem. From the online help:

"In a type v0 evaluator, you return a column vector v such that colsum (v)=f(p)."

If the elements of column vector v are the squared elements of ( (y1 - f(x1)), (y2 - f(x2)), minimizing the column sum of v is the equivalent of solving the two nonlinear equations

y1 = f (x1)
y2 = f (x2)

where some elements of x are shared in x1, x2.

Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html

On Oct 16, 2007, at 2:33 AM, statalist-digest wrote:

```Thanks very much for your reply.  I have examined the optimize()
function you mention in your first proposed solution.  Can this be
called to solve two functions simultaneously?  I follow how one would
call it to optimize a single function.  Can you add any details on how
it would be used for two functions each defined on similar variables
as in my two equations in two unknowns problem?
```
```*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```