This repository contains a Fortran90
code that replicates the steady state model in Gross Worker Flows over the Business Cycle by Per Krusell, Toshihiko Mukoyama, Richard Rogerson, and Ayşegül Şahin. In my machine, this implementation of the model is around 40% faster than the one available in the AER website.
The code can be compiled by any Fortran compiler. Here is one way to do it using gfortran:
- Navigate to the folder where the
.f90
files are located. - Create an executable file. There is a wide range of flags one can use with gfortran. Here are the two options I usually use:
- Less optimised but helpful to find bugs:
gfortran -g -fcheck=all -fbacktrace -Wall -mcmodel=large Globals.f90 Utils.f90 Initialisation.f90 VFiteration.f90 Simulation.f90 Main.f90 -o main.out
- Optimised:
gfortran -mcmodel=large Globals.f90 Utils.f90 Initialisation.f90 VFiteration.f90 Simulation.f90 Main.f90 -O3 -o main.out
- Execute:
./main.out
The code is divided in four main parts:
- Initialisation. Reads the parameters of the model from the outside world, creates global variables (such as the asset grid, productivity discretisation, ...) and model shocks.
- Find decision rules. Uses value function iteration and the golden search method to find the policy functions associated to the Bellman equations described in the paper.
- Simulation. Combines policy functions and shocks in a Monte Carlo simulation to compute aggregate variables and labour market statistics.
- Equilibrium. Iterates over steps 2 and 3 in order to find equilibrium prices.
This code may contain bugs and errors. Pull requests and suggestions are more than welcome.