Here is code contributed byAndy Levin:
% This program reads a Dynare model file (as specified by the string
% variable “infilename” without the .MOD extension), generates the
% first-order conditions of the Ramsey policymaker, and writes out
% a new Dynare model (as specified by the string variable “outfilename”
% without .MOD extension) and an M-file (outfilename_lmss.m) that
% provides a linear system for obtaining the numerical steady-state
% of the Lagrange multipliers.
% © Andrew T. Levin 2005
% Note: This program (and associated subroutines) may be used freely
% subject to acknowledgement of the source and citation of either or
% both of the following papers (for which these routines were created):
% Levin, A., Lopez-Salido, J.D., 2004. “Optimal Monetary Policy with
% Endogenous Capital Accumulation”, manuscript, Federal Reserve Board.
% Levin, A., Onatski, A., Williams, J., Williams, N., 2005. “Monetary
% Policy under Uncertainty in Microfounded Macroeconometric Models.”
% In: NBER Macroeconomics Annual 2005, Gertler, M., Rogoff, K., eds.
% Cambridge, MA: MIT Press.
Get_Ramsey.zip (22.5 KB)
Here is code contributed byAndy Levin:
I have the problem with the example of prof Levin’s software for the second order approximation of the model.
I follow the first three steps of his readme.txt file, namely:
[quote]1. Create a plain-text file containing your model in dynare format…
2. In matlab, set the two string variables infilename (the name of the model file) and outfilename = ‘xxx’ (where xxx is the name of the new file that you’re creating).
3. Now just run get_ramsey.m (which takes no explicit arguments).
You will then need to parse the dynare file created by get_ramsey.
Now to evaluate the Ramsey policy, execute the following steps:…[/quote]
What does exactly
mean? Just running dynare? When I run prof Levin’s example in and out .mod created by get_ramsey it comes out that there is a big discrepancy between the number of variables and the number of equations. I suspect that all the initial values are considered as equations.
So, basically, I cannot execute the further steps of the readme file. You can find this file with the software uploaded by Levin.
Do you know this problem? Maybe you know somebody who used prof Levin’s software?
Thank you very much for your help in advance.
Jorge A. Fornero
University of Antwerp
National Belgian Bank Project
"Price and Wage Rigidities in An Open Economy"
In light of your question, I’ve expanded the instructions for the
get_ramsey code (see the new readme_get_ramsey.pdf, attached below). In particular, you should set up a dynare model file that only includes the model specifications and the initial guesses for the steady state values. (See the example file, BestSW.mod, which is included in the zip file.) Then the get_ramsey code takes this model file and creates a new model file that includes the policymaker’s first-order conditions (which replace the
single-equation policy rule in the original model). If the model isn’t very
big and the steady states of the lagrange multipliers can be readily
computed by the dynare nonlinear solver (executed by the “steady” command), then you can proceed by simply adding parameter values and other dynare statements into the Ramsey model file, and then feed this file to the dynare processor in the same way that you’d normally do.
Alternatively, if a good set of initial guesses is needed for the steady states of the Lagrange multipliers, then you’ll want to follow the corresponding
instructions in the readme.txt file (which involves explicitly parsing the
model file using dynparse.m).
Anyway, I hope that this additional information helps clarify how to use
this code, but definitely feel free to contact me (email@example.com) if
you have any further questions.
readme_get_ramsey.pdf (6.85 KB)
when run the sample bestsw.mod,only get the following results:
??? Error using ==> dynare
ERROR: there are 91 equations for 195 endogenous variables
hi, I run into the same problem, but I can’t figure it out.
You can try the code along with Christiano, Motto and Rastagno
Monetary Policy and Stock Market Boom-Bust Cycles.
Check out their technical appendix and there are a lot of examples to apply the Levin algorithm on some simpler models.
The problem is due to update in Dynare. I guess the parser used in old version is quite different. If you compare the input file and output file when using Levin’s code. You can find all the variables in the input file are counted twice, and that is why we always have more variables than equations. If you check the output file, you can find the keyword “var” are used twice.
We can try rewriting the “dynparse.m” in the package to get something work.
Does anyone have a copy of the Levin & Lopez-Salido manuscript that keeps getting referenced in the readme file and in the code? Thanks very much,