<p>Jordi Galís book &quot;Monetary Policy, Inflation, and the Business Cycle&quot; features the 3-equation &quot;Simple New Keynesian&quot; Model:</p>
<p><span class="math-container">\begin{align*}
    \pi_t &amp;= \beta E_t[\pi_{t+1}] + \kappa\tilde{y_t}\\
    \tilde{y}_t &amp;= -\frac{1}{\sigma}\left(i_t-E_t[\pi_{t+1}]-r_t^n\right)+E_t[\tilde{y}_{t+1}]\\
    i_t &amp;= \rho + \phi_\pi\pi_t + \phi_y\tilde{y}_t+v_t.
\end{align*}</span></p>
<p>This is 3 equations in 3 variables (<span class="math-container">$\tilde{y}_t,\pi_t,i_t$</span>) (you also have to specify the shock, <span class="math-container">$v_t$</span>, so in some sense it is 4 equations). This is really a work horse model in modern business cycle analysis. You should probably read more about the variables and in particular the parameters in Galí's book to ensure that the model has a unique and stable equilibrium under your calibration.</p>

CC BY-SA 4.0
2021-04-13T12:14:36.940Z
2021-04-13T14:48:02.493Z
2021-04-13T14:48:02.493Z
Greased Dog
<p>As mentioned by Michael <a href="https://quantecon.org/" rel="noreferrer">quantecon</a> has good resources. <a href="https://notes.quantecon.org/submission/5b3ec499b9eab00015b89f97" rel="noreferrer">Here</a> is an example of very simple DSGE model from quantecon.</p>
<p>I am not sure if you can get to as low as 3 equations but here is very simple example of real business cycle DSGE by <a href="http://www.chadfulton.com/topics/estimating_rbc.html" rel="noreferrer">Chad Fulton</a>. I won't copy all the code from the site, you can just follow the link which has full code, but it is based on the following set of equations and it is quite simple</p>
<p><span class="math-container">$$ \psi c_t = (1−α)z_t(k_t/n_t)^α \text{ static FOC}$$</span></p>
<p><span class="math-container">$$ 1/c_t = \beta E_t\left(\frac{1}{c_{t+1}} \left[αz_{t+1}(k_{t+1}n_{t+1})^{α−1}+(1−δ)\right]\right) \text{Euler Equation}$$</span></p>
<p><span class="math-container">$$ y_t = z_tk^α_tn^{1−α}_t \text{ Production Function}$$</span></p>
<p><span class="math-container">$$ y_t = c_t + i_t \text{ Resource Constraint} $$</span>
<span class="math-container">$$k_t =(1−δ)k_t+i_t \text{ Capital Evolution}$$</span>
<span class="math-container">$$1 =l_t+n_t  \text{ Labor-leisure Tradeoff}$$</span>
<span class="math-container">$$\ln z_t=ρ \ln z_{t−1}+ε_t\text{ Technology Shocks}$$</span></p>
<p>Where; <span class="math-container">$y_t$</span> is output, <span class="math-container">$c_t$</span> consumption, <span class="math-container">$i_t$</span> investment, <span class="math-container">$n_t$</span> labor, <span class="math-container">$l_t$</span> leisure, <span class="math-container">$k_t$</span> capital stock, <span class="math-container">$z_t$</span> technology and rest are parameters. <span class="math-container">$β$</span> is discount rate, <span class="math-container">$ψ$</span> marginal disutility of labor, <span class="math-container">$δ$</span> depreciation, <span class="math-container">$α$</span> capital share of output, <span class="math-container">$ρ$</span> technology shock.</p>
<p>You could probably simplify it a bit further but not much more.</p>

CC BY-SA 4.0
2021-04-13T11:15:31.307Z
2021-04-13T11:27:21.497Z
2021-04-13T11:27:21.497Z
1muflon1
<p>I want to create a DSGE model in Python. I want to build it myself to help me understand it (not just use a library)</p>
<p>Can someone direct me to a very simple model which would be straightforward to understand, and quick to implement?</p>
<p>(I hear there are some 3- or 4-equation models, but I'm wondering if there's a quick summary of the actual equations so I can get straight to coding)</p>
<p>Thanks!</p>

CC BY-SA 4.0
2021-04-13T07:52:34.640Z
I think you are likely to find something like  that at: [quantecon.org](https://quantecon.org/)
Michael Greinecker
<dsge>
Ultra simple DSGE to implement
Mich55
# Ultra simple DSGE to implement

(Asked by: username_0 on 2021-04-13)

I want to create a DSGE model in Python. I want to build it myself to help me understand it (not just use a library)

Can someone direct me to a very simple model which would be straightforward to understand, and quick to implement?

(I hear there are some 3- or 4-equation models, but I'm wondering if there's a quick summary of the actual equations so I can get straight to coding)

Thanks!

**Tags:** dsge
> **Comments:**
> **username_1**: I think you are likely to find something like  that at: [quantecon.org](https://quantecon.org/)  

---

## 2 answers

### Answer by username_3 on 2021-04-13. Score: 6 | Accepted answer

As mentioned by Michael [quantecon](https://quantecon.org/) has good resources. [Here](https://notes.quantecon.org/submission/5b3ec499b9eab00015b89f97) is an example of very simple DSGE model from quantecon.

I am not sure if you can get to as low as 3 equations but here is very simple example of real business cycle DSGE by [Chad Fulton](http://www.chadfulton.com/topics/estimating_rbc.html). I won't copy all the code from the site, you can just follow the link which has full code, but it is based on the following set of equations and it is quite simple

$$ \psi c\_t = (1−α)z\_t(k\_t/n\_t)^α \text{ static FOC}$$

$$ 1/c\_t = \beta E\_t\left(\frac{1}{c\_{t+1}} \left[αz\_{t+1}(k\_{t+1}n\_{t+1})^{α−1}+(1−δ)\right]\right) \text{Euler Equation}$$

$$ y\_t = z\_tk^α\_tn^{1−α}\_t \text{ Production Function}$$

$$ y\_t = c\_t + i\_t \text{ Resource Constraint} $$
$$k\_t =(1−δ)k\_t+i\_t \text{ Capital Evolution}$$
$$1 =l\_t+n\_t \text{ Labor-leisure Tradeoff}$$
$$\ln z\_t=ρ \ln z\_{t−1}+ε\_t\text{ Technology Shocks}$$

Where; $y\_t$ is output, $c\_t$ consumption, $i\_t$ investment, $n\_t$ labor, $l\_t$ leisure, $k\_t$ capital stock, $z\_t$ technology and rest are parameters. $β$ is discount rate, $ψ$ marginal disutility of labor, $δ$ depreciation, $α$ capital share of output, $ρ$ technology shock.

You could probably simplify it a bit further but not much more.


---

### Answer by username_2 on 2021-04-13. Score: 5

Jordi Galís book "Monetary Policy, Inflation, and the Business Cycle" features the 3-equation "Simple New Keynesian" Model:

\begin{align\*}
\pi\_t &= \beta E\_t[\pi\_{t+1}] + \kappa\tilde{y\_t}\\
\tilde{y}\_t &= -\frac{1}{\sigma}\left(i\_t-E\_t[\pi\_{t+1}]-r\_t^n\right)+E\_t[\tilde{y}\_{t+1}]\\
i\_t &= \rho + \phi\_\pi\pi\_t + \phi\_y\tilde{y}\_t+v\_t.
\end{align\*}

This is 3 equations in 3 variables ($\tilde{y}\_t,\pi\_t,i\_t$) (you also have to specify the shock, $v\_t$, so in some sense it is 4 equations). This is really a work horse model in modern business cycle analysis. You should probably read more about the variables and in particular the parameters in Galí's book to ensure that the model has a unique and stable equilibrium under your calibration.


---

