Skip to main content

A diagnostic suite for linear DSGE models with a custom backend supporting symbolic manipulation.

Project description

SymbolicDSGE logo

by Güney Kıymaç


DOI   tests   pre-commit   coverage   wakatime   PyPI Downloads

Installation

pip install SymbolicDSGE
pip install "SymbolicDSGE[fred]"  # FRED API utilities
pip install "SymbolicDSGE[sr]"    # Symbolic Regression Deps

Useful Links

Overview

SymbolicDSGE is a Python DSGE engine with a JIT compiled backend for linear and linearized DSGE models, supporting symbolic manipulation features for in-place model modification. It also provides measurement-equation augmentation tools, including symbolic regression for complete or restricted free-form function discovery and OLS, Ridge, Lasso, and Elastic Net for structured linear coefficient estimation. The library supports a wide set of features beyond augmentation:

  • DSGE model specification, symbolic manipulation, and linearization
  • Bayesian and maximum-likelihood estimation
  • Simulation and impulse-response-function utilities
  • Gaussian and extended Kalman filtering
  • Automatic data retrieval from FRED
  • Custom shock distributions via SciPy or user-defined samplers
  • Monte Carlo pipelines for comparing models or model-generated samples, including:
    • Statistical tests
    • Regression setups
    • Output transformations
    • Filtering
    • Data generation

Read the Docs

Alongside API references and implementation conventions, the documentation includes guides covering model setup, estimation, simulation, and filtering. The documentation is kept up to date and aims to clarify conventions, workflows, and implementation choices throughout SymbolicDSGE. Suggestions for improving or extending the documentation are welcome as issues.

AI Parsability

The documentation is a static Material MkDocs site, so web-enabled AI tools should be able to search, parse, and summarize it reliably.

Minimal Example

from SymbolicDSGE import ModelParser
from SymbolicDSGE import DSGESolver
from numpy import float64, array

# Read the YAML config (Equations, Measurements, Parameters, Optional Filter Spec)
parsed = ModelParser("<path-to-config>.yaml").get_all()
model, kalman = parsed

# Compile the model
solver = DSGESolver(model, kalman)
compiled = solver.compile(
    variable_order=None,
    params_order=None,
    n_state=3,
    n_exog=2,
    linearize=False,
)
print("Equations with symbols removed: \n", "\n".join(map(str, compiled.objective_eqs)), "\n")
print("Equations as passed to the solver: \n", compiled.equations)
>>> Equations with symbols removed:
 -beta*fwd_Pi + cur_Pi - cur_x*kappa - cur_z
-cur_g + cur_x - fwd_x + tau_inv*(cur_r - fwd_Pi)
-cur_r*rho_r - e_R + fwd_r + (rho_r - 1)*(fwd_Pi*psi_pi + fwd_x*psi_x)
-cur_g*rho_g - e_g + fwd_g
-cur_z*rho_z - e_z + fwd_z


Equations as passed to the solver:
 <function DSGESolver.compile.<locals>.equations at 0x0000012D16AB5B20>
# Solve the compiled model
sol = solver.solve(
    compiled,
    parameters=None,
    steady_state=array([0.0, 0.0, 0.0, 0.0, 0.0], dtype=float64),
)
print("Is stable: ", sol.policy.stab == 0)
print("Eigenvalues: ", sol.policy.eig)
>>> Is stable:  True
Eigenvalues:  [0.27920118+0.j 0.83000003+0.j 0.84999992+0.j 2.56517116+0.j 1.18470582+0.j]
# Plot IRFs (single or multi shock)
sol.transition_plot(
    T=25,
    shocks=["g", "z"],
    scale=1.0,
    observables=True,
)
image

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

symbolicdsge-1.3.4.tar.gz (240.1 kB view details)

Uploaded Source

Built Distribution

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

symbolicdsge-1.3.4-py3-none-any.whl (310.7 kB view details)

Uploaded Python 3

File details

Details for the file symbolicdsge-1.3.4.tar.gz.

File metadata

  • Download URL: symbolicdsge-1.3.4.tar.gz
  • Upload date:
  • Size: 240.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for symbolicdsge-1.3.4.tar.gz
Algorithm Hash digest
SHA256 928ddc7627ee60870444f8d7a968dbca5c65f6aa55381d5fc1c0481708aa8663
MD5 64981c01e1bab55020b1e829a075f4cf
BLAKE2b-256 4cbd34e9308f633d2012dcc606343a859fce2bdbb9071168141f5ebc0df2e60b

See more details on using hashes here.

File details

Details for the file symbolicdsge-1.3.4-py3-none-any.whl.

File metadata

  • Download URL: symbolicdsge-1.3.4-py3-none-any.whl
  • Upload date:
  • Size: 310.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for symbolicdsge-1.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 caabe72f76fc8de048ba864c246e5a3153fc4751e02139decb78795b8e9f1cd3
MD5 59eeea99f6ff46bc77baa3b54e89bcab
BLAKE2b-256 5723ab544f3187cb5add7ad68c358758e11c93ec0195928019f25b6ff07ed2de

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