This project is read-only.

solve(m, 'linear=',true) and solve(m,'linear=',false)

Topics: Models
Jul 28, 2015 at 5:25 PM
Greetings!

I have recently found myself in the situation where I have a typical 4-equations gap-type linear New Keynesian model which is correctly solved via solve(m, 'linear=',true), but using solve(m, 'linear=',false) does not lead to any solution (in the sense, that some of the model gaps are not equal to zero in steady state and steady state check reveals that some equations do not hold in steady state). If it could be attributed to some model misspecification or error, why is it that under solve(m, 'linear=',true) a correct solution can be found?

Regards,
AndreyO
Jul 28, 2015 at 5:33 PM
Hi Andrey

You should use the option 'linear=' only in the model(...) function when reading the model file and creating a model object. Then, the solve(...) command chooses automatically the appropriate procedure. The option 'linear=' in the solve(...) command is reserved for very special circumstances, and should not be used in most cases.

One of the things that you need to keep in mind is that when you solve a nonlinear model, or solve a linear model with the option 'linear=' false, a correct steady state needs to exist in the model object prior to calling the function solve(...). In other words, you have to run sstate(...) first in such circumstances; moreover, if your model includes non-zero growth rates for some of the non-stationary (unit-root) variables, the function sstate(...) must be called with an additional option 'growth=' true.

You don't have to care about any of these things in linear models when you run solve(...) without the 'linear=' option.

Best,
Jaromir
Marked as answer by jaromirbenes on 7/28/2015 at 9:33 AM
Jul 29, 2015 at 9:16 AM
Edited Jul 29, 2015 at 9:18 AM
Hi, Jaromir!

Sorry for confusion -- I did mean 'linear' option in the 'model' function. The problem I encountered is that I can't compute steady state (some of the equations do no hold) in the (linear) model (using 'linear=' false option of the 'model()' function), which can be correctly solved when loading it using 'linear=' true option of the 'model()' function. What might be the reason behind this result?

Regards,
AndreyO
Jul 29, 2015 at 9:24 AM
He Andrey

There can be a couple things causing the problems.

First, make sure you call the sstate(...) function before solve(...) when the model is declared nonlinear, i.e. 'linear=' false (or default) in model(...).

Second, if the model includes some non-stationary variables with nonzero growth rates (let's say you have a (log) price level and the inflation rate is non-zero in steady state), you need to call the sstate(...) function with option 'growth=' true. This is because by default, IRIS assumes zero growth rates/differences for all variables when computing the steady state. If some variables are growing in steady state, this needs to be declared.

Third, look up what Matlab says after the steady-state iterations. It could be that it simply ran out of max number of iterations without convergence. In that case, you can try several things. Increase 'maxIter='. Or you can add steady-state versions of some equations to the model file (if you're not aware of what this is, let me know).

If nothing of the above helps, please email me the file(s), and I'll have a look. My email address is jaromir (dot) benes (at) gmail (dot) com.

Best,
Jaromir
Marked as answer by jaromirbenes on 7/29/2015 at 1:24 AM
Jul 31, 2015 at 9:57 AM
Hi Andrey

Mystery solved.

Look at the very last line in your solve_us_model.m:
[Flag,List] = chksstate(sstate(m), 'error=',false)
Inside the chksstate(...) function, you call the sstate(...) function again, meaning you recompute the steady state of the model once again, but this time without using the option 'growth=' true (which is correctly used at one of the previous lines).

To fix it, simply call the chksstate(...) function directly with the model object m (its steady state already exists inside the model object at that time); that means
[Flag,List] = chksstate(m, 'error=',false)
or simply
chksstate(m);
Best,
Jaromir
Aug 14, 2015 at 11:20 AM
Thank you, Jaromir! I'll try to be more attentive next time :).

Regards,
AndreyO