Assignment of values to exogenous variables in steady state file

Dear Johannes,

I have a question about the assignment of values to exogenous variables when we use a *_steadystate.m file.

In a deterministic setting, where a shock consists in a permanent change in the value of exogenous variables (for instance a change in the exogenously-defined value of government spending g), where should we assign the initial value of g and the final value of g?

In my past research articles, I was able to compute the steady state by hand. In this case it is easy to perform a permnanent change to exogenous variables, just by doing (for instance):

c = … // Endogenous variable but initial steady state value obtained by hand
y = … // Endogenous variable but initial steady state value obtained by hand
l = // Endogenous variable but initial steady state value obtained by hand
g = 0.5 // Exogenous variable

c = … // Endogenous variable but initial steady state value obtained by hand
y = … // Endogenous variable but initial steady state value obtained by hand
l = // Endogenous variable but initial steady state value obtained by hand
g = 0.7; // Exogenous variable permanently changed

But in my current research I cannot get the steady state by hand and have to compute it using an external .m file. How should I code my permanent shock to exogenous gov spending? Would I just keep the exogenous variables in initval and endval, remove the endogenous variables, and write steady? Doing for instance:

g = 0.5;
steady; // Writing steady importing our value from our .m file, TAKING INTO ACCOUNT the value of g we have just written?

g = 0.7;
steady; // Writing steady importing our value from our .m file, TAKING INTO ACCOUNT the value of g we have just written?

I think that usually, we remove the initval and endval sections when we use external steady state m. files, but then how to a model a shock to exogenous variable?

Thnak you very much for your help,


I think you are confusing the setups. For steady state transitions due to permanent changes in exogenous states in deterministic simulations, you simply use initval and endval as you describe.

For stochastic simulations, you are doing a Taylor approximation around one particular steady state. Permanent shocks will move you permanently away from this point. Due to stochastics, exogenous states need to follow specified stochastic processes. The only stochastic process that allows for permanent changes is a unit root process. That is the only way to have an unanticipated permanent stochastic shock. The only alternative here would be to have a fully anticipated deterministic change in an exogenous variable (varexo_det).

Dear Johannes,

Thank you for your answer.

I was able to compute my steady state both by hand and using Matlab.

However when I include these obtained steady state values in initval and endval, and try to simulate a permanent change in the payroll tax rate (an exogenous variable) using initival and endval, Dynare cannot find the steady state of my model. The residuals Dynare shows are very close to 0 for every equation but still tells me that it cannot find the steady state of my model.

Any idea about the reason?

It tells me the following message:

SOLVE: maxit has been reached

Residuals of the static equations:

Equation number 1 : 1.0699e-07
Equation number 2 : 1.0699e-07
Equation number 3 : -1.4374e-07
Equation number 4 : -1.4782e-07
Equation number 5 : 2.694e-06
Equation number 6 : 3.0233e-06
Equation number 7 : 2.7061e-06
Equation number 8 : 3.0374e-06
Equation number 9 : 1.6499e-05
Equation number 10 : 4.5116e-06
Equation number 11 : 4.4916e-06
Equation number 12 : 1.6548e-05
Equation number 13 : 4.3862e-06
Equation number 14 : -2.7143e-06
Equation number 15 : 4.4062e-06
Equation number 16 : -2.6303e-06
Equation number 17 : 2.2147e-05
Equation number 18 : -3.3459e-07
Equation number 19 : 2.2261e-05
Equation number 20 : -2.3541e-07
Equation number 21 : -0.00013267
Equation number 22 : -0.00022332
Equation number 23 : -0.0001326
Equation number 24 : -0.00022319
Equation number 25 : 0.00013663
Equation number 26 : 0.00078366
Equation number 27 : 0.00013662
Equation number 28 : 0.00078366
Equation number 29 : 2.6731e-05
Equation number 30 : 0.00013393
Equation number 31 : 2.6645e-05
Equation number 32 : 0.00013387
Equation number 33 : -0.00024497
Equation number 34 : 0.00029395
Equation number 35 : -0.00024511
Equation number 36 : 0.00029388
Equation number 37 : 2.7575e-06
Equation number 38 : 2.7481e-06
Equation number 39 : 1.8841e-06
Equation number 40 : 1.8721e-06
Equation number 41 : 3.0199e-06
Equation number 42 : 2.9739e-06
Equation number 43 : -3.9968e-06
Equation number 44 : -4.6367e-06
Equation number 45 : 1.7702e-05
Equation number 46 : 1.7856e-05
Equation number 47 : -3.6779e-05
Equation number 48 : -3.6863e-05
Equation number 49 : -3.6829e-05
Equation number 50 : -3.6834e-05
Equation number 51 : -4.6767e-05
Equation number 52 : -4.6861e-05
Equation number 53 : -9.7959e-05
Equation number 54 : -8.5215e-05
Equation number 55 : -9.7823e-05
Equation number 56 : -8.5149e-05
Equation number 57 : 3.0168e-06
Equation number 58 : 1.7616e-05
Equation number 59 : 1.7723e-05
Equation number 60 : -1.5111e-06
Equation number 61 : -1.418e-06
Equation number 62 : -1.4078e-06
Equation number 63 : -1.4188e-06
Equation number 64 : 3.8936e-05
Equation number 65 : 3.8897e-05
Equation number 66 : 0.00017778
Equation number 67 : 0.00017777
Equation number 68 : 0.00010224
Equation number 69 : 0.0001022
Equation number 70 : 0
Equation number 71 : 0
Equation number 72 : 0
Equation number 73 : -8.4577e-06
Equation number 74 : -8.8477e-06
Equation number 75 : -3.4708e-05
Equation number 76 : -3.2504e-05

Error using print_info (line 74)
Impossible to find the steady state. Either the model doesn’t have a steady state, there are an infinity
of steady states, or the guess values are too far from the solution

Error in steady (line 92)
print_info(info,options_.noprint, options_);

Error in twocountry (line 577)

Error in dynare (line 180)
evalin(‘base’,fname) ;

I attach the .mod file, as well as the .m file that helped me calculate the initial steady state and a pdf file with the equilibrium equations of my model.

Thank you very much for your help,

All the best,

Equilibrium two country.pdf (292 KB)
Copy_of_Untitled6.m (2.77 KB)
Copy_of_twocountry.mod (15.8 KB)

Please try the unstable version. There the file worked for me and Dynare was able to find the steady states. Please check why your external file yields different steady state values than Dynare does. Either your external file or the equations in the mod-file must contain an error as they are not the same.

Dear Johannes,

Thank you very much for your answer.

Interestingly, I had not seen your message and this morning I simplified my model to a basic NK one, with 13 common basic equations.

However, Dynare can still not find the basic zero-inflation steady state, where inflation is equal to zero, and the optimal price set by firms is equal to the price of previous period.

This model is quite common, as well as the constant consumption zero inflation steady state, so I am really confused by the fact that Dynare finds a steady state where inflation is not zero.

Please find as attached the model 13 equations as well as my mod file and the file used to compute the steady state.

Thank you very much for your help,

Simple DSGE model.pdf (217 KB)
scenario1.m (563 Bytes)
scenarioone.mod (2.43 KB)

Maybe because in your first equation

should be

Dear Johannes,

Thank you for your message.

Indeed I forgot the bracket. Correcting this omission and running the one-country model model, Dynare found the zero-inflation steady state (similar to the one I obtained by hand) and Blanchard-Kahn conditions are satisfied (5 eigenvalues larger than 1 and 5 forward-looking variables).

I then introduced the second country, maintaining the assumption of a single central bank (monetary union), complete markets, and the absence of trade between the two countries.

I now find myself in the situation where there are 9 eigenvalues larger than one for 10 forward-looking variables. Therefore Blanchard Kahn conditions are not satisfied and my model is facing instability. I understand that this is due to the presence of a common central bank, i.e. a unique interest rate rule. To test this hypothesis, I have introduced a second interest rate rule (one central bank for each country), and the stability issue disappeared, confirming my intuition.

Do you have any idea regarding how I could fix the violation of BK condition without relaxing my unique central bank (and therefore unique interest rate rule) assumption and my complete markets assumption?

I attach the two-coutry, unique central bank (monetary union), complete markets, no trade model, as well as the .mod file.

Thank you very much for your help,

scenariotwo.mod (4.47 KB)
scenariotwo.pdf (233 KB)

I am not an expert in this type of model, but the assumption of no trade may be a problem. Usually real exchange rate depreciation makes sure that there is an equilibrium. But your FOCs imply no uncovered interest parity, which makes the monetary policy rule strange.

Dear Johannes,

I try to run my code with the unstable version, but it seems I cannot use the unstable version. It is not possible to use the unstable version if I already have another version installed on my computer?

Kind regards,


What do you mean? You need to make sure the unstable version is on top of your Matlab path. Use e.g.

when this is the path to your unstable version in the Matlab Windows to put it on top.