Author: Keqing Liu, Xiamen University
This repository contains MATLAB implementations of various computational methods for solving dynamic macroeconomic models. All codes solve a standard Real Business Cycle (RBC) model using different numerical approaches, providing a practical toolkit for understanding computational economics. These codes are a part of my course I teach at Xiamen University named Advanced Macroeconomics: Banking, Finance, and Computational Methods.
Note: These implementations prioritize educational clarity over computational efficiency. The codes are designed to:
- Clearly illustrate algorithm implementation as discussed in lectures
- Help students understand the underlying mechanics of each method
However, I start to improve some part of efficiency in coding starting from time iteration. As you become more comfortable with the algorithms and MATLAB, you're encouraged to develop more efficient versions.
The original codes are in MATLAB, but I am also working on the Python version so that people who use Python to write codes.
The project demonstrates how to solve the same textbook RBC model using:
- Value Function Iteration
- Time Iteration
- Perturbation Methods
- Projection Methods
-
doc_MATLAB.md- Introduction to MATLAB environment, basic MATLAB syntax and programming guide -
example_introduction.m- Examples of fundamental programming concepts (for loops, while loops, if statements, etc.) -
myfactorial.m- function that calculate factorials of$n$ . Compare it with the built-in function factorial()
-
rbc_valueIteration.m- Main file for solving RBC model using value function iteration (basic implementation without vectorization or parallel computing) -
rbc_VI.m- function that updates optimal consumption and labor decisions given state nodes and value grid from previous iteration -
tauchen.m- function that incorporates a discretization method which uses a Markov chain to approximate an AR(1) process proposed by Tauchen (1986). -
allterp11.m- function that makes linear interpolation. It is also okay to use built-in function interp1(). -
rbc_vfi_parallel.m- Another file for solving RBC model using value function iteration, but with vectorization and parallel computing. -
rbc_VI2.m- function that updates optimal consumption and labor decisions given state nodes and value grid from previous iteration, but with more dense grid of consumption and labor, without exceeding the range of capital. -
rbc_VI3.m- function that updates optimal consumption and labor decisions given state nodes and value grid from previous iteration, but with more dense grid of labor and utilizes the static optimal relation between consumption and labor.
-
rbc_policyIteration.m-main file for solving RBC model using time iteration, but with vectorization and parallel computing. -
rbc_eqm_PI.m- function that solves the optimal consumption and labor decisions given state nodes and policy function grids of consumption and labor from previous iteration the previous policy function is used to calculate expectations. -
tauchen.m- function that incorporates a discretization method which uses a Markov chain to approximate an AR(1) process proposed by Tauchen (1986). -
allterp11.m- function that makes linear interpolation. Similar usage as in value function iteration.
rbc_log.mod- main file for solving RBC model with log utility. Download DYNARE package and install in MATLAB path.BasicNK.mod- main file for the new Keynesian model learned in advanced macro 2.BasicNK_steadystate.mod- function that incorporated steady state values into the mod fileBasicNK.mod.
chebychev.m-main file for solving RBC model using Chebychev polynomials and collocation methods.residual_fcn.m- function that solves the coefficients of Chebychev polynomials.-
tauchen.m- function that incorporates a discretization method which uses a Markov chain to approximate an AR(1) process proposed by Tauchen (1986).
GK_run.m- an excecution file for solving a simplified version of Gertler-Karadi (2011) model.GK.mod- main file for solving the simplified version of Gertler-Karadi (2011) model.GK_parameterSS.m- function that incorporated steady state values.incorporate_parameterSS_GK;- function that incorporated steady state values into the mod fileGK.mod.