Hack for imposing inequality constraints during estimation
Posted: Sat Jun 25, 2011 12:17 am
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.
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
- Code: Select all
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