<p>I think I have managed to solve it. However, not the way I was initially hoping. I simplified the stacked matrices using the given conditions and some assumptions. Here is my solution:</p>

<p>Eq. (3) I write as $\pi_{t+1} = \alpha \beta \pi_{t} + \beta \theta_{t} + \eta_{t+1}$</p>

<p>Forwarding equation (4) one period and arranging it in terms on $b_{t+1} = -\varphi_{1} {\pi_{t+1}} - \varphi_{2}{\pi_{t}}  + (\beta^{-1}- \gamma)\widetilde{b_{t}} - \varphi_{3} \theta_{t+1} \ - \psi_{t+1} - \varphi_{4} \theta_{t} = 0$</p>

<p>$\pi_{t+1}$ simplified by eq. (3)</p>

<p>$\theta_{t+1} = \rho_{1} \theta_{t} + \epsilon_{1,t+1}$</p>

<p>$\psi_{t+1}$ can be written as its AR(1) formulation as well. Putting the four equations in matrix form results in:</p>

<p><a href="https://i.sstatic.net/n3gyX.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/n3gyX.gif" alt="enter image description here"></a></p>

<p>Which is what I was after. However, this made me wonder what was wrong with the method I was trying above. Looking at the top corner of the coefficient matrix (i.e the 4x4 matrix in the top left corner) it is clearly $\Gamma_{0}^{-1} \Gamma_{1}$. But the rest of the matrix I am unsure of. </p>

<p>And question (2) remains, once I have solved for the variables of interest, will I be ready to make IRF's?</p>

CC BY-SA 3.0
2017-08-19T17:17:43.323Z
2017-08-19T17:17:43.323Z
user11767
<p>If you are planning on using Dynare, you do not need to "solve" the model using Sim's method. Dynare takes care of the solution algorithm for you. </p>

<p>If you want to get to IRFs quickly, I suggest writing up the linearized version of your model in a <code>.mod</code> file, then from Matlab, simply run <code>dynare model.mod</code>. </p>

<p><a href="http://www.dynare.org/documentation-and-support/examples" rel="nofollow noreferrer">Here</a> are some example <code>.mod</code> files for you to work from (simply replace the equations with your own model's equations). </p>

<p>You may also want to take a look at the <a href="http://www.dynare.org/phpBB3/" rel="nofollow noreferrer">Dynare forum</a>, which can help you with all sorts of questions related to setting up models and solving them. </p>

CC BY-SA 3.0
2017-08-31T05:36:29.870Z
2017-08-31T06:27:26.203Z
2017-08-31T06:27:26.203Z
James Graham
<p>I am trying to solve my first ratex model and make some impulse response functions using Dynare. I am following <a href="https://www.researchgate.net/profile/Eric_Leeper/publication/4907434_Equilibria_Under_%27Active%27_and_%27Passive%27_Monetary_Policies/links/56041e7a08ae5e8e3f2fcd1d/Equilibria-Under-Active-and-Passive-Monetary-Policies.pdf" rel="nofollow noreferrer">Leeper (1991)</a>. This is what I have done so far:</p>

<p>The utility function is $\log(c_{t})+\log(m_{t})$. </p>

<p>I obtain two first order conditions:</p>

<p>(1) $\frac{1}{R_{t}} = \beta E_{t}\frac{1}{\pi_{t+1}}$  and</p>

<p>(2) $m_{t} = c[\frac{R_{t}}{R_{t}-1}]$</p>

<p>Where $R_{t}$ is the gross nominal interest rate, $\pi_{t}$ is the gross inflation rate and $c$ the deterministic steady state value of consumption.</p>

<p>Suppose the monetary authority follows the following rule:</p>

<p>$R_{t} = \alpha_{0} + \alpha \pi_{t} + \theta_{t}$ where $\theta_{t} = \rho_{1} \theta_{t-1} + \epsilon_{1t}$,   $|\rho_{1}|&lt;1$</p>

<p>The fiscal authority follows:</p>

<p>$\tau_{t} = \gamma_{0} + \gamma b_{t-1} + \psi_{t}$
where $\psi_{t} = \rho_{2} \psi_{t-1} + \epsilon_{2t}$</p>

<p>I then substitute the monetary policy rule in to (1) and both policy rules in to the government's flow budget constraint and linearize around the steady state. I end up with the same results as Leeper:</p>

<p>(3) $E_{t}\widetilde{\pi_{t+1}} = \alpha \beta \widetilde{\pi_{t}} + \beta \theta_{t}$</p>

<p>(4) $\varphi_{1} \widetilde{\pi_{t}} + \widetilde{b_{t}} + \varphi_{2}\widetilde{\pi_{t-1}}  - (\beta^{-1}- \gamma)\widetilde{b_{t-1}} + \varphi_{3} \theta_{t} \ +\psi_{t} + \varphi_{4} \theta_{t-1} = 0$</p>

<p>where the varphi's are steady state constants. So far I have just replicated what Leeper has done. Since I would like to make IRF's I believe I have to 'solve' the model. I haven't been taught this at university yet so all I know if from reading online lecture notes. I want to use Sims form, i.e </p>

<p>[![enter image description here][1]][1]</p>

<p>And this is the system I ended up with:</p>

<p>[![enter image description here][2]][2]</p>

<p>I forwarded (4) one period in order to obtain $b_{t+1}$ and just put everything in matrix form.
$\eta$ is the forecasting error from (3).</p>

<p>I apologise for the matrix, I am not sure how to write matrices in TeX but hopefully you get the idea. </p>

<p>Now I want to stack the matrices as the following:</p>

<p>The capital gamma's and phi's are the coefficient matrices from above. </p>

<p>There should be a matrix for the forecasting errors but I am not completely sure how to obtain it. But that is a minor issue at this point. If I have understood correctly, I can solve this by inverting the block matrix and since it is diagonal, the inverse is simply the inverse of gamma and phi. However, since phi_0 is singular I cannot invert it. So I have two questions:</p>

<p>(1) How do I deal with singular matrices in this context? I have seen some papers by Chris Sims where he shows to how to deal with singular matrices but my knowledge of linear algebra is too basic to understand it. </p>

<p>(2) Once I manage to solve the model, can I use Dynare to make IRF's?</p>

CC BY-SA 3.0
2017-08-29T00:36:52.317Z
I know this isn't exactly appropriate to ask, but how were you able to derive Equation (4)? I have been trying to solve the same results for at least two hours now.
sageofspades
CC BY-SA 3.0
2017-08-29T10:23:00.157Z
Yeah it took me forever to derive it as well. Basically you substitute the policy rules and eq. (3) in to the flow budget constraint and then linearize around steady state.
user11767
<academic-graduate><difference-equations><dynare><rational-expectations>
Solving rational expectations model - Sims form
user11767
# Solving rational expectations model - Sims form

(Asked by: username_0 on 2017-08-17)

I am trying to solve my first ratex model and make some impulse response functions using Dynare. I am following [Leeper (1991)](https://www.researchgate.net/profile/Eric_Leeper/publication/4907434_Equilibria_Under_%27Active%27_and_%27Passive%27_Monetary_Policies/links/56041e7a08ae5e8e3f2fcd1d/Equilibria-Under-Active-and-Passive-Monetary-Policies.pdf). This is what I have done so far:

The utility function is $\log(c\_{t})+\log(m\_{t})$.

I obtain two first order conditions:

(1) $\frac{1}{R\_{t}} = \beta E\_{t}\frac{1}{\pi\_{t+1}}$ and

(2) $m\_{t} = c[\frac{R\_{t}}{R\_{t}-1}]$

Where $R\_{t}$ is the gross nominal interest rate, $\pi\_{t}$ is the gross inflation rate and $c$ the deterministic steady state value of consumption.

Suppose the monetary authority follows the following rule:

$R\_{t} = \alpha\_{0} + \alpha \pi\_{t} + \theta\_{t}$ where $\theta\_{t} = \rho\_{1} \theta\_{t-1} + \epsilon\_{1t}$, $|\rho\_{1}|<1$

The fiscal authority follows:

$\tau\_{t} = \gamma\_{0} + \gamma b\_{t-1} + \psi\_{t}$
where $\psi\_{t} = \rho\_{2} \psi\_{t-1} + \epsilon\_{2t}$

I then substitute the monetary policy rule in to (1) and both policy rules in to the government's flow budget constraint and linearize around the steady state. I end up with the same results as Leeper:

(3) $E\_{t}\widetilde{\pi\_{t+1}} = \alpha \beta \widetilde{\pi\_{t}} + \beta \theta\_{t}$

(4) $\varphi\_{1} \widetilde{\pi\_{t}} + \widetilde{b\_{t}} + \varphi\_{2}\widetilde{\pi\_{t-1}} - (\beta^{-1}- \gamma)\widetilde{b\_{t-1}} + \varphi\_{3} \theta\_{t} \ +\psi\_{t} + \varphi\_{4} \theta\_{t-1} = 0$

where the varphi's are steady state constants. So far I have just replicated what Leeper has done. Since I would like to make IRF's I believe I have to 'solve' the model. I haven't been taught this at university yet so all I know if from reading online lecture notes. I want to use Sims form, i.e

[![enter image description here][1]][1]

And this is the system I ended up with:

[![enter image description here][2]][2]

I forwarded (4) one period in order to obtain $b\_{t+1}$ and just put everything in matrix form.
$\eta$ is the forecasting error from (3).

I apologise for the matrix, I am not sure how to write matrices in TeX but hopefully you get the idea.

Now I want to stack the matrices as the following:

The capital gamma's and phi's are the coefficient matrices from above.

There should be a matrix for the forecasting errors but I am not completely sure how to obtain it. But that is a minor issue at this point. If I have understood correctly, I can solve this by inverting the block matrix and since it is diagonal, the inverse is simply the inverse of gamma and phi. However, since phi\_0 is singular I cannot invert it. So I have two questions:

(1) How do I deal with singular matrices in this context? I have seen some papers by Chris Sims where he shows to how to deal with singular matrices but my knowledge of linear algebra is too basic to understand it.

(2) Once I manage to solve the model, can I use Dynare to make IRF's?

**Tags:** academic-graduate, difference-equations, dynare, rational-expectations
> **Comments:**
> **username_1**: I know this isn't exactly appropriate to ask, but how were you able to derive Equation (4)? I have been trying to solve the same results for at least two hours now.  
> **username_0**: Yeah it took me forever to derive it as well. Basically you substitute the policy rules and eq. (3) in to the flow budget constraint and then linearize around steady state.  

---

## 2 answers

### Answer by username_0 on 2017-08-19. Score: 1

I think I have managed to solve it. However, not the way I was initially hoping. I simplified the stacked matrices using the given conditions and some assumptions. Here is my solution:

Eq. (3) I write as $\pi\_{t+1} = \alpha \beta \pi\_{t} + \beta \theta\_{t} + \eta\_{t+1}$

Forwarding equation (4) one period and arranging it in terms on $b\_{t+1} = -\varphi\_{1} {\pi\_{t+1}} - \varphi\_{2}{\pi\_{t}} + (\beta^{-1}- \gamma)\widetilde{b\_{t}} - \varphi\_{3} \theta\_{t+1} \ - \psi\_{t+1} - \varphi\_{4} \theta\_{t} = 0$

$\pi\_{t+1}$ simplified by eq. (3)

$\theta\_{t+1} = \rho\_{1} \theta\_{t} + \epsilon\_{1,t+1}$

$\psi\_{t+1}$ can be written as its AR(1) formulation as well. Putting the four equations in matrix form results in:

[![enter image description here](https://i.sstatic.net/n3gyX.gif)](https://i.sstatic.net/n3gyX.gif)

Which is what I was after. However, this made me wonder what was wrong with the method I was trying above. Looking at the top corner of the coefficient matrix (i.e the 4x4 matrix in the top left corner) it is clearly $\Gamma\_{0}^{-1} \Gamma\_{1}$. But the rest of the matrix I am unsure of.

And question (2) remains, once I have solved for the variables of interest, will I be ready to make IRF's?


---

### Answer by username_2 on 2017-08-31. Score: 1

If you are planning on using Dynare, you do not need to "solve" the model using Sim's method. Dynare takes care of the solution algorithm for you.

If you want to get to IRFs quickly, I suggest writing up the linearized version of your model in a `.mod` file, then from Matlab, simply run `dynare model.mod`.

[Here](http://www.dynare.org/documentation-and-support/examples) are some example `.mod` files for you to work from (simply replace the equations with your own model's equations).

You may also want to take a look at the [Dynare forum](http://www.dynare.org/phpBB3/), which can help you with all sorts of questions related to setting up models and solving them.


---

