# Dynare 3rd order solution matrices

I’m currently working on modeling a disaster shock in a 2 country RBC model. I have taken the log-linearized solution matrices to simulate the model using a non-linear disaster shock (normalized shock to have expectation zero so solution matrices are valid).

I’m able to retrieve the 2nd order simulation matrices, however I’m not sure what the appropriate formula is for simulating a 3rd order approximation. (I got a formula for 2nd order approx from Eric Sim notes on dynare) The matrices that dynare outputs in 3rd order have different names. For example, in 2nd order the relevant 2nd order matrices are denoted ghxx, ghxu and ghuu.

I expected to see names of ghxxx, ghxxu, ghxuu, ghuuu for 3rd order instead, however now the extra matrices are denoted g_0, g_1, g_2, g_3. I’m also not sure how the kronecker products look like for the 3rd order approximation. Any help would be much appreciated, I essentially want 3rd order approx to get at time-varying risk premia that 1st/2nd order approximations are missing.

It is not recommended to program stochastic simulations yourself. Instead, use the `simult_`-function that takes care of this. An example would be https://github.com/JohannesPfeifer/DSGE_mod/blob/master/RBC_news_shock_model/RBC_news_shock_model.mod

Thanks Johannes-
a clarifying question: does stoch_simul allow you to input non-gaussian shocks? My main motivation in manually conducting simulations is because I’m trying to input a disaster shock, for example to productivity logZ(t)=rhologZ(t-1)+e_t in non-disaster state, and log(Z(t)=rhologZ(t-1)+log(b)+e_t in disaster state, where b=0.7 for example (30% drop in productivity in disaster), and disaster probability is constant and given by p_dis.

You can provide any shock matrix you like to `simult_.m`. But you should make sure it is consistent with the respective moments of the shock distribution. Please have a look at the caveats at