Hack for imposing inequality constraints during estimation

So I wanted to impose some non-linear inequality constraints during estimation. The following code seemed to work and may be of use to others. The trick is to introduce a new dummy variable with an equation that violates the Blanchard-Kahn conditions if the inequalities aren’t satisfied.

var dummy;
...
model;
...
	#ineqtest = 1.5 - 
		( p * gamma * lambda < 1 ) *
		( eta * gamma * lambda >= 1.0 ) *
		( STEADY_STATE( jP ) > 0 ) *
		( STEADY_STATE( log_1PmuP ) > STEADY_STATE( log_1Pmu ) ) *
		( STEADY_STATE( LR ) > 0 ) *
		( STEADY_STATE( o_log_rd_share ) > -3.5915 ) *
		( STEADY_STATE( o_log_rd_share ) < -3.5905 );
	dummy = ineqtest * ( 1 + dummy(+1) ) - 0.5;

The first equation specifies all of the inequalities I want to hold (and is the bit you would need to change). Note that the things in the inequalities can be functions of the steady state, and of model local variables (eta is in this particular example). The second ensures that the BK conditions are violated if the inequalities don’t hold. When the inequalities hold, ineqtest = 0.5, and so the dummy equation is explosive, meaning dummy = 0 is the only solution and the BK conditions hold. If one of the inequalities doesn’t hold, then ineqtest = 1.5, and so the dummy equation is indeterminate (and so violates the BK conditions), with a mean of -2 (to make clear what’s going on).

If any of the Dynare dev’s are reading this it would be great if there was a non-hacky way of doing this. (Perhaps there already is and I’ve just missed it.)

Tom

Hi Tom, I tested it, but it seemed that it didn’t work, the result was just liking not imposing the restritions.

Your PM suggested that you’re trying to use this method to impose bounds on simulated variables rather than on the steady state. See Michael’s post here for details on doing that: [The Zero Lower Bound Constraint on Nominal Int. Rate)