Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Re: Maximizing under constraint with Mata?


From   Gordon Hughes <G.A.Hughes@ed.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   st: Re: Maximizing under constraint with Mata?
Date   Tue, 18 Sep 2012 10:51:25 +0100

Since no-one else has replied, the simple answer is that optimize() in Mata is not designed for constrained optimization (unless you can solve out the constraint). moptimize() permits linear constraints but that will not cover your case. Basically, moptimize() and -ml- in Stata proceed by applying a linear transformation of the variables to a smaller set of transformed variables for the optimization, so the methods will not work in the general case of nonlinear constraints.
Depending upon the nature and complexity of your problem, you should 
consider other packages - there are plenty around - that are designed 
to handle general non-linear optimisation.  There are procedures 
and/or toolboxes in R, Matlab, Octave, etc which have different 
advantages and disadvantages.
Gordon Hughes
g.a.hughes@ed.ac.uk

===================

Dear Stata users,

I've been trying to implement an optimization under constraint, using the optimize() command of Mata.
Both the function I'm willing to maximize and the constraint are non-linear.

Below please find the code I am using to define the Lagrange function denoted as "Ref". p[K] is the Lagrange multiplier, and the other p[i]s are the unknown parameters I am looking for. I use a "d0" evaluatortype.
Mata have been unable to find a solution, because  it "cannot 
calculate numerical derivatives  -- discontinuous region with missing 
values encountered"
Am I making a mistake in the way I write the problem? Has Mata the 
capacity to solve these kinds of optimization problems? Thank you 
very much for your help.
Regards  

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index