How dynare solves the DSGE model with second-order perturbation method using its own notation of state equations?

We know that Dynare uses another notation of state equations than the canonical notation used by Schmitt-Grohé and Uribe (2004) (SGU hereafter). I use the first-order linear equations as an example to explain the notation below.

Given the x_t as the vector of state variables determined at t and a_t as the TFP shock, SGU does not explicitly note the innovation of shocks u_t yet puts a_{t+1} into x_t and writes the production function in time t as Y_t=A_tL_t. Therefore the first-order linear equations work as

A\left[\begin{array}{c} E_{t}y_{t+1}\\ a_{t+1}\\ \vdots \end{array}\right]+B\left[\begin{array}{c} y_{t}\\ a_{t}\\ \vdots \end{array}\right]=0 \tag{1}

and the policy functions will be a_{t+1}=h_xa_t and y_t=g_xa_t (the true mapping should be on x_{t-1} but I use a_t for convenience). Therefore the innovation u_t is just an exogenous add-on to a_t.
Dynare uses another notation by putting a_t into x_t and the production function is still Y_t=A_{t}L_t. Therefore the first-order linear equations work as

A\left[\begin{array}{c} E_{t}y_{t+1}\\ a_{t}\\ \vdots \end{array}\right]+B\left[\begin{array}{c} y_{t}\\ a_{t-1}\\ \vdots \end{array}\right]+D\varepsilon_{t}=0 \tag{2}

and the policy functions will be a_{t}=h_xa_{t-1}+q_x\varepsilon_{t} and y_t=g_xa_{t-1}+w_x\varepsilon_{t} (dynare actually uses A\left[\begin{array}{c} E_{t}y_{t+1}\\ E_{t}a_{t+1} \end{array}\right]+B\left[\begin{array}{c} y_{t}\\ a_{t} \end{array}\right]+C\left[\begin{array}{c} y_{t-1}\\ a_{t-1} \end{array}\right]+D\varepsilon_{t}=0 but there is no fundamental difference)

The main difference between these two notations, 1 and 2, are the extra policy term q_x and w_x. The question now should be, how to solve them. For the first-order case, we have some papers such as Klein(2000) or Villemot(2011) who use Dynare’s notation and we can ignore SGU at all! However, for the second-order case, all the literature, such as SGU(2004), Kim et(2008) or Klein et(2011), use the SGU’s notation.

So my question is how dynare separates or solves the q_x, w_x (and their higher order terms) out of SGU’s notation and solution method?

My first conjecture to solve this problem is auxiliary variables. For instance, change the equation 1 to

A\left[\begin{array}{c} E_{t}y_{t+1}\\ a_{t}\\ m_{t+1}\\ \vdots \end{array}\right]+B\left[\begin{array}{c} y_{t}\\ a_{t-1}\\ m_{t}\\ \vdots \end{array}\right]=0

where m_t is the auxiliary variable. It enters into the law of motion of TFP as a_t=\rho a_{t-1}+m_t and its own law of motion is m_{t+1}=0. So the column corresponds to m in the policy function h_x and g_x is what we want, q_x and w_x. In second-order case it is similar. Whereas this method is too tedious and I don’t believe Dynare have used it. The slides Computation first and second approximations verify my concern and Dynare, in fact, solves the response to contemporaneous innovation manually and directly instead of using SGU’s notation (to solve the problem first and then transfer it back to dynare’s notation).

I am not sure I understand the problem. Higher order solutions are done step by step. As shown in e.g. SGU, only at first order you have to solve a quadratic matrix equation. Once that problem is solved with standard techniques like Klein’s method, you will end up with linear problems you can easily solve.

Thanks a lot for your reply! For more clearly to specify my question, I link my notation to the dynare’s notation in its Manual Book. More clearly, if we denote y_t^h in the manual book as y_t^h=\left[\begin{array}{c}s_{t}\\c_{t}\end{array}\right] where x_t is state vector and c_t is control vector. Dynare provides the policy matrix A and B, which can be solved with two options:

Option1: Write the model in the form (1) I mentioned, with auxiliary variables. Using SGU’s method we can solve h_x and g_x. Then map h_x and g_x to A and B.
Option2: Write the model directly in the form (2), using Klein’s method, whose paper uses dynare’s notation instead of SGU’s notation and gets A and B directly.

I have known that dynare uses option 2 instead of option 1 in first-order case as we all know Klein’s paper.

Now let’s go to second-order case.
Option1: Solve h_{xx} and g_{xx} based on SGU first. Then map h_{xx} and g_{xx} to C, D and E, the policy matrix noted in Manual Book.
Option2: Solve C, D and E directly, there is no mapping process(map the two types of notation).

I also knew dynare uses the option 2. My question here is how does dynare conduct the option2, as I have not find any paper solve the second-order perturbation problem through dyanre’s notation. All of them uses SGU’s notation.

I still don’t understand your reference to SGU notation for order 2. If you inspect Section 3.2 of SGU, they don’t make distinction between x^1 and x^2 that would cause differences:

Let me simplify this question further.

Purpose: Solve matrix C, D and E of

y_{t}^{h}=+0.5\Delta^{2}+Ay_{t-1}^{h}+Bu_{t}+0.5C\left(y_{t-1}^{h}\otimes y_{t-1}^{h}\right)+0.5D\left(u_{t}\otimes u_{t}\right)+E\left(y_{t-1}^{h}\otimes u_{t}\right)

Method1:
Following SGU(2004), solve h_{xx} and g_{xx} first.
Split h_{xx} and g_{xx} into C, D and E

Method2:
Given the state space equation

J_{y+}y_{t+1}^{h}+J_{y}y_{t}^{h}+J_{y-}y_{t-1}^{h}+J_{u}u_{t}=0

C is solved from the Sylvester equation

\left(J_{y+}A+J_{y}\right)C+J_{y+}C\left(A\otimes A\right)=-X

D is solved from

D=-\left(J_{y+}A+J_{y}\right)^{-1}\left(X+J_{y+}C\left(B\otimes B\right)\right)

E is solved from

E=-\left(J_{y+}A+J_{y}\right)^{-1}\left(X+J_{y+}C\left(A\otimes B\right)\right)

X is a complicated term. It contains A and the jacobian of A on y_t^h.

Dynare solves the model based on method 2. We do not need to solve h_{xx} or g_{xx} (which I was mentioning “directly”)

But where does the method 2 come from? I do not find any literature that covers this.

The approach in spirit is exactly Section 3.2 of SGU. You take the implicit second order derivatives and will end up with these expression. The only difference is whether you use tensor notation or matrix notation.

Thanks a lot for your reply! I now understand the difference between these two notations.