k-order perturbation for DSGE: tensor vs matrix, Einstein summation, Faà Di Bruno, tensor unfolding
Channel: Willi Mutschler
Date: 2022-06-15

This video is a didactic reference and in-depth review of k-order perturbation. The first 80 minutes of the video cover the ingredients, notation and mathematical concepts underlying the perturbation approach. The second-part goes into a detail exposition of the algorithmic steps to recover the coefficients of the approximated policy functions. The focus is really on understanding the general algorithm and how the tools and concepts from the first part can be applied.
We also cover implementation details in Dynare.

Warning: this video is not targeted at beginners or newcomers to DSGE models, but for those who want to understand the perturbation approach in quite some detail.

Slides, notes and codes: https://mutschler.eu/dynare/perturbation

**Timestamps**
0:00:51 - Dynare Model Framework and Information Set
0:04:10 - Typology and Ordering of Variables
0:06:26 - Declaration vs Decision Rule (DR) Ordering
0:08:46 - Perturbation Parameter
0:11:31 - Policy Function
0:13:23 - Implicit Function Theorem
0:14:17 - Taylor Approximations

Notation
0:15:31 - dropping indices
0:17:12 - (nested) policy functions
0:18:50 - dynamic model in terms of (nested) policy functions
0:20:27 - input vectors for different functions

Perturbation
0:22:07 - What is the goal?
0:27:18 - Discussion of assumption of differentiability

Matrix vs Tensor
0:28:57 - Pros and Cons
0:30:44 - What is a Tensor?
0:32:30 - Einstein Summation Notation
0:33:22 - Examples

Faà di Bruno's formula
0:38:24 - Idea
0:40:47 - Notation
0:46:18 - Equivalence Sets (Bell polynomials)
0:49:35 - Fx
0:51:49 - Fxu
0:57:00 - Fxxu
1:00:33 - Fxuu
1:00:58 - Fxuup
1:01:28 - Fxss

Tensor Unfolding
1:03:19 - idea
1:07:07 - matrix multiplication rules, Kronecker products and permutation matrices
1:08:10 - Fx
1:09:05 - Fxu
1:10:48 - Fxxu
1:14:18 - Shortcut permutation matrices
1:15:41 - Shortcut switch terms in Kronecker
1:16:46 - Fxuu
1:19:26 - Fxuup
1:20:34 - Fuss

1:22:18 - Perturbation Approximation: Overview of algorithmic steps

First-order Approximation
1:24:10 - Doing the Taylor Expansion and Evaluating it
1:25:44 - Necessary and Sufficient Conditions

Recovering gx
1:26:42 - necessary expressions in both tensor and matrix representation
1:32:03 - solve a quadratic Matrix equation

1:32:43 - Important Auxiliary Perturbation Matrices A and B used at higher-orders

Recovering gu
1:33:48 - necessary expressions in both tensor and matrix representation
1:35:17 - developing terms
1:36:32 - take inverse of A

Recovering gs
1:36:38 - necessary expressions in both tensor and matrix representation
1:39:14 - developing terms
1:40:45 - take inverse of (A+B)
1:41:04 - Certainty Equivalence at first-order

Second-order Approximation
1:42:19 - Doing the Taylor Expansion and Evaluating it
1:46:41 - Necessary and Sufficient Conditions

Recovering gxx
1:47:49 - necessary expressions in both tensor and matrix representation
1:50:07 - developing terms
1:51:09 - Solve Generalized Sylvester Equation
1:51:45 - how to algorithmically compute the RHS by evaluating a conditional Faà di Bruno formula

Recovering guu
1:55:57 - necessary expressions in both tensor and matrix representation
1:56:48 - developing terms
1:57:37 - take inverse of A
1:57:47 - how to algorithmically compute the RHS by evaluating a conditional Faà di Bruno formula

Recovering gxu
2:00:59 - necessary expressions in both tensor and matrix representation
2:01:27 - developing terms
2:01:59 - take inverse of A
2:02:16 - how to algorithmically compute the RHS by evaluating a conditional Faà di Bruno formula

Recovering gxs
2:03:54 - necessary expressions in both tensor and matrix representation
2:05:24 - developing terms
2:06:32 - solving Generalized Sylvester Equation (actually zero RHS)
2:07:30 - how to algorithmically compute the RHS by evaluating a conditional Faà di Bruno formula

Recovering gus
2:09:35 - necessary expressions in both tensor and matrix representation
2:10:07 - developing terms
2:10:45 - take inverse of A (actually zero RHS)
2:11:22 - how to algorithmically compute the RHS by evaluating a conditional Faà di Bruno formula

Recovering gss
2:11:45 - necessary expressions in both tensor and matrix representation
2:13:17 - developing terms
2:15:07 - take inverse of (A+B)
2:15:51 - level correction for uncertainty
2:16:12 - how to algorithmically compute the RHS by evaluating a conditional Faà di Bruno formula

Third-order Approximation
2:16:36 - necessary and sufficient conditions
2:17:36 - summary of equations
2:18:35 - linear correction for uncertainty

k-order Approximation
2:19:40 - necessary and sufficient conditions
2:21:25 - order of computation

2:22:25 - Computational Remarks as of Dynare 5.1

**References**
- Juillard and Kamenik (2014)
- Levintal (2017)
- Mutschler (2022) - coming soon
- Schmitt-Grohé and Uribe (2004)

**Corrections**
-

Checkout https://mutschler.eu/dynare for more stuff on DSGE models and Dynare.