## Fix pruned state space at third order

This merge request has two commits. One is simply a fix as there was a wrong display at the command line when calling identification at order=3.

The other (main) one is related to #1706 (closed) and is concerned with (1) correctly setting up the pruned state space ABCD representation at third-order and (2) computing the first two unconditional moments, all given Dynare's model representation instead of the SGU model framework.

References:

- Andreasen, Martin M., Jesús Fernández-Villaverde and Juan F. Rubio-Ramírez (2018): "The Pruned State-Space System for Non-Linear DSGE Models: Theory and Empirical Applications", Review of Economic Studies, Volume 85, Issue 1, Pages 1–49.
- Mutschler, Willi (2018): "Higher-order statistics for DSGE models", Econometrics and Statistics, Volume 6, Pages 44-56.

The comments in `pruned_state_space.m`

contain the main idea of pruning and the necessary law of motions of first-order effects, second-order effects, and third-order effects as well as all auxiliary equations needed to setup the ABCD representation. I simplify the equations by making use of the commutation matrix. Note that compared to Andreasen et al (2018)'s toolbox, who also append the state vector by auxiliary variables for the shocks, this approach drastically reduces the dimensions of the pruned state space and, I hope, is much easier to understand and debug. Also there is still much scope for improvement by making use of the sparsity of the matrices in the discrete Lyapunov equations. In the previous iteration of the function (!1689 (merged)), I forgot to also include the contribution of `E[z_{t-1}e_t']`

in the computation of the variance of the extended state vector, as at third-order this is not zero.

Note that the included unit test model compares the moments computed by pruned_state_space.m with Andreasen et al's toolbox. However, it shows that there must be an error in the computation of second moments in Andreasen et al (2018)'s toolbox (v2) at third-order, as the sixth-order product moments of first-order effects `x_t^f`

are not correct (which are Gaussian and easily computed once we know the covariance matrix of xf). Our computations in `pruned_state_space.m`

, however, compute these correctly. I am in contact with Martin and will fix the error in their toolbox (which is quite cumbersome). Once that is done I will update the testfile accordingly to show that both approaches yield numerically the same unconditional first two moments.

Please backport this to 4.6.