pip install SymbolicDSGE
pip install "SymbolicDSGE[fred]" # FRED API utilities
pip install "SymbolicDSGE[ui]" # Web based GUISymbolicDSGE is a Python DSGE engine with a compiled backend for first and second order perturbations, OBCs, and symbolically linearized DSGE models; supporting a broad set of features spanning:
- DSGE model specification, symbolic manipulation, and linearization
- Bayesian and maximum-likelihood estimation
- Simulation and impulse-response-function utilities
- Multiple Kalman filter variants
- 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
SymbolicDSGE ships a [ui] dependency with the goal of making DSGE basic experiments accessible to non-programmers.
GUI users can:
- Create a model config
- Load and adjust existing configs
- Estimate
- Solve
- Simulate
- Create and run Monte Carlo experiments
- Apply data transformations to outputs
- Produce figures
- Access raw output data
There are two intended ways to access the GUI:
# Option 1: Serve the GUI from the command line
# This launches an empty GUI and the configuration should be done through the Builder tab.
sdsge-ui# Option 2: Serve the GUI with a pre-loaded SolvedModel object
# Read a config and solve the model as usual
from SymbolicDSGE import ModelParser, DSGESolver
model, kalman = ModelParser(...).get_all()
solver = DSGESolver(model, kalman)
compiled = solver.compile(...)
sol = solver.solve(compiled, ...)
# Serve the GUI with the solved model pre-loaded in the reference slot
sol.serve(open_browser=True)The UI supports multiple tabs for model building, estimation, simulation, and Monte Carlo experiments.
While most features are not supported in their entirety; the UI offers a low-code interface for basic DSGE experiments
and crucially, displaying the results from a .sdsge experiment bundle.
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.
from SymbolicDSGE import ModelParser, DSGESolver
# 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()
print("Equations with symbols removed: \n", "\n".join(map(str, compiled.objective_eqs)), "\n")>>> 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
# Solve the compiled model
sol = solver.solve(
compiled,
parameters=None,
ss_seed=[0.0, 0.0, 0.0, 0.0, 0.0],
)
print("Is stable: ", sol.policy.stab == 0)
print("Eigenvalues: ", sol.policy.eig)>>> Is stable: True
Eigenvalues: [0.28 +0.j 0.83 +0.j 0.85 +0.j 2.605+0.j 1.185+0.j]
# Plot IRFs (single or multi shock)
sol.transition_plot(
T=25,
shocks=["e_g", "e_z"],
scale=1.0,
observables=True,
)