Computing optimal rules

I just started to learn Dynare a few days ago, need to get the optimized rules (complicated and simple ones) from a model. What algorithm does Dynare use to compute the optimal rules? Would Dynare generate the exactly same results as ones from S

  1. For optimal simple rules, Dynare computes the objective function in osr_obj.m then uses a numerical optimizer to find the best parameters

  2. For optimal rules under commitment, Dynare computes the optimal linear regulator by writing the Lagrangean of the problem and then creating an augmented linear rational expectation model that is solved as any other linear rational expectation model

The solutions should match Soederlind’s, but I haven’t checked it myself. If you do, please, send us the results.

Best wishes


Hi Michel.

For S

I’m attaching two examples


cgg_osr.mod (812 Bytes)
cgg_olr.mod (583 Bytes)

Thanks Michel. It’s really great help.

Hi Michel,

I tried two examples. For cgg_osr, the parameters are first assigned vaules:

gammax0 = 0.299;
gammac0 = 1.58;
gamma_y_ = 16.6667;
gamma_inf_ = 3.308;

Then at the end of program,

osr_params gammax0 gammac0 gamma_y_ gamma_inf_;

which says these four paramters are the ones that we need to find out in the simple rule (expressed in the third equation in this simple model)

How can we assign the values to the optimized parameters first, as they are the ones that we need to find out actually? Do I miss anything there?


For simple rules, we need to use a numercial optimizer. It is therefore necessary to provide guess values. It happens that I gave some that were very close to the optimal value, for some reason I don’t remember now.

However, double-checking the example I discovered a bug in the osr function. I will post a correction as soon as possible



Hey Michel,
I have a quick question: Can osr compute 2 policy rules (monetary and a fiscal rule)?
So far I have only been able to estimate one rule (and I just specify the other one with an ad-hoc Taylor rule) and when I try estimating both at the same time, I get an error message (BK conditions not met). Any insight??

This should be possible. It sound like you are trying to start your estimation from invalid parameters. Try initializing the parameters at working values before calling OSR.