Skip to main content

Solve and estimate linearized DSGE models

Project description

dsgepy

This is a Python library to calibrate, estimate and analyze linearized DSGE models. The interface is inpired by the dynare interface which allows for symbolic declarations of the variables and equations. The implemented bayesian estimation method uses markov chain monte carlo (MCMC) to simulate the posterior distributions of the parameters. This library is an effort to bring the DSGE toolset into the open-source world in a full python implementation, which allows to embrace the advantages of this programming language when working with DSGEs.


Installation

You can install this development version using:

pip install dsgepy

Kalman Filter

Computing the likelihood of models involve using the kalman filter. pykalman is available for python, but some adjustments to the original library are needed to use with this library. So in order for dsgepy to work you need the corrected version of pykalman, available here. Make sure to clone this version and add it to the interpreter befor using dsgepy. The corrections here correct the way pykalman handles masked numpy arrays and deals with ill-estimated covariance matrices.


Example

A full example on how to use this library with a small New Keynesian model is available in this Jupyter notebook. The model used in the example is descibred briefly by the following equations:

Model Especification

For now, the model equations have to be linearized around its steady-state. Soon, there will be a functionality that allows for non-linearized declaration of the equilibrium conditions.

Model Solution

The solution method used is based on the implementation of Christopher A. Sims' gensys function. You can find the author's original matlab code here. The paper explaining the solution method is this one.

Model Estimation

The models are estimated using Bayesian methdos, specifically, by simulating the posterior distribution using MCMC sampling. Simulations are typically long, so there is a functionality that allows you to stop a simulation and continue it later from where it stoped.

Analysis

There are functionalities for computing Impulse-Response funcions for both state variables and observed variables. Historical decomposition is also available, but only when the number of exogenous shocks matches the number of observed variables.


Drawbacks

Since there is symbolic declaration of variables and equations, methdos involving them are slow, so the MCMC methods typically take a long time to run. Although there is room for improvement for the efficiency of these estimation algorithms.


Contributing

If you would like to contribute to this repository, plese check the contributing guidelines here. A list of feature suggestions is available on the projects page of this repository.


More Information and Help

If you need more information and help, specially about contributing, you can contact Gustavo Amarante on developer@dsgepy.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dsgepy-0.1.tar.gz (20.7 kB view hashes)

Uploaded Source

Built Distribution

dsgepy-0.1-py3-none-any.whl (19.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page