A Python toolkit for DSGE models
Project description
dsgekit
A Python toolkit for Dynamic Stochastic General Equilibrium (DSGE) modeling.
Status
- Version:
0.1.0rc1(release candidate pre-release) - API stability: evolving
- Minimum Python version:
3.13(frompyproject.toml)
What Is Included
- Model loading from
.mod, YAML, and Python dict/API sources - Linear workflow: linearization, QZ/BK solving, IRFs, simulation, moments, FEVD
- State-space pipeline: Kalman filter, RTS smoother, forecasting, historical decomposition
- Estimation: MLE, MAP, MCMC (with diagnostics), marginal data density
- Nonlinear solvers: first-, second-, and third-order perturbation (with pruning)
- Deterministic workflows: perfect foresight and one-constraint
occbin-lite - Policy and welfare tooling: OSR sweeps, Ramsey/discretionary LQ, welfare comparisons
- Baseline regression harness and CI workflow for compatibility checks
Installation
From source (recommended at this stage)
git clone https://github.com/gustavovargas/dsgekit.git
cd dsgekit
python3.13 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
Optional extras
pip install -e ".[plot]" # plotting
pip install -e ".[sym]" # symbolic derivatives
pip install -e ".[speed]" # numba acceleration
pip install -e ".[all]" # all optional extras
Quick Start
from dsgekit import load_model
from dsgekit.simulate import irf
from dsgekit.solvers import solve_linear
from dsgekit.transforms import linearize
model, cal, ss = load_model("tests/fixtures/models/ar1.yaml")
solution = solve_linear(linearize(model, ss, cal))
responses = irf(solution, "e", periods=20)
print(responses.data.head())
CLI Overview
dsgekit info model.mod
dsgekit solve model.mod
dsgekit irf model.mod -s e -p 20
dsgekit simulate model.mod -n 200 --seed 42
dsgekit estimation model.mod --method mle --params rho
dsgekit forecast model.mod -p 12
dsgekit decompose model.mod
dsgekit osr model.mod --grid phi_pi=1.0:3.0:9 --loss pi=1.0 --loss y=0.5
dsgekit baseline_regression --baselines tests/fixtures/baselines
Documentation Map
docs/quickstart.mddocs/formats.mddocs/first_order_perturbation.mddocs/second_order_perturbation.mddocs/third_order_perturbation.mddocs/perfect_foresight.mddocs/occbin_lite.mddocs/forecast_decomposition.mddocs/osr.mddocs/ramsey_lq.mddocs/discretion_lq.mddocs/welfare.mddocs/performance.mddocs/mod_workflow_migration.md
Full index: docs/index.md
Examples
python examples/ar1_pipeline.py
python examples/nk_forward_looking.py
python examples/nonlinear_girf.py
python examples/occbin_zlb_toy.py
python examples/reference_model_zoo.py
Contributing and Security
- Contribution guide:
CONTRIBUTING.md - Code of conduct:
CODE_OF_CONDUCT.md - Security policy:
SECURITY.md
Legal
dsgekitis an independent project and is not affiliated with third-party tool maintainers.- Implementation provenance and attribution policy:
docs/legal_and_attribution.md. - Naming policy for third-party references:
docs/brand_naming_policy.md. - Dependency notices:
THIRD_PARTY_NOTICES.md.
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dsgekit-0.1.0rc1.tar.gz.
File metadata
- Download URL: dsgekit-0.1.0rc1.tar.gz
- Upload date:
- Size: 177.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a22baa86a912165abc823859968b9175c945716c3afddb9957aa44c5086cbdf5
|
|
| MD5 |
caa499d7231cd88bfb445cae88f51ee4
|
|
| BLAKE2b-256 |
2bbd2a73b9ced7a50a6712ea58044e958f696a8ea5f81365ed43533e89bfb2b5
|
Provenance
The following attestation bundles were made for dsgekit-0.1.0rc1.tar.gz:
Publisher:
publish-pypi.yml on gustavovargas/dsgekit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dsgekit-0.1.0rc1.tar.gz -
Subject digest:
a22baa86a912165abc823859968b9175c945716c3afddb9957aa44c5086cbdf5 - Sigstore transparency entry: 927228267
- Sigstore integration time:
-
Permalink:
gustavovargas/dsgekit@5389979eb0d02bfc922f13a3ae9893e098c0a853 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/gustavovargas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@5389979eb0d02bfc922f13a3ae9893e098c0a853 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file dsgekit-0.1.0rc1-py3-none-any.whl.
File metadata
- Download URL: dsgekit-0.1.0rc1-py3-none-any.whl
- Upload date:
- Size: 155.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a930d8356be25d26e19663982f00f7bc34ca7137a5711f08d682943749bba9a
|
|
| MD5 |
6dc89cd4f4d1baa23d0321ed141cdb03
|
|
| BLAKE2b-256 |
6cf5a3689b18efbb21eddf3caa75ee6a0a6450925da1d421102eb846004583c2
|
Provenance
The following attestation bundles were made for dsgekit-0.1.0rc1-py3-none-any.whl:
Publisher:
publish-pypi.yml on gustavovargas/dsgekit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dsgekit-0.1.0rc1-py3-none-any.whl -
Subject digest:
0a930d8356be25d26e19663982f00f7bc34ca7137a5711f08d682943749bba9a - Sigstore transparency entry: 927228268
- Sigstore integration time:
-
Permalink:
gustavovargas/dsgekit@5389979eb0d02bfc922f13a3ae9893e098c0a853 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/gustavovargas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@5389979eb0d02bfc922f13a3ae9893e098c0a853 -
Trigger Event:
workflow_dispatch
-
Statement type: