{"id":50974994,"url":"https://github.com/ericleonen/shocktalk","last_synced_at":"2026-06-19T06:33:21.332Z","repository":{"id":348402327,"uuid":"1189222664","full_name":"ericleonen/shocktalk","owner":"ericleonen","description":"Natural language interface for building and playing with DSGE models","archived":false,"fork":false,"pushed_at":"2026-04-04T06:17:35.000Z","size":26865,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-04T06:33:05.995Z","etag":null,"topics":["dsge","macroeconomics","natural-language","simulation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ericleonen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-23T05:14:37.000Z","updated_at":"2026-04-04T06:17:38.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ericleonen/shocktalk","commit_stats":null,"previous_names":["ericleonen/shock-talk","ericleonen/shocktalk"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ericleonen/shocktalk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericleonen%2Fshocktalk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericleonen%2Fshocktalk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericleonen%2Fshocktalk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericleonen%2Fshocktalk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ericleonen","download_url":"https://codeload.github.com/ericleonen/shocktalk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericleonen%2Fshocktalk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34520431,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dsge","macroeconomics","natural-language","simulation"],"created_at":"2026-06-19T06:33:20.721Z","updated_at":"2026-06-19T06:33:21.326Z","avatar_url":"https://github.com/ericleonen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ShockTalk\n\nShockTalk is a natural-language interface for building and playing with Dynamic Stochastic General Equilibrium (DSGE) models. It is built on top of a Python library, also named `shocktalk`, that allows you to create simple, linear DSGE models in plain syntax.\n\n---\n\n## How It Works\n\n1. **Natural language → ShockTalk syntax.** You describe the model in plain English (e.g. \"Inflation today is driven by expected future inflation, the current output gap, and a cost-push shock.\"). A language model translates this into ShockTalk's equation syntax.\n2. **ShockTalk syntax → econpizza YAML.** The equations are parsed, validated, and compiled into a [econpizza](https://github.com/gboehl/econpizza) YAML model definition.\n3. **Simulation.** econpizza solves the rational-expectations equilibrium and returns impulse-response paths as a `pd.DataFrame`.\n\nYou can also skip step 1 and write ShockTalk syntax directly — see the example below.\n\n---\n\n## Supported Models\n\nShockTalk supports **log-linearized** models — a specific and widely-used approximation technique in macroeconomics.\n\n### What log-linearization means\n\nMost macroeconomic models are inherently nonlinear (e.g. a Cobb-Douglas production function $Y = K^\\alpha N^{1-\\alpha}$). Log-linearization approximates the model by replacing each variable with its **percentage deviation from steady state**:\n\n$$\\hat{x}_t = \\frac{x_t - x^\\ast}{x^\\ast} \\approx \\log x_t - \\log x^{*}$$\n\nwhere $x^*$ is the steady-state level of $x$. The resulting equations are linear in the $\\hat{x}_t$ terms, which makes the model tractable to solve analytically and simulate efficiently.\n\n### Why all variables start at zero\n\nBecause every variable is expressed as a deviation from its own steady state, the steady state of the transformed system is exactly zero for every variable — by definition. A value of `0.01` in the simulation output means the variable is 1% above its steady-state level; `0` means it is exactly at steady state.\n\nThis has a convenient practical consequence: you never need to know or specify the actual steady-state levels ($Y^*$, $\\Pi^*$, etc.). Those levels get divided out in the transformation, so only the **parameters governing dynamics** — how fast variables return to steady state, how they co-move — need to be supplied. Simulations always start from steady state, meaning all variables begin at zero before any shock is applied.\n\n### Equation syntax\n\nShockTalk supports models where every equation is **linear** in the following terms:\n\n| Term | Syntax | Meaning |\n|------|--------|---------|\n| Current variable | `x` | $x_t$ |\n| Forward variable | `F[x]` | $E_t[x_{t+1}]$ |\n| Lagged variable | `L[x]` | $x_{t-1}$ |\n| Shock process | `eps_*` | AR(1) state, e.g. $\\varepsilon^d_t$ |\n| White noise | `e_*` | i.i.d. innovation to a shock process |\n\nEquations must take the form of a single endogenous variable on the left-hand side, with a linear combination of the terms above on the right-hand side. Coefficients may be arbitrary (nonlinear) expressions in parameters (symbols that are neither variables nor shocks).\n\n### Example\n\nA standard three-equation New Keynesian model:\n\n$$\n\\begin{aligned}\ny_t      \u0026= E_t[y_{t+1}] - \\frac{1}{\\sigma}(r_t - E_t[\\pi_{t+1}]) + \\varepsilon^d_t \\\\\n\\pi_t    \u0026= \\beta\\, E_t[\\pi_{t+1}] + \\kappa\\, y_t + \\varepsilon^u_t \\\\\nr_t      \u0026= \\phi_\\pi \\pi_t + \\phi_y y_t\n\\end{aligned}\n$$\n\n```python\nfrom dsge import DSGE\n\nmodel = DSGE([\n    \"y  = F[y] - (1/sigma)*(r - F[pi]) + eps_d\",\n    \"pi = beta*F[pi] + kappa*y + eps_u\",\n    \"r  = phi_pi*pi + phi_y*y\",\n])\n\nirf = model.simulate(\n    parameters={\n        \"sigma\": 1.0,  \"beta\": 0.99, \"kappa\": 0.1,\n        \"phi_pi\": 1.5, \"phi_y\": 0.5,\n        \"rho_d\": 0.8,  \"rho_u\": 0.8,\n    },\n    shocks={\"e_d\": 0.01},  # 1% demand shock in period 0\n    T=40,\n)\n```\n\n`simulate` returns a `pd.DataFrame` with `T + 1` rows (periods 0 … T) and one column per endogenous variable, in deviations from steady state:\n\n```\n        eps_d     eps_u        pi         r         y\nperiod\n0      0.0100    0.0000    0.0058    0.0116    0.0077\n1      0.0080    0.0000    0.0046    0.0093    0.0055\n2      0.0064    0.0000    0.0037    0.0074    0.0040\n...\n```\n\n### What is Not Supported\n\n- Nonlinear terms in endogenous variables (e.g. `y**2`, `y*pi`)\n- Leads or lags beyond one period (e.g. `F[F[x]]`, `L[L[x]]`)\n- Equations without a unique stable rational-expectations equilibrium (Blanchard-Kahn violations)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericleonen%2Fshocktalk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericleonen%2Fshocktalk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericleonen%2Fshocktalk/lists"}