OSR error in working model


I am having a problem using the OSR command in Dynare 4.2.0. The model I am using runs fine when I perform a stoch_simul, however I am receving the following error when I attempt to run the OSR command:

Configuring Dynare …
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.

Starting Dynare (version 4.2.0).
Starting preprocessing of the model file …
Found 43 equation(s).
Evaluating expressions…done
Computing static model derivatives:

  • order 1
    Computing dynamic model derivatives:
  • order 1
    Processing outputs …done
    Preprocessing completed.
    Starting MATLAB/Octave computing.


??? Reference to non-existent field ‘ys’.

Error in ==> osr1 at 68
[dr.ys,check1] = dynare_solve(fh,dr.ys,options_.jacobian_flag,…

Error in ==> osr at 50

Error in ==> bandipolicy at 366

Error in ==> dynare at 132
evalin(‘base’,fname) ;

I am not really sure where the problem lies since the model works well in stochastic simulations, any advice/suggestions are very much appreciated.

I am using Dynare 4.2.0 and MATLAB 7.10.0 r2010a, although the same problem occurs when I run Octave 3.2.4.

Thank you in advance,

Lee Smith
University of Kansas
bandipolicy.mod (4.34 KB)


you haven’t computed a steady state yet. Hence, the steady state structure ys is empty. Put a steady; command in your code. Note also that your initial values are incompatible with one equation.

Hello jpfeifer and others,

Thank you very much for seeing my mistake with leaving out the steady; command. The other issue of equation 14 not holding at the initial values took me a bit longer to figure out. To confirm that my steady state values were correct I ran another stochastic simulation with the resid; command and all the equations held with almost 0 residual (the largest residual was 7 decimal places). However, the program was still telling me that equation 14 didn’t hold at initial values when I ran OSR - equation 14 was my taylor rule which had the parameters I was wanting to choose optimally.

The problem was coming from the fact that I did not calibrate the values for the parameters I was wanting to choose optimally. Even though my initial values were included in

osr_params rhor ,rhopi;

rhor   = .75;
rhopi  = .3;

I did not include those initial values when I calibrated the other parameters (This is the method followed in the linear example posted in the wiki manual).

Hence, the moral of the story is that in a non-linear model, to use OSR, you must calibrate all parameters after you declare them(just as if you were doing a stochastic simulation), even the parameters you want Dynare to choose optimally. This may be well known, but anyone else reading this can save theme selves some time hopefully.

Thanks again to jpfeifer for the quick reply and helpful comments!

Best Regards,

Lee Smith
University of Kansas