# Understanding 2nd Order Policy Functions

Hi,

I’m trying to back out the policy function from a non-linear model solved using ‘order=2’. To do this efficiently, I gather that the go-to place is oo_.dr. However, I’m struggling to understand some of the internals relative to what is printed in the command window upon running stoch_simul. I’m assuming that the method to generate the approximation to the policy function follows Schmidt-Grohe & Uribe (2004, JEDC)? If so, then here is what I understand:

i) oo_.dr.ghs2 is the correction’ term that appears in the print-out.
ii) oo_.dr.ghx and oo_.dr.ghu are the usual coefficients multiplying the vector of pre-determined (or exogenous state) variable deviation from the steady state and the vector of shocks (analogous to 1st order perturbation).
iii) oo_.dr.ghxx is a matrix of coefficients next to the covariance of state variables (expressed as deviations from the steady state).
iv) oo_.dr.ghuu is the matrix of coefficients next to the covariance of shocks.

Here is what I don’t understand:

i) How is the correction term computed? It should reflect the difference between the steady state and the non-ergodic mean upon repeatedly sampling shocks stored in oo_.endo_simul, right?
ii) Why is oo_.dr.ghxu not equal to zero? Theorem 1 in SGU (2004) states that setting them to zero ensures that a unique solution exists. Is this something to do with pruning?

Thanks

1. The correction term is dr.ghs2/2, so it is the \frac{1}{2}g_{\sigma\sigma}
2. This term is reponsible for the stochastic steady state (no shocks, but with a precautionary motive) being different from the steady state. Your question in contrast relates to the ergodic mean (where you sample with shocks). See Simult_ and nonzero IRFs in higher-order approximations
3. dr.ghxu does not correspond to g_{x\sigma}. The sigma is the perturbation parameter, while the u refers to the shock. The reason there is a ghxu` is that Dynare allows for a more general shock structure than the linear one in the equation below (1) in the SGU paper. In SGU, \ln A_t is part of x_t. Dynare splits this. \ln A_{t-1} is part of x_t and \varepsilon_t belongs into what Dynare calls u_t.