Create varexo_det: Implementation authored by Johannes Pfeifer's avatar Johannes Pfeifer
This page sketches the implementation in `stochastic_solvers` at `order=1`.
Denote the defined exogenous deterministic variables (`varexo_det`) with $x_t$. At first order, the linearized equations system can be represented as
$$0 = A{\mathbb{E}_t}({y_{t + 1}}) + B{y_t} + C{y_{t - 1}} + D{\varepsilon _t} + K{x_t}$$
Denote the last period where an exogenous deterministic variable appears with $T$. We are looking for a linear decision rule of the form
$${y_t} = F{y_{t - 1}} + G{\varepsilon _t} + \sum\limits_{i = 0}^T {{H_i}} {x_{t + i}}$$
The matrices $F,G$ are known from the standard first-order linear solution. We need to compute the $H_i, 0\leq i\leq T$. Plugging in repeatedly from the solution yields:
$$
\begin{split}
0 &= A{\mathbb{E}_t}({y_{t + 1}}) + B{y_t} + C{y_{t - 1}} + D{\varepsilon _t} + K{x_t} \\
&= A{\mathbb{E}_t}(F{y_t} + G{\varepsilon _{t + 1}} + \sum\limits_{i = 0}^T {{H_i}} {x_{t + i + i}}) + B{y_t} + C{y_{t - 1}} + D{\varepsilon _t} + K{x_t} \\
&= A{\mathbb{E}_t}(F(F{y_{t - 1}} + G{\varepsilon _t} + \sum\limits_{i = 0}^T {{H_i}} {x_{t + i}}) + G{\varepsilon _{t + 1}} + \sum\limits_{i = 0}^T {{H_i}} {x_{t + 1 + i}}) + B(F{y_{t - 1}} + G{\varepsilon _t} + \sum\limits_{i = 0}^T {{H_i}} {x_{t + i}}) + C{y_{t - 1}} + D{\varepsilon _t} + K{x_t} \\
&= \underbrace {\left[ {A{F^2} + BF + C} \right]}_{\mathop = \limits^! 0}{y_{t - 1}} + \underbrace {\left[ {(AF + G)G + D} \right]}_{\mathop = \limits^! 0}{\varepsilon _t} + AF\sum\limits_{i = 0}^T {{H_i}} {x_{t + i}} + A\sum\limits_{i = 0}^T {{H_i}} {x_{t + 1 + i}} + B\sum\limits_{i = 0}^T {{H_i}} {x_{t + i}} + K{x_t}\\
\end{split}
$$
Recognizing that the matrix equation needs to hold for all values of the states, exogenous, and exogenous deterministic variables yields the restrictions:
$$
0 = \underbrace {\left[ {A{F^2} + BF + C} \right]}_{\mathop = \limits^! 0}{y_{t - 1}} + \underbrace {\left[ {(AF + G)G + D} \right]}_{\mathop = \limits^! 0}{\varepsilon _t} + \underbrace {\left[ {AF{H_0} + B{H_0} + K} \right]}_{\mathop = \limits^! 0}{x_t} + \sum\limits_{i = 1}^T {\underbrace {\left[ {AF{H_i} + A{H_{i - 1}} + B{H_i}} \right]}_{\mathop = \limits^! 0}} {x_{t + i}}
$$
This implies that
$$
{H_0} = - K{\left( {AF + B} \right)^{ - 1}}
$$
and for $i\geq 1$
$$
{H_i} = - A{H_{i - 1}}{\left( {AF + B} \right)^{ - 1}}
$$