Solving rational expectations model - Sims form I am trying to solve my first ratex model and make some impulse response functions using Dynare. I am following Leeper (1991). 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}|&lt;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?
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:



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?