Hi all,
I am trying to compute optimal macroprudential policy using the ramsey_policy command but I get an “Index exceeds matrix dimensions” error when I try to run the .mod file.
It’s the first time I’ve been using this command so I am not very confident that the way I’m trying to implement it is correct. In particular, I have the following doubts:

I am calculating the steady state analytically in a separate file, and given that both instruments relate to cyclical policy, they should not affect the steady state. Should I just compute steadystate values for all variables except the instruments (taus and taun in my case) and then set initial values for the instruments in the .mod file?

If I have N variables and 2 instruments, should I have N  2 equations in my .mod file?
I attach the .mod and _steadystate files for reference.
Best,
Marco
nkopenadjbankpruramsey.mod (7.0 KB)
nkopenadjbankpruramsey_steadystate.m (1.5 KB)
You need to use a proper steady state file or steady_state_model
block. See e.g. https://github.com/DynareTeam/dynare/blob/master/tests/optimal_policy/Ramsey/ramsey_ex.mod
Your current file does not take care of returning a vector of the right size.
Dear professor Pfeifer,
thank you for the prompt reply. I understand that the error stems from the vector output by the steady state file having the wrong number of dimensions, but I was wondering why that is the case.
My current understanding (and the procedure I used in the files posted above) is that, if I have N variables, 2 of which are instruments, my steady state file should output a N2 dimensional vector and my .mod file should provide a guess for the 2 instruments in the initval block, is this correct?
Thanks again!
Best,
Marco
There is a difference between the numerical values you need to provide (N2) and the size the output vector
needs to have N+#Lagrange Multipliers. That’s why I said you should use a proper steady state file. See e.g. https://github.com/DynareTeam/dynare/blob/master/examples/NK_baseline_steadystate.m
At a minimum, do not change the size of the vector ys
coming into your file.
Dear professor Pfeifer,
Thank you very much for the explanation! Following your advice, I changed the steady state file so that it only changes the values of variables in the ys vector instead of redefining it as the previous file did.
However, when I run the dynare file I now get the following error: “Undefined function or variable ‘ys’”. I also tried computing the steady state in the steady_state_model block in the .mod file but I get the same error. Any idea why this might be the case?
The new steady state file is attached for reference.
Best,
Marco
nkopenadjbankpruramsey_steadystate.m (1.8 KB)
Please provide the full modfile with the steady_state_model
block.
Here is the .mod file, I wrote it in levels so it’s easier to check.
Thanks again!
Best,
Marco
nkopenadjbankpruramseylevels.mod (7.3 KB)
If you type
resid
after the error message, you will see
Residuals of the static equations:
Equation number 1 : 0
Equation number 2 : 0
Equation number 3 : 0
Equation number 4 : 0
Equation number 5 : 0
Equation number 6 : 0
Equation number 7 : 0.57613
Equation number 8 : 0
Equation number 9 : 0
Equation number 10 : 0
Equation number 11 : 0
Equation number 12 : 0
Equation number 13 : 0
Equation number 14 : 0
Equation number 15 : 0
Equation number 16 : 0
Equation number 17 : 0.68067
Equation number 18 : 0
Equation number 19 : 0
Equation number 20 : 0
Equation number 21 : 0
Equation number 22 : 0
Equation number 23 : 0
Equation number 24 : 0
Equation number 25 : 0
Equation number 26 : 0
Equation number 27 : 0
Equation number 28 : 0
Equation number 29 : 0
Equation number 30 : 0
Equation number 31 : 0
Equation number 32 : 0
Equation number 33 : 0
Equation number 34 : 0
Equation number 35 : 0
Equation number 36 : 0
Equation number 37 : 0
So there is still a problem with your steady state computation.