# Conditional variance decomposition for order 2 with pruning (Dynare 5.0)

Hi,
congrats to all the team for Dynare 5.0.
When I use it, I do not find the variance decompositions in the results or log file when I run:

``````stoch_simul(nograph,order=2,pruning,irf=40,conditional_variance_decomposition=[1,4,40],contemporaneous_correlation)
``````

However, it is working great on Dynare 4.6.4

Best,
Jonathan

Hi Jonathan,

the manual states that the conditional variance decomposition is available at `order<3` and without `pruning`.

I hope that helps.

If so, why it is working under Dynare 4.6.4 but not Dynare 5.0 ?

Unfortunately, I canâ€™t offer a detailed answer.

My hunch is that there is a change made by the programmers in the computation of theoretical moments at second order.

By comparing the two manuals from Dynare 4.6.4 and 5.0 I noticed that
Dynare manual 4.6.4 and 5.0 state under `conditional_variance_decomposition`:

â€śIn case of `order=2`, Dynare provides a second-order accurate approximation to the true second moments based on the linear terms of the second-order solution (see Kim, Kim, Schaumburg and Sims (2008)).â€ť

Dynare manual 5.0 states under `pruning`:

" When specified, theoretical moments are based on the pruned state space, i.e. the computation of second moments uses all terms as in Andreasen, FernĂˇndez-Villaverde and Rubio-RamĂ­rez (2018), page 10 as opposed to simply providing a second-order accurate result based on the linear solution as in Kim, Kim, Schaumburg and Sims (2008)."

Maybe this is the reason why the `pruning` option is now incompatible with the `conditional_variance_decomposition` option.

Exactly. That is the reason. Theoretical variance decompositions are available for linear policy functions only. Without `pruning` at `order=2`, Dynare will use the first order terms of the policy functions to compute the variance decomposition and other second-order moments. This obviously involves an approximation because we throw away the quadratic terms of the second order solution, but is still second-order accurate, because after squaring the policy rules, these terms would be higher than order 2.

With `pruning`, Dynare will not do an additional approximation for the second order moments, i.e. keep all the terms. But this means we cannot compute the theoretical variance decomposition.

1 Like

Thank you Max and Johannes for your detailed explanations.

Does this change from Dynare 4.6.4 to 5.0 means we have to run a mod file for variance decompositions (without pruning, order 1 or 2), and another one with pruning?

Indeed, Dynare 4.6.4 allowed to avoid this effort because (order=2,pruning,conditional_variance_decompositionâ€¦) worked well for both purposes.

Not necessarily, but you will need a second `stoch_simul`-command without pruning.

I see, I still think the previous solution was better for practical reasons.