Skip to main content

Python Platform for DSGE Modeling

Project description

Python Framework for DSGE Models

Authors: Alexei Goumilevski and James Otterson

What it is:

This Framework is designed to assist economists in the development and execution of Dynamic Stochastic General Equilibrium (DSGE) models within a Python environment.

Installation

Users are advised to create a virtual environment in Python to isolate this installation and its packages from the system-wide Python environment and other virtual environments. There are three ways to install the Snowdrop package:

1. Clone the GitHub Repository (Recommended)

This method gives you full access to the source code and examples, including automated tests. It also allows for easy updates via git pull.

cd your_working_directory  
git clone https://github.com/gumilevskij/Framework.git  
python -m venv env  
source env/bin/activate  
pip install -r Framework/requirements.txt

2. Install from the Wheel File

The repository includes a pre-built .whl (wheel) file in the folder Framework/dist. By copying this file to your local disk, you can install this package directly:

pip install snowdrop-1.0.7-py3-none-any.whl --user

This method is useful if you want a simple install from a local file without pulling from PyPI.

3. Install via PyPI

You can install the latest version of Snowdrop directly from PyPI using pip:

pip install pysnowdrop --upgrade

Quick Start

  • Create or modify a YAML model file in the supplements/models folder.

  • Open tests/test_toy_models.py and set the variable fname to the name of your model file.

  • Run simulations using the Spyder IDE by clicking the Run button, or execute the script from the command line:

    python tests/test_toy_models.py
    
  • To run automated tests, use the command:

    pytest tests
    

Documentation

Below are useful resources to help you understand the structure and usage of the Snowdrop framework:

  • Sample model file: supplements/models/Toy/JLMP98.yaml This file provides a working example of a YAML-based model specification. You can use it as a template to create your own models.

  • User guide (PDF): supplements/docs/UserGuide.pdf The user guide contains detailed instructions on how to configure models, run simulations, and interpret outputs. It also describes supported YAML fields and Python options.

  • API documentation: Open supplements/api_docs/_build/html/index.html in your web browser This HTML-based API reference provides an overview of the module structure, key functions, and their expected inputs/outputs.

Highlights:

  • The Framework is written in Python and utilizes only Python libraries available through the Anaconda distribution.
  • It is versatile in parsing model files written in human-readable YAML format, Sirius XML format, as well as simple IRIS and DYNARE model files.
  • Prototype model files are available for both non-linear and linear perfect-foresight models.
  • The Framework can be executed as a batch process, in a Jupyter notebook, or within a Spyder interactive development environment (Scientific Python Development environment).
  • It parses the model file, checks syntax for errors, and generates source code for Python functions, computing the Jacobian up to the third order in symbolic form.
  • Non-linear equations are solved iteratively using Newton's method. Two algorithms are implemented: ABLR stacked matrices method and LBJ forward-backward substitution method.
  • Linear models are solved using Binder and Pesaran's method, Anderson and More's method, and two generalized Schur methods that replicate calculations used in Dynare and Iris.
  • Non-linear models can be executed with time-dependent parameters.
  • The Framework can be employed to calibrate models to identify model parameters. Calibration can be performed for both linear and non-linear models, applying a Bayesian approach to maximize the likelihood function that incorporates prior beliefs about parameters and the model's goodness of fit to the data.
  • It can sample model parameters using the Markov Chain Monte Carlo affine invariant ensemble sampler algorithm developed by Jonathan Goodman.
  • The Framework utilizes the Scientific Python Sparse package for algebra with large matrices.
  • Several filters have been implemented, including Kalman (for linear and non-linear models), Unscented Kalman, LRX, HP, Bandpass, and Particle filters. Multiple versions of Kalman filter and smoother algorithms have been developed, including diffuse and non-diffuse, as well as multivariate and univariate filters and smoothers.
  • As a result of the runs, the Framework generates one- and two-dimensional plots and saves data in Excel files and in a Python SQLite database.

DISCLAIMERS:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE

DOI

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

pysnowdrop-1.0.8.tar.gz (14.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pysnowdrop-1.0.8-py3-none-any.whl (14.8 MB view details)

Uploaded Python 3

File details

Details for the file pysnowdrop-1.0.8.tar.gz.

File metadata

  • Download URL: pysnowdrop-1.0.8.tar.gz
  • Upload date:
  • Size: 14.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.2 Linux/5.4.0-205-generic

File hashes

Hashes for pysnowdrop-1.0.8.tar.gz
Algorithm Hash digest
SHA256 7a3521fb05e4e483806692eacc55ac21a06d373e2b93cde57ddbdd94ba11c29e
MD5 b85169e435eff5643491693dc4ef8541
BLAKE2b-256 fe90096ea792fe52748e4dabd7b1d67fd1db2c7ecb745c809a24e02843b66ae9

See more details on using hashes here.

File details

Details for the file pysnowdrop-1.0.8-py3-none-any.whl.

File metadata

  • Download URL: pysnowdrop-1.0.8-py3-none-any.whl
  • Upload date:
  • Size: 14.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.2 Linux/5.4.0-205-generic

File hashes

Hashes for pysnowdrop-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 0ea1f33b289701d73e05cfb8231083bfe4581aeda85530e05b4699342d317263
MD5 6fe809b12552833d8bb010fd668f595b
BLAKE2b-256 c56767873a11cb5465667d7c283cf47446b2cc7366c8a229872454bffcb9f403

See more details on using hashes here.

Supported by

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