Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

st: RE: Re: Maximizing under constraint with Mata?

From   Ozgur Ererdem <>
To   "" <>
Subject   st: RE: Re: Maximizing under constraint with Mata?
Date   Tue, 18 Sep 2012 10:49:34 +0000

Thank you very much for your answer. 



-----Message d'origine-----
De : [] De la part de Gordon Hughes
Envoyé : mardi 18 septembre 2012 11:51
À :
Objet : st: Re: Maximizing under constraint with Mata?

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


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.


*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index