MacroModelling.jl - fast prototyping of dynamic stochastic general equilibrium (DSGE) models

Author: Thore Kockerols (@thorek1)

The package supports dicsrete-time DSGE models and the timing of a variable reflects when the variable is decided (end of period for stock variables).

As of now the package can:

  • parse a model written with user friendly syntax (variables are followed by time indices ...[2], [1], [0], [-1], [-2]..., or [x] for shocks)
  • (tries to) solve the model only knowing the model equations and parameter values (no steady state file needed)
  • calculate first, second, and third order perturbation solutions using (forward or reverse-mode) automatic differentiation (AD)
  • calculate (generalised) impulse response functions, simulate the model, or do conditional forecasts
  • calibrate parameters using (non stochastic) steady state relationships
  • match model moments
  • estimate the model on data (kalman filter using first order perturbation)
  • differentiate (forward AD) the model solution (first order perturbation), kalman filter loglikelihood (reverse-mode AD), model moments, steady state, with respect to the parameters

The package is not:

  • guaranteed to find the non stochastic steady state
  • the fastest package around

The former has to do with the fact that solving systems of nonlinear equations is hard (an active area of research). Especially in cases where the values of the solution are far apart (have a high standard deviation - e.g. sol = [-46.324, .993457, 23523.3856]), the algorithms have a hard time finding a solution. The recommended way to tackle this is to set bounds in the @parameters part (e.g. r < 0.2), so that the initial points are closer to the final solution (think of steady state interest rates not being higher than 20% - meaning not being higher than 0.2 or 1.2 depending on the definition). <!– Furthermore, the package cannot solve incomplete non stochastic steady state problems. This is to say that often with other packages the non stochastic steady state is solved for in a separate file or calculation. This allows for more flexibility but also more involvement from the developer side. This package tries to automatise that process as much as possible but the user nonetheless has to think about the validity of the non stochastic steady state problem. –>

The latter has to do with the fact that julia code is fast once compiled, and that the package can spend more time finding the non stochastic steady state. This means that it takes more time from executing the code to define the model and parameters for the first time to seeing the first plots than with most other packages. But, once the functions are compiled and the non stochastic steady state has been found the user can benefit from the object oriented nature of the package and generate outputs or change parameters very fast.

The package contains the following models in the models folder: